Question
I want to find the coordinates of the middle fingure in both hands.
Expert Answer
Neeta Dsouza
PhD Expert
Answered Nov 20, 2025
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
100% Run Guarantee
3-Hour Fast-Track Delivery
Need a Custom Version or Complete Simulation for This Problem?
Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.
Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here
Related matlab Questions & Solutions
Browse All →
Explore similar technical troubleshooting questions and verified MATLAB solutions:
Ready-to-Run MATLAB & Simulink Projects
Browse All Projects →