I want to find the coordinates of the middle fingure in both hands.
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
Matlabsolutions.com provides guaranteed satisfaction with a
commitment to complete the work within time. Combined with our meticulous work ethics and extensive domain
experience, We are the ideal partner for all your homework/assignment needs. We pledge to provide 24*7 support
to dissolve all your academic doubts. We are composed of 300+ esteemed Matlab and other experts who have been
empanelled after extensive research and quality check.
Matlabsolutions.com provides undivided attention to each Matlab
assignment order with a methodical approach to solution. Our network span is not restricted to US, UK and Australia rather extends to countries like Singapore, Canada and UAE. Our Matlab assignment help services
include Image Processing Assignments, Electrical Engineering Assignments, Matlab homework help, Matlab Research Paper help, Matlab Simulink help. Get your work
done at the best price in industry.