I have this function in C++ using OpenCV:
vector<KeyPoint> test(Mat img)
{
int minHessian = 400;
SurfFeatureDetector detector( minHessian );
vector<KeyPoint> vKeypoints;
detector.detect( img, vKeypoints );
return vKeypoints;
}
When I call this function in my main-method everything works fine.
int main( int, char** argv )
{
// path to a image-file
char* input = "image.jpg";
// read image into Mat img
Mat img = imread( input, CV_LOAD_IMAGE_GRAYSCALE );
// call function test
test(img);
waitKey(0);
return 0;
}
But as soon as I'm calling this method twice...
int main( int, char** argv )
{
// path to a image-file
char* input = "image.jpg";
// read image into Mat img
Mat img = imread( input, CV_LOAD_IMAGE_GRAYSCALE );
// call function test
test(img);
test(img); // <-- !!! second call
waitKey(0);
return 0;
}
...I get the following error:
Can anyone tell me where my mistake is and how I could fix this? I need to call this function twice with two different images, but every time I do this I get this error.
I'm using Visual Studio 2012.