Quantcast
Channel: OpenCV Q&A Forum - RSS feed
Viewing all articles
Browse latest Browse all 41027

Feature Detector SURF

$
0
0
Hello, I am using the SURF feature detection on my image, and am not finding success in getting it to find features be accurate, the image is only masked by the objects contour in the key point detection. Is there anything I could do to the image itself to help SURF getting better accurate feature detection? I had also tried not masking the object, and also tried equalizing the image, but none of it gave me accurate feature detection. None of the key points are are correct at all. Thank you for any suggestions and help! Update: Okay I tried another image, and the feature detection works pretty good, (updated as third picture), is there any reason on why this is happening in the first picture? Mat imsource2; Mat imquery2; imsource_crop.copyTo(imsource2); imquery.copyTo(imquery2); imshow("test", imsource2); imshow("test2", imquery2); Ptr detector = SURF::create(); detector->setHessianThreshold(threshHaus); vector keypoints_1, keypoints_2; Mat descriptors_1, descriptors_2; detector->detect(imsource2, keypoints_1, imsource_mask); detector->detect(imquery2, keypoints_2, imquery_mask); detector->compute(imsource2, keypoints_1, descriptors_1); detector->compute(imquery2, keypoints_2, descriptors_2); FlannBasedMatcher matcher; std::vector< DMatch > matches; matcher.match(descriptors_1, descriptors_2, matches); double max_dist = 0; double min_dist = minHaus / 1000; //-- Quick calculation of max and min distances between keypoints for (int i = 0; i < descriptors_1.rows; i++) { double dist = matches[i].distance; if (dist < min_dist) min_dist = dist; if (dist > max_dist) max_dist = dist; } printf("-- Max dist : %f \n", max_dist); printf("-- Min dist : %f \n", min_dist); //-- Draw only "good" matches (i.e. whose distance is less than 3*min_dist ) vector< DMatch > good_matches; for (int i = 0; i < descriptors_1.rows; i++) { if (matches[i].distance < 0.1) { good_matches.push_back(matches[i]); } } Mat img_matches; drawMatches(imsource2, keypoints_1, imquery2, keypoints_2, good_matches, img_matches, Scalar::all(-1), Scalar::all(-1), vector(), DrawMatchesFlags::NOT_DRAW_SINGLE_POINTS); cout << " Source Keypoint number: " << keypoints_1.size() << endl; cout << " Query Keypoint number: " << keypoints_2.size() << endl; cout << "Number of good matches: " << good_matches.size() << endl; //-- Show detected matches imshow("Feature", img_matches); ![image description](/upfiles/1445153495207599.png) ![image description](/upfiles/14451534748869323.png) ![image description](/upfiles/14451544931886527.png)

Viewing all articles
Browse latest Browse all 41027

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>