OpenCVΒΆ
Reference
A common pipeline for feature detection:
HoughCircles pipeline:
Convert image to grayscale
Get edge image with Canny
Pass edge image to
cv2.HoughCircles
HoughLines pipeline:
(Optional) Use
cv2.inRangefor color masksGet edge image with Canny
Pass edge image to
cv2.HoughLines
When to smooth: Apply Gaussian smoothing before edge detection (before Canny), regardless of whether visible noise is present. Smoothing suppresses high-frequency pixel variations that produce spurious edges. Apply smoothing after grayscale conversion but before Canny.
smoothed = cv2.GaussianBlur(gray, (5, 5), 0)
edges = cv2.Canny(smoothed, threshold1, threshold2)