Over-segmentation of Watershed algorithm
Asked Answered
M

2

5

I followed the 2-D Watershed example in Mathworks.com to separate the connected objects, like the image below:

Imgur

The code is summarize as:

bw = imread('some_binary_image.tif');

D = -bwdist(~bw);

D(~bw) = -Inf;

L = watershed(D);

The result is:

Imgur

The particle in the center has been separated into two. Are there any ways to avoid the over-segmentation here?

Thanks, lennon310, chessboard does work well for most of my images, but there are still some cases that it doesn't. For example, the following binary image: Imgur

Using chessboard will result in: Imgur

As I have hundreds of images, it seems that it is difficult to find one combination of parameters that work for all images. I am wondering if I need to combine the good results got from using chessboard, cityblock, etc...

Melanimelania answered 16/12, 2013 at 22:35 Comment(3)
what is your aim of hundreds of image-processing? it is not necessary to use watershed to extract the objects. Since there are tiny connections between two circles in your image, the basic method to label the connected components may not work either. Actually there are circle detectors (hough, imfindcircles, ...) in matlab image processing toolbox.Thermo
@Thermo : These are actually images taken by X-Ray tomography. I want to create a mask for the particle of my interest. Currently, I am using Connected Threshold Grower in ImageJ that can find the connected region from a seed point. By setting the seed point on the particle of interest, the Connected Threshold Grower can produce a result that only contains this particle if it is not touching other particles. Now I manually erase the touching boundary for hundreds of images, which is time consuming. I am trying to use watershed to automatically separate these particles.Melanimelania
The X-ray images are not binary images, are they? I think the connected component can be detected, or even clustering algorithm is worth trying on the raw images based on the intensity difference. For binary image, especially your updated one, it is challenging to segment the two actually connected circles.Thermo
T
7

Use max(abs(x1-x2),abs(y1-y2)) as the distance metric (chessboard), and use eight-connected neighborhood in watershed function:

bw=im2bw(I);

D = -bwdist(~bw,'chessboard');
imagesc(D)
D(~bw) = -Inf;

L = watershed(D,8);
figure,imagesc(L)

Result: enter image description here

Thermo answered 17/12, 2013 at 3:22 Comment(0)
H
3

I have been dealing with the same issue for a while. For me, the solution was to use a marker based watershed method instead. Looks for examples on watershed method given on the Matlab Blog by Steve: http://blogs.mathworks.com/steve/ This method given by him worked best for me: http://blogs.mathworks.com/steve/2013/11/19/watershed-transform-question-from-tech-support/

Now, in an ideal world, we would be able to segment everything properly using a single method. But watershed does over or under-segment some particle, no matter which method you use (unless you manually give the markers). So, currently I am using a semi-automatic segmentation method; i.e., use watershed to segment the image as best as possible, and then take that image into MSPaint and edit it manually to correct whatever under/over-segmentation remains.

Region growing seems to have been used by some people in the past. But my image processing knowledge is limited so I can't help you out with that. It would be great if anyone could post something about how to use region-growing to segment such an image.

Hope this helps.

Heteromorphic answered 28/7, 2014 at 20:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.