Search code examples
opencvimage-processingedge-detectioncanny-operator

Is there any computational benefit to using Canny edge detection before circle Hough Transform?


I was looking at how to detect billiard balls on a pool table, when I stumbled upon this post.

The OP states that he employs the Canny edge detection algorithm on the hue channel of his video feed before applying the circle Hough transform. Is there any computational benefit to performing the edge detection before the circle detection, or should I immediately perform circle detection on the video feed?

Thanks in advance!


Solution

  • The OpenCV APIs that do Hough-anything already do a Canny internally. Applying a Canny explicitly before calling an OpenCV Hough* function would be a mistake (unless there's one that doesn't do a Canny implicitly...). Personally I hate this and would much rather be able to choose what's happening, say if I have an edge image already.

    In general, you could do a dense Hough or a sparse Hough, and you could have weighted or unweighted votes.

    • Weighted: have each pixel vote according to its intensity (carries information)

    • Unweighted: each pixel gets 1.0 vote

    • Dense: all pixels vote

    • Sparse: only some pixels vote (important ones, not random ones)

    Dense+unweighted is silly because all pixels of the entire image vote the same. The accumulator array would look flat.

    Dense is expensive, so people use sparse voting. Unweighted is also simpler, so people do that. Canny is a way to binarize a picture and receive a very small set of pixels.