我是OpenCV的新手,我试图使用SIFT从灰度图像中提取关键点。但是未能成功编译代码。互联网上对于SIFT的使用似乎没有明确的帮助。请帮助。谢谢。

while(true)
{
    Mat myFrame;
    Mat grayFrame;
    capture.read(myFrame);
    cvtColor(myFrame, grayFrame, CV_BGR2GRAY);

    vector<Vec2f> outputArray;
    vector<KeyPoint> keypoint;
    Feature2D EXTRACTOR;
    Mat descriptors;
    EXTRACTOR.detectAndCompute(grayFrame, outputArray, keypoint, descriptors);

}

最佳答案

    vector<KeyPoint> keyVector;
    Mat outputDiscriptor;
    Ptr<SIFT> detector = SIFT::create();
    detector->detect(grayFrame, keyVector);
    //here grayFrame is the gray scale of the original frame/image

    if you want to get the descriptors of the key points use the
    detector->compute(grayFrame, keyVector)

10-08 05:08