Using OpenCV functions
OpenCV is a really huge library with hundreds of functions, including optical flow computing, feature detection and matching, and machine learning. Most of these functions are currently not wrapped in the addon ofxOpenCv. You can use these capabilities by calling the OpenCV functions directly, by performing the following steps:
First, in the
testApp.h
file, add the following line after the line#include "ofxOpenCv.h"
, which instructs the compiler to use the OpenCV's namespace:using namespace cv;
Now you can declare OpenCV's images, which are objects of the type
Mat
:Mat imageCV;
For converting the
ofxCv
imageimage
intoimageCV
, call the following function:imageCV = Mat( image.getCvImage() );
Note, this is fast operation that does not involve copying of data.
imageCV
andimage
will share the same memory region with pixel values. So, we would suggest only usingimageCV
for reading and not for changing.Tip
We do not suggest the use of the
setNativeScale()
function for images...