0

I need to find the shoulder points(humans body) of the image need help how to identify the coordinates, I am able to get the edges of the human body using imagemagick but having difficulties in finding Shoulder points A,B and neck point C.

Original Image Original Image

Image after getting edges Image after getting edges

alianjum0
  • 117
  • 1
  • 6

2 Answers2

0

Scan your edge image row by row from top to bottom. For each row calculate the length between the first edge pixel to the last.

The row were you have a big change in the length is point C.

After you found point C the length start to go up in a linear way with some slope m when the slope changes very drastically is when you encounter the row with the shoulder points. You may need to calculate this slope seperattly for each side.

Amitay Nachmani
  • 3,259
  • 1
  • 18
  • 21
0

Try processing the input image with Image Magick morphology methods. Detailed examples are here. The script below will size down and threshold the image to 2bpp bitmap, then it will try to close all the gaps, and round the shape. Afterwards a skeleton is created that holds general information about our shape. Finally using hit and miss kernel you search for specific line ends. In this case diagonal ones. The output is an image with set of dots. However you can use Image Magick's identify to print pixel positions. I also assume that more or less you know where shoulders are and can discard points in other parts of the image. The C-point, identifying neck can be extrapolated from A and B.

convert -resize 25% input.jpg -negate -normalize -colorspace gray -threshold 20% -trim +dither v.png
convert v.png -morphology Close Disk x.png 
convert x.png -morphology Thinning:-1 Skeleton:2 y.png 
convert y.png -morphology HMT 'LineEnds:2;LineEnds:2>>' z.png

enter image description here

I used IM v.6.7.9 as I have some issues with v7.

rostok
  • 2,057
  • 2
  • 18
  • 20