MATLAB: Detecting thin edges of the connected cell

edge detectionimage processingImage Processing Toolbox

Hello Everyone! I have a B/W image of a cell and want to extract a thin edges out of it. I tried imclose() but it gives the closed object. Please find the source image, target image (Image which I want) and image with imclose() operation. Yellow line in the Targetimage.jpg is the output, which I want. Thanking you in anticipation.

Best Answer

First call imfill() on your source image to get rid of internal black spaces:
filledImage = imfill(sourceImage, 'holes');
Then separate the blobs with watershed. For that see Steve's blog. Attach your code if you have any problems with Steve's algorithm.