1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
|
cvtColor(image,grayscale,CV_BGR2GRAY);
//goodfeatures(grayimage, output to store corners, quality factor, distance factor)
goodFeaturesToTrack(grayscale,corners,4,0.1,155); //good so far 0.1 and 150, 150 0.01
// Mark these corners on the original image
cornerSubPix(grayscale, corners, Size(11, 11), Size(-1, -1), TermCriteria(CV_TERMCRIT_EPS | CV_TERMCRIT_ITER, 30, 0.1));
if(corners.rows!=0)
{
for(int i=0;i<corners.rows;i++)
{
//draws circle on image, at centre at point, color, thickness, line type,
circle(image,corners.at<Point2f>(i),3,CV_RGB(255,0,0),1,8,0);
}
}
else
{
cout<<"No Corners Detected"<<endl;
}
|