← Image Processing for EveryoneToolsInVisionLearning Center
Segmentation Methods · Lesson 64

Separate Touching Regions with Watersheds

Two touching stickers appear as one connected patch.

Read the full lesson and open its transcript below. A narrated video will be added after production.

Lesson overview

What you will learn

Two touching stickers appear as one connected patch.

  1. A practical question
  2. The useful idea
  3. Work through the example
  4. Limits and next step
01

A practical question

Two stickers touch on a carton, and our binary mask treats them as one object. We know roughly where the middle of each sticker is. A watershed approach can use those two interior markers to assign the touching area to separate regions.

02

The useful idea

Imagine a surface based on an image gradient or on distance from the mask boundary. The markers begin in regions we trust. As their regions expand across that surface, a dividing boundary forms where their influence meets. The chosen surface and markers decide the result; simply running the algorithm without good markers often creates too many fragments.

03

Work through the example

Put one marker inside each sticker and compare the proposed separation with the original carton. Does the boundary cut through printed ink? Is one marker too close to a noisy edge? Try a difficult pair with uneven lighting before settling on settings. Two stickers touching in a mask may look like one region. Put a marker inside each sticker and use a watershed method to seek a dividing line. If the markers are misplaced, the algorithm can split one sticker or merge both. Examine the boundary against the actual image edge and compare counts before and after. Treat the result as a hypothesis about separation, especially where glare hides the true contact line. Use this case to test your understanding: Put one marker inside each sticker and inspect the dividing boundary. Here is the limitation to watch for: Overmany or misplaced markers can split one object into several pieces. This supports a careful conclusion: Watershed-style separation uses markers and a topographic image to assign touching regions. Two touching stickers need separate markers before the watershed step. A misplaced marker can create a border inside one sticker, so examine the original image where the separation was drawn.

04

Limits and next step

Keep the markers, surface, and final label map. Once objects are separated, we can give each connected region an identity and measure it. That's our next step.

Worked example

Put one marker inside each sticker and inspect the dividing boundary.

Knowledge check

Quick check: test your understanding

Try it yourself: Consider this case: Put one marker inside each sticker and inspect the dividing boundary. Explain how you would check the result. In your answer, address this limitation: Overmany or misplaced markers can split one object into several pieces.

Check the reasoning

Watershed-style separation uses markers and a topographic image to assign touching regions. Overmany or misplaced markers can split one object into several pieces.

What is the main idea behind separate touching regions with watersheds?

Watershed-style separation uses markers and a topographic image to assign touching regions.

How is it used in the example?

Put one marker inside each sticker and inspect the dividing boundary.

What limitation should be checked?

Overmany or misplaced markers can split one object into several pieces.

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 64 transcript322 words · Narration ready for the upcoming videoOpen transcript

Two stickers touch on a carton, and our binary mask treats them as one object. We know roughly where the middle of each sticker is. A watershed approach can use those two interior markers to assign the touching area to separate regions.

Imagine a surface based on an image gradient or on distance from the mask boundary. The markers begin in regions we trust. As their regions expand across that surface, a dividing boundary forms where their influence meets. The chosen surface and markers decide the result; simply running the algorithm without good markers often creates too many fragments.

Put one marker inside each sticker and compare the proposed separation with the original carton. Does the boundary cut through printed ink? Is one marker too close to a noisy edge? Try a difficult pair with uneven lighting before settling on settings. Two stickers touching in a mask may look like one region. Put a marker inside each sticker and use a watershed method to seek a dividing line. If the markers are misplaced, the algorithm can split one sticker or merge both. Examine the boundary against the actual image edge and compare counts before and after. Treat the result as a hypothesis about separation, especially where glare hides the true contact line. Use this case to test your understanding: Put one marker inside each sticker and inspect the dividing boundary. Here is the limitation to watch for: Overmany or misplaced markers can split one object into several pieces. This supports a careful conclusion: Watershed-style separation uses markers and a topographic image to assign touching regions. Two touching stickers need separate markers before the watershed step. A misplaced marker can create a border inside one sticker, so examine the original image where the separation was drawn.

Keep the markers, surface, and final label map. Once objects are separated, we can give each connected region an identity and measure it. That's our next step.