great news with regards to OpenCV support...

Chris Colbert sccolbert at gmail.com
Thu Oct 8 15:42:15 EDT 2009


I just realized a fantastic byproduct of this: In OpenCV there is a
concept of Region-of-Interest, where, if defined, the function will
only operate on that section of the image. But because of numpy
handles views, there is no need to provide support for that, you just
pass in the view to the function as if it were a normal image.

Cheers!

Chris

On Thu, Oct 8, 2009 at 9:37 PM, Chris Colbert <sccolbert at gmail.com> wrote:
> At least I think it is great!
>
> I've managed (with the help of the community) to get ctypes function
> pointers to play nice with cython.
>
> I've also re-implented the IplImage struct in cython and figured out
> how to populate the struct with numpy stride information and the numpy
> data pointer.
>
> This all means that we now have the ability to to call OpenCV
> functions with plain numpy arrays as arguments, and the array gets
> modified in place!. And since i'm using ctypes to grab the function
> handle, OpenCV is not required to be on the users machine during build
> time, but if and when  they install the opencv lib, they automagically
> work!
>
> I've a got a working (albeit ugly) example attached. You'll obviously
> need opencv installed if you want to test it.
>
> Just use PIL to open any image on your system then dump it into a
> numpy array then call testnumpy.test(arr) on that array.
>
> Dump the array back into a PIL image and call show() on it. Voila!
> your image has been guassianed blurred courtesy of OpenCV.
>
>
> So, now that I have the logistics of this figured out and I know it
> actually works, looks like I'll have plenty to implement during the
> upcoming sprint.
>
> Cheers!
>
> Chris
>



More information about the scikit-image mailing list