如何使用goodFeaturesToTrack返回检测矩阵角

时间:2011-12-15 13:53:19

标签: opencv

如何编写一个命令来返回使用goodFeaturesToTrack检测到的矩阵角?

goodFeaturesToTrack(gray_image, corners, maxCorners, 
          qualityLevel, minDistance,temp_image, 2, true, 0.04);

Mat harris;
harris = original_image.clone();

for (unsigned int i=0; i corners.size(); i++)
{
    circle(harris, corners[i], 3, Scalar(0, 255, 0),-1,8,0);
    cout<<"Corners Vector: " << WHAT TO WRITE HERE? << endl;
}

1 个答案:

答案 0 :(得分:0)

goodFeaturesToTrack会返回vector<Point2f>类型的角点列表。因此,要打印角点,您可以执行以下操作:

cout << "Corner Point [" << i << "]: " << endl;
cout << "x = " << corners[i].x << endl;
cout << "y = " << corners[i].y << endl;

另外,请查看lkdemo.cppgoodFeaturesToTrack_Demo.cpp了解更多使用示例。