I am trying to use the cvGoodFeatureToTrack function in Visual Studio 2010 with the image type as Mat. Most of the examples I have seen use the IplImage pointer.
Right now I have this:
int w, h; // video frame size
Mat grayFrame;
Mat eigImage;
Mat tempImage;
const int MAX_CORNERS = 10;
CvPoint2D32f corners[MAX_CORNERS] = {0};
int corner_count = MAX_CORNERS;
double quality_level = 0.1;
double min_distance = 10;
int eig_block_size = 3;
int use_harris = false;
w = CurrFrame.size().width;
h = CurrFrame.size().height;
cvtColor(CurrFrame, grayFrame, CV_BGR2GRAY);
cvGoodFeaturesToTrack(&grayFrame,
&eigImage,
&tempImage,
corners,
&corner_count,
quality_level,
min_distance,
NULL,
eig_block_size,
use_harris);
It compiles but gives me a memory access violation. Help!
As a starting point, if using C++ anyway (like your use of
cv::Matandcv::cvtColorsuggests), then why not use C++ interface for the rest, too?This would mean the use of
cv::goodFeaturesToTrackor acv::GoodFeaturesToTrackDetector, which are made to work oncv::Matand friends instead of making unneccessary casts fromcv::MattoIplImage*.