converting to&from OpenCV cv::Mat, NSImage
===


There's an article describing how to do this  <a href="http://stackoverflow.com/questions/8563356/nsimage-to-cvmat-and-vice-versa">here</a>, that seems to have worked for other people but it does not compile for me.

Here's a copy of the .h file that was used:


    //
    //  NSImage+OpenCV.h
    //
    
    #import <AppKit/AppKit.h>
    
    @interface NSImage (NSImage_OpenCV) {

    }
    
    +(NSImage*)imageWithCVMat:(const cv::Mat&)cvMat;
    -(id)initWithCVMat:(const cv::Mat&)cvMat;
    
    @property(nonatomic, readonly) cv::Mat CVMat;
    @property(nonatomic, readonly) cv::Mat CVGrayscaleMat;
    
    @end

I'm on Xcode 4.4, using openCV 2.4.2.  The compiler errors I'm getting for the header file are 4x of the following:

`Semantic issue: Use of undeclared identifier 'cv'`

This error seems rather obvious...the header file does not define what a cv::Mat is.
So I took a guess from looking at the OpenCV 2.4 tutorial, that I needed to add 

`#include <opencv2/core/core.hpp>`

This generated 20 other errors, where the compiler was complaining about the core.hpp file.
The first of which says:

`Semantic issue: Non-const static data member must be initialized out of line`

So my question is what am I doing wrong?  How do I get this code to work?
