I’ll start this supplementary material with a quote:

“Whenever you are working on a new problem, consider how contours and the associated properties of contours can help you solve the problem. More often than not, a clever use of contours can save you a lot of time and avoid more advanced (and tedious) techniques.” — Adrian Rosebrock, PyImageSearch Gurus course, Contours lesson.

Now, don’t get me wrong — contours will not help you detect objects in all situations. But in certain circumstances, contours are all you need. I’ve included examples of such situations below.

Examples of contours in a processing pipeline

To start, let’s try to find targets in drone/quadcopter video streams:

drone_acquired_02

Using edge detection and contour properties, we can locate the targets in the video.

Contours also allow us to measure the size of objects in an image:

size_of_objects_example_02

And then detect specific shapes in an image:

shape_detection_results

One we have applied image processing operations, we can use contours to extract the Machine Readable Zones (MRZ) from passport images:

mrz_output_04

A similar technique can be used to localize barcodes in images as well:

barcode_gradient_and_detection

Once of my favorite applications of contours is leveraging them to build a document scanner:

receipt-scanned

Of course, contours don’t do all the work. Most of these examples also rely on other image preprocessing functions such as blurring/smoothing, edge detection, and thresholding prior to applying contour extraction to find the actual objects in images.

However, that said, without contours we would not be able to extract the detected regions in an image.

Just as preprocessing functions play a critical role in detecting an object, contour extraction is crucial in the actual extraction of the object.

Lesson Content
0% Complete
0/18 Steps