Why can't I get Watershed Ridge Lines when I use watershed in Matlab?

127 Views Asked by At

As mentioned in the title, I need to use watershed for image segmentation. And I follow the instruction provided by https://uk.mathworks.com/help/images/marker-controlled-watershed-segmentation.html and would like to apply it on my MRI images, but when I calculate the background markers, watershed function returns all numbers within the matrix as 1, so my watershed line does not exist, and I am not sure what the reason is. Here is my code:

bw = imbinarize(Iobrcbr); % Iobrcbr represents opening-closing reconstruction
D = bwdist(bw);           % computes the distence between background and forground
DL = watershed(D);        
bgm = DL == 0;

enter image description here

enter image description here

0

There are 0 best solutions below