Detecting shapes

The detection of shapes with the Hough transform is limited to circles; however, we already implicitly explored detecting shapes of any kind, specifically when we talked about approxPolyDP. This function allows the approximation of polygons, so if your image contains polygons, they will be quite accurately detected, combining the usage of cv2.findContours and cv2.approxPolyDP.

Get Learning OpenCV 3 Computer Vision with Python - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.