opencv in cocoa applications

Discussion in 'Mac Programming' started by nacho4d, Jul 22, 2009.

  1. nacho4d macrumors newbie

    Jul 13, 2008

    Hey I know there a way like this one:
    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
    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.
  2. damakable macrumors newbie

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

    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. :)
  3. admanimal macrumors 68040

    Apr 22, 2005
    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.
  4. damakable macrumors newbie

    Jul 22, 2009
    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.

Share This Page