Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I got the same error due to the fact that my mex files were missing. In order to get the mex files you need to compile the latest OpenCV from source. Make sure CMake does not give any errors. Then I compiled things with Visual Studio. This did not work due to Ptr_DenseOpticalFlow not being defined. Thus I had to implement a fix found here: https://github.com/Itseez/opencv/pull/2783.

Basically I had to add the following lines to 'OpenCV-build'\modules\matlab\src:

-53  #include <opencv2/video/tracking.hpp>
...
-80  typedef cv::Ptr<DenseOpticalFlow> Ptr_DenseOpticalFlow;
...
-458 // ---------------------------   Ptr_DenseOpticalFlow   -------------------
-459 Bridge& operator=(const Ptr_DenseOpticalFlow& ) { return *this; }
-460 Ptr_DenseOpticalFlow toPtrDenseOpticalFlow() { return Ptr_DenseOpticalFlow(); }
-461 operator Ptr_DenseOpticalFlow() { return toPtrDenseOpticalFlow(); }

Then I could compile the opencv_matlab module.

Note that this compilation took a long time to complete so be patient!

I got the same error due to the fact that my mex files were missing. In order to get the mex files you need to compile the latest OpenCV from source. Make sure CMake does not give any errors. Then I compiled things with Visual Studio. This did not work due to Ptr_DenseOpticalFlow not being defined. Thus I had to implement a fix found here: https://github.com/Itseez/opencv/pull/2783.

Basically I had to add the following lines to 'OpenCV-build'\modules\matlab\src:

-53  #include <opencv2/video/tracking.hpp>
...
-80  typedef cv::Ptr<DenseOpticalFlow> Ptr_DenseOpticalFlow;
...
-458 // ---------------------------   Ptr_DenseOpticalFlow   -------------------
-459 Bridge& operator=(const Ptr_DenseOpticalFlow& ) { return *this; }
-460 Ptr_DenseOpticalFlow toPtrDenseOpticalFlow() { return Ptr_DenseOpticalFlow(); }
-461 operator Ptr_DenseOpticalFlow() { return toPtrDenseOpticalFlow(); }

Then I could compile the opencv_matlab module.

Note that this compilation took a long time to complete so be patient!

If all fails you could also try using pre-compiled mex files, found at the end of this post: http://seevisionc.blogspot.nl/2014/03/compiling-opencv-30-with-matlab-support.html