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
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…