src,
cv::Point(cvRound(circles[i][0]), cvRound(circles[i][1])),
cvRound(circles[i][2]),
cv::Scalar(0,0,255),
2,
cv::AA
);
}
cv::imshow( "Hough Circles", src);
cv::waitKey(0);
return 0;
}
It is worth reflecting momentarily on the fact that, no matter what tricks we employ, there is no getting
around the requirement that circles be described by three degrees of freedom (𝑥, 𝑦, and 𝑟), in contrast to
only two degrees of freedom (𝜌 and 𝜃) for lines. The result will invariably be that any circle-finding
algorithm requires more memory and computation time than the line-finding algorithms we looked at
previously. With this in mind, it’s a good idea to bound the radius parameter as tightly as circumstances
allow in order to keep these costs under control.
32
The Hough transform was extended to arbitrary shapes
by Ballard in 1981 [Ballard81] basically by considering objects as collections of gradient edges.
Distance Transformation
The distance transform of an image is defined as a new image in which every output pixel is set to a value
equal to the distance to the nearest zero pixel in the input image—according to some specific distance
metric. It should be immediately obvious that the typical input to a distance transform should be some kind
of edge image. In most applications the input to the distance transform ...