kyamagu / mexopencv

Collection and a development kit of matlab mex functions for OpenCV library
http://kyamagu.github.io/mexopencv
Other
659 stars 318 forks source link

maybe bug about the queryIdx and trainIdx #454

Open hwliu1997 opened 5 years ago

hwliu1997 commented 5 years ago

`detector = cv.SIFT('ConstrastThreshold',0.04,'EdgeThreshold',10); [keypoints1, descriptors1] = detector.detectAndCompute(im1g); [keypoints2, descriptors2] = detector.detectAndCompute(im2g);

matcher = cv.DescriptorMatcher('BruteForce'); matches = matcher.knnMatch(descriptors1,descriptors2,2); Goodmatches = []; for i = 1:length(matches) tmp = matches{i}; if (tmp(1).distance < 0.6*tmp(2).distance) Goodmatches = [Goodmatches;tmp(1)]; end end ` when I do matches,in fact,I found that the two points below do not match : keypoints1(Goodmatches(i).queryIdx).pt; keypoints2(Goodmatches(i).trainIdx).pt; however,these two below match : keypoints1(Goodmatches(i).queryIdx+1).pt; keypoints2(Goodmatches(i).trainIdx+1).pt;