Ask Your Question
0

opencv 3, goodFeaturesToTrack, The function/feature is not implemented () in detectAndCompute

asked 2018-05-22 15:37:56 -0500

H M gravatar image

In my code half the code is working just fine when i use detector->detect(image, keypoints); but when I use detector->compute(image, keypoints, descriptorsLeft); it shows the error message.

How half the code is working just fine and half not. Below is my full code:

#include <iostream>
#include <stdio.h>
#include "opencv2/core.hpp"
#include "opencv2/features2d.hpp"
#include "opencv2/xfeatures2d.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/calib3d.hpp"
#include "opencv2/core/affine.hpp"

using namespace cv;
using namespace cv::xfeatures2d;


int main()
{
    //Loading the stereo images
    Mat image = imread("left.jpg", CV_LOAD_IMAGE_COLOR);

    //checking if image file succesfully opened 
    if (!image.data)
    {
        std::cout << " --(!) Error reading image " << std::endl; return -1;
    }


    //creating goodFeaturesToTrack(GFTT) class object
    cv::Ptr <cv::GFTTDetector> detector = cv::GFTTDetector::create(
                                500, // maximum number of keypoints
                                0.01, // quality level
                                20); //minimum allowed distance;

    std::vector<KeyPoint> keypoints;        //vectors storing keypoints 

    detector->detect(image, keypoints);

    Mat output;
    drawKeypoints(image, keypoints, output, Scalar::all(-1),
        DrawMatchesFlags::DEFAULT);

    namedWindow("image ", WINDOW_FREERATIO);
    imshow("image ", output);

    //::::::::::::::::::::::::::::::::
    //Step 2: Descriptors of keypoints
    Mat descriptorsLeft;

    detector->compute(image, keypoints, descriptorsLeft);
    //detector->compute(rightImage, keypointsRight, descriptorsRight);

    std::cout << "descriptor matrix size: " <<descriptorsLeft.rows << " by " << descriptorsLeft.cols << std::endl;




    waitKey(0);
    //system("pause");

    return 0;


}
edit retag flag offensive close merge delete

Comments

1

It is normal, GFTT is only a keypoint detector. More information: Good Features to Track, Jianbo Shi and Carlo Tomasi

Eduardo gravatar imageEduardo ( 2018-05-22 16:51:51 -0500 )edit

you will need something like ORB or BRISK to compute features for your GFFT keypoints.

berak gravatar imageberak ( 2018-05-24 01:09:28 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-05-26 12:17:37 -0500

H M gravatar image

Thank you Eduardo and Berak for your comments. Its now clear to me. Will try ORB or BRISK.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-05-22 15:37:56 -0500

Seen: 616 times

Last updated: May 22 '18