Bossgaming099 / ctypes-opencv

Automatically exported from code.google.com/p/ctypes-opencv
0 stars 0 forks source link

Some histogram related fixes #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
The attached diff (against trunk @183) corrects a few issues with some
histogram related functions.

First, cvQueryHistValue_1D has an extra argument.

Second, the use of "hist.bins" in the cvQuery/GetHist* functions don't work
given the use of ByRefArg (through CvArr_r) and the declaration of CvArr. 
You get an OpenCV error about invalid array.

Although under the covers the bins member and the mat member of CvHistogram
both point to the same memory, taking the byref(bins) gives the address of
the pointer and not the value of the pointer.  Switching to using
"hist.bins.contents" cleans this up, but for that to avoid a ctypes error,
there needs to be a _fields_ member of CvArr, even if empty.

And third, even though the wrapper declaration permits None for the ranges
parameter to cvCreateHist, the ListPOINTER2 ctypes wrapper doesn't.  I
added a check for None there to permit it to pass through.

-- David

Original issue reported on code.google.com by db3l.em...@gmail.com on 9 Jan 2009 at 12:14

Attachments:

GoogleCodeExporter commented 8 years ago
Thank you for the patch. I was also intending to test these functions, but I 
haven't
got a proper chance. The package has been patched.

Original comment by pmtri80@gmail.com on 9 Jan 2009 at 4:54