How to detect the waist in a BW image?

조회 수: 2 (최근 30일)
Mona
Mona 2015년 6월 29일
답변: Thuy Dung Nguyen 2018년 6월 26일
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.
  댓글 수: 4
Mona
Mona 2015년 6월 29일
Thanks for your input Ashish. The original image is the top-left image (without the blue and red detected boarders). I will upload it all by itself if it helps. So I apply Wiener filter to smooth the background then use Canny edge detection. Then dilate and erode the detected edges simultaneously while filling the holes to find the border as the perimeter of the two touching objects. Once that is done, I need to detect the waist, split the two objects ad track/match their profile throughout the video. Any ideas or thoughts about doing that in a better/more efficient way is more than welcome.
Thanks a lot
Ashish Uthama
Ashish Uthama 2015년 6월 29일
I spent a few minutes, didnt get far (Though stdfilt followed by a threshold helps get close to the mask).
Your watershed image appears to have split the two, isnt that enough? and the waist appear clear,(you could filter the label image with a small summing filter and find areas with a particular sum if you want the 'waist' segment to quantify lenght).

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2015년 6월 29일
편집: Image Analyst 2015년 6월 30일
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.
  댓글 수: 5
Image Analyst
Image Analyst 2015년 7월 1일
Can you post your original binary image, or else code to get it from the gray scale image you uploaded? By the way, you can use the boundaries in poly2mask() if you want to mask out stuff outside the red lines.
Mona
Mona 2015년 7월 1일
편집: Mona 2015년 7월 2일
Yes sure, here is the original BW image.
Ya, you are correct. masking out the extra pixels would work. I actually just multiplied the labeled thickened image by the original binary image shown above and it works just fine! Thanks a lot, your suggestions are very helpful.
Going back to graycomatrix(). Can you please tell me how to use it to find the waist. I used
[glcm,~] = graycomatrix(L_s,'NumLevels',num+1,'G',[])
But it doesn't give me the correct waist length. I found myself writing a hideous code to scan and match for [1 0 2] pixels!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Thuy Dung Nguyen
Thuy Dung Nguyen 2018년 6월 26일
Hello. I have the same problem as Mona had. Can someone explain to me what she did because I do not understand the codes completely.

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by