MATLAB: How to measure the distance between two points in a binary image for human action recognition

human action recognitionImage Processing Toolbox

Hi i want to find human action recognition in still images i got the silhouette pf human pose from that i got binary image now by using this binary image i want find some features like distance between the centroid of image to hands tips and legs tips automatically. then depending on these features i will decide the action. is my theory right? and if right anyone help me to find these features
<<
>>

Best Answer

You can ask regionprops() for the centroid, and the bounding box.
measurements = regionprops(labeledImage, 'Centroid', 'BoundingBox');
centroid = measurements(1).Centroid;
bb = measurements(1).BoundingBox;
y1 = bb(2); % Top of bounding box.
y2 = bb(2)+bb(4); % Bottom of bounding box.
From those, simple subtraction will get the distances you want.
centroidToToe = y2 - centroid(2);