1
我试图在2张图片上找到匹配的兴趣点。这个项目的最后是建立全景。OpenCV drawMatches什么也不做
我有这样的代码
SIFT detector(0);
src1 = imread(folder + inputName1 , 1);
cvtColor(src1, src1_gray, CV_BGR2GRAY);
// Detect first image
vector<KeyPoint> keypoints1;
detector.detect(src1_gray, keypoints1);
//Draw keypoints back to source image
drawKeypoints(src1,keypoints1,src1,Scalar::all(-1), 1);
imwrite(folder + outputName1,src1);
src2 = imread(folder + inputName2 , 1);
cvtColor(src2, src2_gray, CV_BGR2GRAY);
// Detect second image
vector<KeyPoint> keypoints2;
detector.detect(src2_gray, keypoints2);
//Draw keypoints back to source image
drawKeypoints(src2,keypoints2,src2,Scalar::all(-1), 1);
imwrite(folder + outputName2,src2);
vector<DMatch> matches;
Mat output;
drawMatches(src1,keypoints1,src2,keypoints2,matches,output);
imwrite(folder + "matches.jpg",output);
但在最终图像matches.jpg
,显示所有点和矢量matches
是空的。 我做错了什么?我想,只有匹配点将在最终图像中,并且在向量matches
中找到坐标来绘制点之间的线条。
或者我应该使用RANSAC来查找匹配点吗?
谢谢,这真的有帮助。但现在,我有很多线路。问题是,这也是坏点,不合适的点。我需要在它之前运行RANSAC,或者有人认为我做错了?谢谢 – Arxeiss 2014-08-27 16:34:36