Including ofxCv... Files


I’m trying to include the openCV/ofxCv libraries into my of project, however I’m having some difficulty. Could someone outline the including process? I’ve tried linking headers, adding existing files but with no luck.

I started the project from an _EmptySample project.

I am developing on XCode 3.1.2.

Any help would be greatly appreciated.


You basically just drag the ofxOpenCv folder into your xcode project. This should do the trick. Since I almost never do this I hope I am not forgetting something.

Alternatively you can start from an ofxOpenCv sample project which comes with the FAT download.

If things still don’t work places to look are:

  • project header search path
  • project library search path
  • in your target
  • compile step includes all the ofxOpenCv cpp files
  • link step includes openCv static library

You also might want to send us the specific error message you are getting :wink:

Thanks Stefan,

I’ve added the files into the addons folder inthe project and changed the header/lib search paths accordingly, too. The problem I get is the following:

error: cannot declare field ‘testApp::cvImage’ to be of abstract type ‘ofxCvImage’

And the line its treturning as an error is:

ofxCvImage img;

Thanks for your help,

With this error the compiler tells you that you cannot actually instance ofxCvImage. This is because it is an abstract class solely used as a base class.

Try using ofxCvGrayscaleImage or if you need a color type ofxCvColorImage. You will find out that these types inherit all the functionality from ofxCvImage.


1 Like


Thank you very much. I had misread ofxCvColourImage as ofxCvImage. If its any use to people, after I made amends, I got an error stating that:

“error: field `ofxCvColorImage’ has incomplete type”

Just make sure that #define OF_ADDON_USING_OPENCV is defined before ofAddons.h is added!!

Thanks Stefan…appreciate it!!