Hello,
I am trying to perform feature detection and matching between two captured frames taken from two webcams (the resulting images have a significant area of overlap, with a slight change in perspective). Everything compiles fine with no errors, however when the program hits "cv::FREAK extractor" an unhandled exception is flagged as shown in the first link.
http://i1276.photobucket.com/albums/y475/sesj13/Issue1_zpsf44aea88.jpg
Here is my code:
// First camera setup
CvCapture* capture0 = cvCreateCameraCapture(1);
cvSetCaptureProperty(capture0, CV_CAP_PROP_FRAME_WIDTH, WIDTH); // frame width
cvSetCaptureProperty(capture0, CV_CAP_PROP_FRAME_HEIGHT, HEIGHT); // frame height
if ( !cvQueryFrame(capture0) )
{
cout << endl << "-->> Camera capture failed, please check camera 1!" << endl << endl;
cvReleaseCapture( &capture0 );
exit(0);
}
else
cout << endl << "-->> Camera capture successful - Got camera 1!" << endl << endl;
IplImage* frameFromCamera0 = cvQueryFrame(capture0);
//===============================================================================
// Second camera setup
CvCapture* capture1 = cvCreateCameraCapture(2);
cvSetCaptureProperty(capture1, CV_CAP_PROP_FRAME_WIDTH, WIDTH); // frame width
cvSetCaptureProperty(capture1, CV_CAP_PROP_FRAME_HEIGHT, HEIGHT); // frame height
if ( !cvQueryFrame(capture1) )
{
cout << endl << "-->> Camera capture failed, please check camera 2!" << endl << endl;
cvReleaseCapture( &capture1 );
exit(0);
}
else
cout << endl << "-->> Camera capture successful - Got camera 2!" << endl << endl;
IplImage* frameFromCamera1 = cvQueryFrame(capture1);
//===============================================================================
//create Matrix to store image
Mat im_gray0, im_gray1;
frameFromCamera0 = cvQueryFrame(capture0); // capture a frame from camera 0
frameFromCamera1 = cvQueryFrame(capture1); // capture a frame from camera 1
Mat imgMat0(frameFromCamera0);
Mat imgMat1(frameFromCamera1);
cvtColor(imgMat0,im_gray0,CV_RGB2GRAY);
cvtColor(imgMat1,im_gray1,CV_RGB2GRAY);
vector<KeyPoint> keypointsA,keypointsB;
Mat descriptorsA,descriptorsB;
std::vector<DMatch> matches;
OrbFeatureDetector detector(400);
cv::FREAK extractor;
BruteForceMatcher<Hamming> matcher;
detector.detect(im_gray0,keypointsA);
detector.detect(im_gray1,keypointsB);
extractor.compute(im_gray0,keypointsA,descriptorsA);
extractor.compute(im_gray1,keypointsB,descriptorsB);
matcher.match(descriptorsA, descriptorsB, matches);
int nofmatches = 30;
nth_element(matches.begin(),matches.begin()+nofmatches,matches.end());
matches.erase(matches.begin()+nofmatches+1,matches.end());
Mat imgMatch;
drawMatches(imgMat0, keypointsA, imgMat1, keypointsB, matches, imgMatch);
imshow("matches", imgMatch);
waitKey(0);
return 0;
Something similar also occurs in a simple program such as that shown in these links: http://i1276.photobucket.com/albums/y475/sesj13/Issue2_zps80d1f5a3.jpg http://i1276.photobucket.com/albums/y475/sesj13/Issue3_zps7d727dd2.jpg
Any help would be really appreciated - it is driving me up the wall!
I am using Microsoft Visual Studio 2010 with Windows 7 64 bit. I believe I have all the necessary dependencies in place. If you need any more information let me know,
Cheers!