Finding angle Between the bending of finger

4 views (last 30 days)
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 Comments
jari jafri
jari jafri on 3 Oct 2023
Edited: jari jafri on 4 Oct 2023
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 on 3 Oct 2023
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)

Sign in to comment.

Answers (1)

Image Analyst
Image Analyst on 3 Oct 2023
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 Comment
jari jafri
jari jafri on 4 Oct 2023
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

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!