Finding angle Between the bending of finger

4 次查看(过去 30 天)
I am trying to find out the bending angle of this finger. I have used the following matlab code and deducted the markers on the finger. but i am unable to get the bending angle as i cant find the cordinates or centroid of these markers. I will be thankful if you can please resolve this issue.
  2 个评论
jari jafri
jari jafri 2023-10-3
编辑:jari jafri 2023-10-4
This is my code that i used
clc;
clear all;
clear;
img1 = imread ('Picture1.png');
%subplot(1,3,1)
%imshow(img1);
% Convert RGB image to chosen color space
I = rgb2hsv(img1);
% Define thresholds for channel 1 based on histogram settings
channel1Min = 0.889;
channel1Max = 0.001;
% Define thresholds for channel 2 based on histogram settings
channel2Min = 0.000;
channel2Max = 1.000;
% Define thresholds for channel 3 based on histogram settings
channel3Min = 0.000;
channel3Max = 1.000;
% Create mask based on chosen histogram thresholds
sliderBW = ( (I(:,:,1) >= channel1Min) | (I(:,:,1) <= channel1Max) ) & ...
(I(:,:,2) >= channel2Min ) & (I(:,:,2) <= channel2Max) & ...
(I(:,:,3) >= channel3Min ) & (I(:,:,3) <= channel3Max);
%subplot(1,3,2)
%imshow(sliderBW)
diskElem = strel('sphere',3);
IBWopen=imopen(sliderBW, diskElem);
%subplot(1,3,3);
%imshow(IBWopen )
%%
hbobanalysis= vision.BlobAnalysis('MinimumBlobArea',200,...
'MaximumBlobArea',3000);
[objArea, objCentrroid, bboxout] = step(hbobanalysis,IBWopen);
bboxout
%%
Ishape=insertShape(img1, "rectangle",bboxout,'LineWidth',4);
figure
subplot(1,2,1);
imshow(Ishape )
%%
%%
release(hbobanalysis)
jari jafri
jari jafri 2023-10-3
Dear @Matt J the code is able deduct the red marks, but im ubale to find out the cordinates and therefore i can't find the bending angle. Is there any way that i can dind the angle between the 2 marker (red)

请先登录,再进行评论。

回答(1 个)

Image Analyst
Image Analyst 2023-10-3
Try bwskel. Be careful though because some algorithm that works fine for a computer graphics image may fail miserably for a real world image, like a photo of a real finger.
  1 个评论
jari jafri
jari jafri 2023-10-4
Thanks @Image Analyst, can you please write a code using this bwskel command. I am also trying. but still unable to measure the bending angle for the finger

请先登录,再进行评论。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by