Steve Eddins has developed MATLAB and image processing capabilities for MathWorks since 1993. He also coaches development teams on designing programming interfaces for engineers and scientists. Steve coauthored Digital Image Processing Using MATLAB.
Today I want to show you a morphological operation called "opening by reconstruction."
The normal morphological opening is an erosion followed by a dilation. The erosion "shrinks" an image according to the shape
of the structuring element, removing objects that are smaller than the shape. Then the dilation step "regrows" the remaining
objects by the same shape.
Here's an example using a fragment of text from the book Digital Image Processing Using MATLAB.
Suppose we want to identify characters containing a tall vertical segment. We can do this by opening with a vertical structuring
se = strel(ones(51, 1));
bw2 = imerode(bw, se);
bw3 = imdilate(bw2, se);
Or you can do the opening in a single step by calling imopen:
bw3 = imopen(bw, se);
The dilation step in the opening operation restored the vertical strokes, but the other strokes of the characters are missing.
How can we get the entire characters containing vertical strokes?
The answer is to use morphological reconstruction. For binary images, reconstruction starts from a set of starting pixels
(or "seed" pixels) and then grows in flood-fill fashion to include complete connected components.
To get ready to use reconstruction, first define a "marker" image. This is the image containing the starting or seed locations.
For our text example, the marker image will the output of the erosion.
marker = imerode(bw, se);
Next, define mask image. The flood-filling will be constrained to spread only to foreground pixels in the mask image. We
can use the original text image as our reconstruction mask.
Performing morphological reconstruction, using the eroded image as the marker and the original image as the mask, is called
"opening by reconstruction."
Do you have other uses for morphological reconstruction in your own applications? Tell us about it: Click on the "Comment"
要发表评论，请点击 此处 登录到您的 MathWorks 帐户或创建一个新帐户。