MATLAB: How to detect the waist in a BW image

Image Processing Toolboxminimum distancewaist detection

I am trying to split an abject that is in fact two touching objects. So to split it in two I need to detect the waist (the area with the minimum distance)
. I can;t figure out how to detect the waist.

Best Answer

Why not use imdistline() or improfile() to manually specify them. Unless you have hundreds of images and need to do this automatically, that's probably the best way.
Otherwise, first call bwareafilt() to extract the largest blob. Then try to iterate where you call imdilate() followed by bwlabel() to count the number of blobs and quit when you get to two. Then binarize again and call bwmorph() with the "thicken" option to expand the blobs out so that they touch, but will not join/combine them. Then label again and call graycomatrix() to count how many pixels of blob #1 occur next to blob #2.