Keywords: front-page

# Contours

[Laboratory]

For binary images, the difference between a dilated image and its original gives the external contour of the image. The structure element dictates the topology of the contour. The most widely used structure elements are the 3x3 `cross` to generate 4-connected contour, and a 3x3 `box` to generate 8-connected contour.

There are other contours that can be created, i.e., the difference between the original and the eroded image, and the difference between the dilated and eroded image.

Below is the original image and its contour taken as the subtraction between the original and the eroded image by a `cross`.

Original image

Original - Eroded

We can label the contour and take its image histogram to extract the perimeter related to each connected contour.

Labeled contour image

Perimeter for each connected contour

- Lab: Contours