PDA

View Full Version : opencv in cocoa applications




nacho4d
Jul 22, 2009, 12:40 PM
Hi

Hey I know there a way like this one:
http://stefanix.net/opencv-in-xcode
which is basically adding the opencv.Framework to the project.
Actually it works pretty well in command line applications.

But when doing the same in cocoa applications, functions like
cvNamedWindow(...);
cvShowImage(...);
does not seem to work very well (the window does not appear)

Does anyone know a way I can make it work?

using cocoa buttons + opencv windows for showing my results would be great I think.



damakable
Jul 22, 2009, 03:54 PM
I'm no expert on this but here's an open-source project that claims to integrate OpenCV with Core Video:

http://wiki.buzamoto.com/cv_opencv

I tried it and it seems to work well.

I suppose it's likely that commands to open windows etc. may not be cross-platform in OpenCV, but I can only speculate. CVOCV provides a window with three views and an interface to a "processor" class where you can put all your actual image-processing code. Should be suitable for a variety of things. :)

admanimal
Jul 23, 2009, 12:53 AM
using cocoa buttons + opencv windows for showing my results would be great I think.

This is most likely very difficult if not impossible using HighGUI, the part of opencv that is used for displaying windows. It does not provide any access to the OS's native window object, which you would need to add buttons, etc. to it. In fact the documentation specifically says to use your platform's native GUI environment if you want to do anything beyond displaying simple windows with images in them.

The easiest thing to do would be to use opencv for your image processing or whatever, and then convert the IplImages or CvMats that you get into NSImages for display in a normal Cocoa GUI.

damakable
Jul 23, 2009, 10:13 AM
The easiest thing to do would be to use opencv for your image processing or whatever, and then convert the IplImages or CvMats that you get into NSImages for display in a normal Cocoa GUI.

Thanks for clarifying that. That's exactly what CVOCV does, so you can look at that for a good example of how to convert images between the camera buffer, NSImages and IplImages, as well as how to integrate OpenCV with a GUI built in the Interface Builder.