osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Need to find the centroid of a circular camera image


On Monday 24 September 2018 18:47:08 Dennis Lee Bieber wrote:

> On Mon, 24 Sep 2018 12:06:19 -0400, Gene Heskett
> <gheskett at shentel.net>
>
> declaimed the following:
> >On Monday 24 September 2018 10:55:23 Chris Angelico wrote:
> >> On Tue, Sep 25, 2018 at 12:54 AM Gene Heskett
> >> <gheskett at shentel.net>
> >
> >wrote:
> >> > On Sunday 23 September 2018 16:24:23 Oscar Benjamin wrote:
> >> > > On Sun, 23 Sep 2018 at 20:45, Gene Heskett
> >> > > <gheskett at shentel.net>
> >> >
> >> > wrote:
> >> > > > save the image and locate the centroid of that saved image.
> >> > > >
> >> > > > Is there code to do that centroid math in somebodies "bottom
> >> > > > desk drawer"? Something I could download and control with a
> >> > > > bash script which I'm fair at?
> >> > >
> >> > > This is easy enough to in OpenCV. The code at the top of this
> >> > > page does what you want:
> >> > >
> >> > > https://docs.opencv.org/3.4.2/dd/d49/tutorial_py_contour_featur
> >> > >es. html
> >> >
> >> > I take it that this is python-2.7? code?
> >> >
> >> > Searching thru the python3 results in synaptic, on a stretch
> >> > install on the rock64, python3 has not a p3 version of numpy or
> >> > cv2.
> >> >
> >> > And I'd like to try and make it run on 3.5 since that seems to be
> >> > the newest on stretch. That would tend to future-proof this past
> >> > the final fixes and eventual demise of python-2.
> >> >
> >> > Is there hope for things like numpy and cv2 being ported to
> >> > python 3? Or can numpy and cv2 be used against 3.5 as is?
> >>
> >> Dunno about cv2, but numpy is certainly available for Python 3.
> >
> >What do they call it in debian stretch for arm64?
>
> 	Well, in Raspbian they show up as...
>
>
> Linux raspberrypi 4.14.69-v7+ #1141 SMP Mon Sep 10 15:26:29 BST 2018
> armv7l
>
Thats a 32 bit kernel, the rt version has been tried and found wanting, 
very high throwaway percentages for keyboard and mouse events.

> The programs included with the Debian GNU/Linux system are free
> software; the exact distribution terms for each program are described
> in the individual files in /usr/share/doc/*/copyright.
>
> Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
> permitted by applicable law.
> Last login: Fri Sep 14 12:36:56 2018 from
> fe80::c932:bd85:577:9922%eth0 pi at raspberrypi:~$ python3 --version
> Python 3.5.3
> pi at raspberrypi:~$ python3
> Python 3.5.3 (default, Jan 19 2017, 14:11:04)
> [GCC 6.3.0 20170124] on linux
> Type "help", "copyright", "credits" or "license" for more information.
>
> >>> import numpy
>
> 	I don't remember installing numpy -- it just seems to be there...
>
> pi at raspberrypi:~$ sudo apt search numpy
> Sorting... Done
> Full Text Search... Done
>
> 	<SNIP EXTRANEOUS>
>
>
> python3-bottleneck/stable 1.2.0-6 armhf
>   Fast NumPy array functions written in C - Python 3
>
> 	<SNIP>
>
> python3-numexpr/stable 2.6.1-4 armhf
>   Fast numerical array expression evaluator for Python 3 and NumPy
>
> python3-numexpr-dbg/stable 2.6.1-4 armhf
>   Fast numerical array expression evaluator for Python 3 and NumPy
> (debug ext)
>
> python3-numpy/stable,now 1:1.12.1-3 armhf [installed]
>   Fast array facility to the Python 3 language
>
> python3-numpy-dbg/stable 1:1.12.1-3 armhf
>   Fast array facility to the Python 3 language (debug extension)
>
> python3-numpydoc/stable 0.6.0+ds1-1 all
>   Sphinx extension to support docstrings in Numpy format -- Python3
>
> 	<SNIP>
>
> python3-rasterio/stable 0.36.0-1+b2 armhf
>   Python 3 API for using geospatial raster data with Numpy
>
> python3-scipy/stable 0.18.1-2 armhf
>   scientific tools for Python 3
>
> python3-scipy-dbg/stable 0.18.1-2 armhf
>   scientific tools for Python 3 - debugging symbols
>
> python3-seaborn/stable 0.7.1-4 all
>   statistical visualization library
>
> python3-snuggs/stable 1.4.1-1 all
>   S-expressions for numpy - Python 3 version
>
> 	<SNIP MORE EXTRANEOUS>
>
>
> 	Only hits for cv2 are Java
>
> pi at raspberrypi:~$ sudo apt search cv2
> Sorting... Done
> Full Text Search... Done
> libcv2.4/stable 2.4.9.1+dfsg1-2 all
>   computer vision library - libcv* translation package
>
> libopencv2.4-java/stable 2.4.9.1+dfsg1-2 all
>   Java bindings for the computer vision library
>
> libopencv2.4-jni/stable 2.4.9.1+dfsg1-2 armhf
>   Java jni library for the computer vision library
>
> pi at raspberrypi:~$
>
> 	However, Raspbian is 32-bit Debian-based. I don't know what would be
> needed to configure/install a pure 64-bit Debian on the RPi-3.
>
In all likelyhood, it won't be running on the pi-3b, but on a rock64, 
which is arm64.  So its called armbian.
>
>
> --
> 	Wulfraed                 Dennis Lee Bieber         AF6VN
> 	wlfraed at ix.netcom.com    HTTP://wlfraed.home.netcom.com/

On the rock64, python has numpy but not cv2, python3 has neither.

And doesn't have pip or pip3 in the repo's.

But on a swag, it did install python-cv2*, so maybe it will run this 
stuff after all. But despite a "sudo apt install cv2" pulling in 30 some 
packages, cv2 is not available to import, at least not by that name..

I might have to use a broken pi 3b, I think it has a blown gpio pin, but 
it otherwise still ran the last time it was powered up. All I need to do 
is find it. In that mess, it could be a chore. Organization has never 
been a strong point of mine...

Thanks Dennis.

-- 
Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
 soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>