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 2018-09-24 16:52, Gene Heskett 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_features.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?

Sure it can. Just use pip. There are even binary manylinux wheels!
https://pypi.org/project/opencv-python/


There's a numpy in the stretch repos,
https://packages.debian.org/stretch/python3-numpy - but indeed, the
python3-opencv package doesn't arrive until buster.