Ask Your Question

Revision history [back]

sift detectandcompute get different size keypoint and descriptor

Ptr<SIFT> detector = xfeatures2d::SIFT::create();

vector<cv::KeyPoint> key_points_1, key_points_2;

Mat dstImage1, dstImage2;
detector->detectAndCompute(srcImage1, Mat(), key_points_1, dstImage1);

I want to extract a image sift feature; but when i run code above, there is a strange situation; key_points_1.size() != dstImage1.size(); as we all kown, descriptor will create and compute by keypoints, so they should have same size. one time i have experience this situation, so i rebuild opencv and opencv_contribute, code will be ok; but after a few days, this bug show again, i am confused. detail: vector<keypoint>& keypoint; before run out of function detectAndCompute till '}', keypoint.size() = descriptor.size, it is ok; but when it go back the main function, keypoint.size() have changed.

WIN7 Visual studio 2017 opencv 3.4.1 opencv_contribute 3.4.1