TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial…

Follow publication

Photo by CDC on Unsplash

Member-only story

Morphological Operations for Image Preprocessing in OpenCV, in Detail

Erosion, dilation, opening, closing, morphological gradient, tophat / whitehat, and blackhat explained with examples

Rashida Nasrin Sucky
TDS Archive
Published in
8 min readDec 27, 2022

--

In my last article, I wrote about some basic image processing in OpenCV. Today, we will advance a little bit and work on the morphological operations which are commonly used in image processing. Morphological operations are used to extract the region, edges, shapes, etc.

What are Morphological Operations?

Morphological operations are performed on binary images. Binary images may contain a lot of imperfections. Especially the binary image that is produced by some simple thresholding operations (if you are not familiar with thresholding, don’t worry about it now) may contain a lot of noise and distortions. Different morphological operations are available in the OpenCV library to handle those noises and imperfections.

Morphological operations generate images of the same shape as the original images. Morphological operations apply a structuring element to the input image. The structuring element can be of any shape. In all the morphological operations we will work on today, each pixel of the input image is compared with the neighboring pixels…

--

--

TDS Archive
TDS Archive

Published in TDS Archive

An archive of data science, data analytics, data engineering, machine learning, and artificial intelligence writing from the former Towards Data Science Medium publication.

Rashida Nasrin Sucky
Rashida Nasrin Sucky

Written by Rashida Nasrin Sucky

MS in Applied Data Analytics from Boston University. Read my blog: https://regenerativetoday.com/

Responses (2)

Write a response