goodfeaturestotrack corner vector size

asked 2016-03-07 09:16:04 -0600

ThomCastel gravatar image

Hi, I'm having trouble with goodFeatureToTrack using OpenCV 3.0 in C++ with Qt and MSVC2010.

When I run the following code, the size of corners is 4,289,272,441 (image is ok and displays).

#include <iostream>
#include "opencv.hpp"
#include "world.hpp"
#include <vector>

using namespace cv;
using namespace std;

int main()
{
    Mat frame = imread("lena_color.tif");
    std::vector<cv::Point2f> corners;
    //Mat corners;
    cvtColor(frame,frame,COLOR_RGB2GRAY);

    goodFeaturesToTrack(frame,corners,10,0.001,10);
    cout << corners.size() << endl;

    imshow("Img",frame);
    waitKey();

    return 0;
}

I know corners is not a Mat but when I use it as such I get a size of [1x10], which makes sense.

Has anyone run into this behavior and knows how to explain and fix it?

edit retag flag offensive close merge delete

Comments

might be a linker problem. please check extra carefully, if you're linking to the correct libs, debug version in debug build, x86 vs x64, multithreaded-dll-c-runtime, etc.

berak gravatar imageberak ( 2016-03-07 09:28:39 -0600 )edit

Thanks for your answer.

It seems to be fine, I successfully tested a bunch of other function like calcOpticalFlowFarneback. But the same code does work fine using the OpenCV 2.4.9 I compiled a while back...

Any other idea?

ThomCastel gravatar imageThomCastel ( 2016-03-07 09:57:00 -0600 )edit