Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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;


}