Get the SIFT descriptor for specified point using

2019-08-04 05:41发布

问题:

I want get the SIFT feature for specified points. These points is gotten by hand not by KeyPoint Detector. My question is: I only know the position of the points but have no idea about the size and angle value. How should I set this value?

Here is my code:

int main()
{
    Mat img_object = imread("img/test.jpg", 0);

    SiftDescriptorExtractor extractor;
    Mat descriptors;
    std::vector<KeyPoint> keypoints;

    // set keypoint position and size: should I set 
    // size parameter to 32 for 32x32 patch?
    KeyPoint kp(50, 60, 32);
    keypoints.push_back(kp);

    extractor.compute( img_object, keypoints, descriptors );

    return 0;
}

Should I set the size param of KeyPoint to 32 for 32x32 patch. Is this implementation reasonable?

回答1:

Usually, keypoint detectors work on a local neighbourhood around a point. This is the size field of OpenCV's KeyPoint class. The angle field is the dominant orientation of the keypoint (this could be set to -1, note).

OpenCV KeyPoint class

Another reference here.