Despite what you might believe, X-Men aren’t the only ones who can perform morphology. It’s actually a mathematical operation for modifying and classifying objects seen in images. Image morphology, when used by a machine vision integrator, separates touching objects in images, removes noise, and classifies shapes.
There are several morphology algorithms that can be used to accomplish goals within a given machine vision application. Binary morphology is one form of this algorithm that assigns two possible values, 0 and 1 (commonly black (0) and white (1)). We can apply binary morphology to an image to change the values of individual pixels. The range of values we can change them too will fall between 0 and 1, making individual pixels closer to black (0) or white (1). After we apply the binary morphology function, a new image is produced based one the altered values.
But how do you know what to change the values to? That depends on what you want to achieve.
Erosion
Let’s say that a particular vision system needs to count the number of pills in a given space for a pharmaceutical company. The pills are not arranged in any particular order or pattern and many of them are touching. How is a vision system going to accurately count the number of pills? One way to increase the count accuracy is through the binary erosion morphology function.
The erosion operation looks at a cluster of pixels. White clusters of pixels are identified. Pixels on the edge of the white pixel cluster that touch darker pixels have their values reduced to black (0). Touching objects in a frame are separated after several iterations of erosion which essentially makes the examined objects smaller.
Dilation
The opposite is true with the dilation operation. As the erosion operation removes white pixels from an image, the dilation function adds white pixels to the edges of objects. Dilate filters aid in the removal of “image noise.”
Take for instance the following scenario. If a user wants to inspect debris inside a food jar before it is filled, a vision integrator might apply the dilate operation. If the amount of debris inside a jar reaches a certain size the system will discard the jar. For this application, the acceptable debris (image noise) needs to be reduced without completely removing larger debris.
A dilate operation accomplishes this objective by adding white pixels to the edges of images reducing image noise. As seen in the images below the dilate filter removes image noise at the bottom and sides of the jar while still detecting the larger debris (highlighted in red).
Erosion and dilation operations are commonly used in vision system applications but are not the only types of morphology. To talk with an experienced vision systems integrator contact EPIC Systems today!