I am trying to use the goodFeatureToTrack() function with opencv 2.4.3 on an gray image of lena…however I always get a zero size of the vector storing the features as cv::Point2f…I have tried using a zero mask also but in that case the application hangs up..I tried playing with the quality level value from 0.01 to 0.001. However still the size of the vector is zero..any idea?…following is my code..
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/video/tracking.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <vector>
using namespace cv;
using namespace std;
int main()
{
Mat frameROI;
frameROI = imread("C:\\lena.jpg");
std::vector<cv::Point2f> corners;
cvtColor(frameROI,frameROI,CV_RGB2GRAY);
//Mat mask(frameROI.size(), CV_8UC1);
//mask.setTo(Scalar::all(0));
//goodFeaturesToTrack(frameROI,corners,10,0.001,10,mask,3,false,0.04);
goodFeaturesToTrack(frameROI,corners,10,0.001,10);//AFTER EDIT
cout<<"SIZE OF FEATURE VECTOR = "<<corners.size()<<endl;
imshow("VIDEO ROI",frameROI);
waitKey();
return 0;
}
OUTPUT:
SIZE OF FEATURE VECTOR = 0
EDIT: afte Bob’s suggestion I omitted the line for mask and modified the function..but now the application hangs up after the goodFeaturesToTrack function is invoked…Any idea?
Solved the problem just now….instead of using the pre build libs n dlls….build it with MSVC2008 and now its working fine…the same points indicated by Bob are detected..