To find the coordinates of the following image?

Illustration
Ezequiel - 2020-10-31T10:19:23+00:00
Question: To find the coordinates of the following image?

I want to find the coordinates of the middle fingure in both hands.

Expert Answer

Profile picture of Neeta Dsouza Neeta Dsouza answered . 2025-11-20

Here's a start:
 
 
 
grayImage = rgb2gray(rgbImage);
mask = grayImage > 128; % or whatever value works to get the hand.
mask = imfill(mask, 'holes');
mask = bwareafilt(mask, 1); % Take largest blob.
props = regionprops(mask, 'BoundingBox');
xLeft = props.BoundingBox(1)
xRight = xLeft + props.BoundingBox(3)
hold on;
rectangle('Position', props.BoundingBox, 'EdgeColor', 'y', 'LineWidth', 2)

You can easily determine whether the hand is oriented like on the left of right by splitting the mask into the top half and bottom half and finding if the centroid of bottom half is to the left or right of the top half

 

topHalf = false(size(mask));
[rows, columns] = size(mask);
topHalf(floor(rows/2)+1:end, :) = false; % Erase bottom half.
propsTop = regionprops(topHalf, 'Centroid');
bottomHalf = false(size(mask));
bottomHalf(1:floor(rows/2), :) = false; % Erase top half.
propsBottom = regionprops(topHalf, 'Centroid');
if propsTop.Centroid(1,1) < propsBottom.Centroid(1,1)
    % Forearm is on the right.
    xMiddle = xLeft; % Middle finger is on the left.
else
    % Forarm is on the left
    xMiddle = xRight; % Middle finger is on the right.
end


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!