I have a problem while implementing the marker controlled watershed in Matlab.
The input image is a binary mask which have two clustered object. An other image is an oth
You can use the function imimposemin
to force the local minima to be where your markers are. You'll need to slighty modify the code in solution 1 below by replacing the first imDist...
line with
imgDist=-bwdist(~img);
imgDist=imimposemin(imgDist,marker);
The rest of the code is the same. You should get the segmentation as follows:
Here is a solution in MATLAB that separates your two clusters:
img=im2bw(imread('http://i.stack.imgur.com/qrYCL.jpg'));
imgDist=-bwdist(~img,'cityblock');
imgDist(~img)=-inf;
imgLabel=watershed(imgDist);
imshow(imgLabel==0,'InitialMagnification','fit')