{
Mat mat_image_left=Mat(i_left, false);
Mat mat_image_right=Mat(i_right, false);
Cv:: siftfeaturedetector * p detector = new cv:: siftfeaturedetector;
P detector-> Detect(mat_image_left, left _ key _ point);
P detector-> Detect(mat_image_right, right _ key _ point);
Mat left_image_descriptors, right _ image _ descriptors
Cv:: siftdescriptorextractor * descriptor _ extractor = new cv:: siftdescriptorextractor;
Descriptor _ extractor-> compute (mat _ image _ left, left_key_point, left _ image _ des
Descriptor _ extractor-> compute (mat _ image _ right, right_key_point, right _ image _
Mat result_l, result _ r;;
DrawKeypoints(mat_image_left, left_key_point, result_l, scalar:: all (-/kloc
DrawKeypoints(mat_image_right, right_key_point, result_r, scalar:: all (-/kll
//imshow ("result _ of _ left _ detector _ sift", result _ l);
//imshow ("result _ of _ right _ detector _ sift", result _ r);
Mat result _ of _ sift _ match
Brute force matcher & ltl2 & ltfloat & gt> matcher
Matcher.match (left _ image _ descriptors, right_image_descriptors, result _ of _ point _
DrawMatches(mat_image_left, left_key_point, mat_image_right, right_key_point
Imshow("matches_of_sift ",result _ of _ sift _ match);
Imwrite("matches_of_sift.jpg ",result _ of _ sift _ match);
}
Void main ()
{
Ip image * n _ left _ image = cv loadimage ("d: \ \ lena.jpg");
Ipimage * n _ right _ image = cv loadimage ("d: \ \ Lena _ r.jpg");
Sift _ detector _ and _ descriptors (n _ left _ image, n _ right _ image);
Cvwaitkey (0);
}
이것은 SIFT 매칭을 구현하는 코드입니다. 그래서 왜 drawMatchesKnn () 을 사용하는지 이해할 수 있습니다. 각 버전은 버전에 관계없이 sift 를 지원합니다.