Choose a Structuring Element
The leaf mask has small gaps near its outline.
Read the full lesson and open its transcript below. A narrated video will be added after production.
What you will learn
The leaf mask has small gaps near its outline.
A practical question
A leaf mask has a little gap at its edge and a narrow stem nearby. Before applying a morphology button, decide what neighborhood the operation will use. That neighborhood is called a structuring element. Its size and shape decide which features are considered small.
The useful idea
A small disk reaches around a pixel in many directions. A long horizontal element favors horizontal structures. Either could close a gap or change a stem, depending on the gap's orientation. The element is therefore part of the biological measurement, not a harmless software default.
Work through the example
Try a disk and a line on copies of the same mask. Show the gap and the thin stem at the same zoom. If one choice repairs the gap but removes or joins real structures, it doesn't meet our goal. Record pixel dimensions and, if we compare photographs with different scales, translate the chosen size into physical units. Choose the shape of the structuring element for the feature you need to preserve. A round neighborhood and a long horizontal one can treat the same thin bridge very differently. Draw a small mask with a gap and apply both choices by hand. Then try a second mask where the narrow structure is a real part of the object. The best element for closing one gap can destroy another legitimate feature, so evaluate both cases before committing. Now check the idea on a concrete example: Compare a small disk with a long horizontal element against the same gap. A possible trap is worth naming: The element's size and shape encode an assumption about features worth preserving. The answer follows from that evidence: A structuring element defines which neighboring pixels participate in morphology and at what scale.
Limits and next step
Keep the original mask beside every result. In the next lesson, we'll see exactly how two basic operations use that structuring element to shrink or grow a region.
Worked example
Compare a small disk with a long horizontal element against the same gap.
Quick check: test your understanding
Try it yourself: Consider this case: Compare a small disk with a long horizontal element against the same gap. Explain how you would check the result. In your answer, address this limitation: The element's size and shape encode an assumption about features worth preserving.
Check the reasoning
A structuring element defines which neighboring pixels participate in morphology and at what scale. The element's size and shape encode an assumption about features worth preserving.
What is the main idea behind choose a structuring element?
A structuring element defines which neighboring pixels participate in morphology and at what scale.
How is it used in the example?
Compare a small disk with a long horizontal element against the same gap.
What limitation should be checked?
The element's size and shape encode an assumption about features worth preserving.
Further reading
Digital Image Processing, 4th edition — Rafael C. Gonzalez and Richard E. Woods.
Original ToolsInVision teaching examples. Editorial approach · Suggest a correction
Accessible referenceLesson 57 transcript311 words · Narration ready for the upcoming videoOpen transcript
A leaf mask has a little gap at its edge and a narrow stem nearby. Before applying a morphology button, decide what neighborhood the operation will use. That neighborhood is called a structuring element. Its size and shape decide which features are considered small.
A small disk reaches around a pixel in many directions. A long horizontal element favors horizontal structures. Either could close a gap or change a stem, depending on the gap's orientation. The element is therefore part of the biological measurement, not a harmless software default.
Try a disk and a line on copies of the same mask. Show the gap and the thin stem at the same zoom. If one choice repairs the gap but removes or joins real structures, it doesn't meet our goal. Record pixel dimensions and, if we compare photographs with different scales, translate the chosen size into physical units. Choose the shape of the structuring element for the feature you need to preserve. A round neighborhood and a long horizontal one can treat the same thin bridge very differently. Draw a small mask with a gap and apply both choices by hand. Then try a second mask where the narrow structure is a real part of the object. The best element for closing one gap can destroy another legitimate feature, so evaluate both cases before committing. Now check the idea on a concrete example: Compare a small disk with a long horizontal element against the same gap. A possible trap is worth naming: The element's size and shape encode an assumption about features worth preserving. The answer follows from that evidence: A structuring element defines which neighboring pixels participate in morphology and at what scale.
Keep the original mask beside every result. In the next lesson, we'll see exactly how two basic operations use that structuring element to shrink or grow a region.