Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If found that the morphological reconstructions are not that hard to implement if you read the following document: Morphological Image Processing

This one is also nice because it has some example images of what to expect Morphology

The clue is that the reconstructions' main ingredients are geodesic erosion and dilation. These are basically masked erosion and dilation by using a min operator. Code snippet:

Image<Gray, byte> m = image.Dilate(size, shape); // normal dilation
Image<Gray, byte> geoDilate = m.Min(mask); // masking operation

Same for erosion but using a max operator. Now dilation by reconstruction is keep on geodesically dilating until the image doesn't change anymore.

Image<Gray, byte> m0;
Image<Gray, byte> m1 = image;
do
{
    m0 = m1.Clone();
    m1 = m0.GeoDilate(mask, size, shape);
} 
while (!m1.Equals(m0));
Image<Gray, byte> DilateRec = m1;

Finally, opening by reconstruction is first erode the image. The eroded image is then dilated with the original image as mask:

Image<Gray, byte> m = image.Erode(size, shape);
Image<Gray, byte> openRec = m.DilateRec(image, size, shape);

Closing by reconstruction is the other way around.