In this recipe, you will learn how to apply the Hough transform for the detection of lines and circles. This is a helpful technique when you need to perform basic image analysis and find primitives in images.
Detecting lines and circles using the Hough transform
Getting ready
Before you proceed with this recipe, you need to install the OpenCV 3.x Python API package and the matplotlib package.
How to do it...
- Import the modules:
import cv2
import numpy as np
- Draw a test image:
img = np.zeros((500, 500), np.uint8)
cv2.circle(img, (200, 200), 50, 255, 3)
cv2.line(img, (100...