Matlab stick Figure plot. Why do the joints bend in weird directions?
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello,
I'm trying to plot a stick figure using data obtained by an Xbox Kinect. The Kinect gives the data of the joints in translations and rotations in X, Y and Z (euler angles).
I plotted the stick figure, it looks like a person, so that's good. But the movements are strange. For example the knees sometimes bend the wrong way.
This is how I got the plot:
First I import the data, Rhead is rotation of the head, Thead is the translation of the head.
if true
%the rotations (in rad, with a the number of the frame)
rxhead=rhead(a,1)*pi/180;
ryhead=rhead(a,2)*pi/180;
rzhead=rhead(a,3)*pi/180;
%rotation matrix
ARhead= [1 0 0;0 cos(rxhead) -sin(rxhead);0 sin(rxhead) cos(rxhead)];
BRhead=[cos(ryhead) 0 sin(ryhead);0 1 0; -sin(ryhead) 0 cos(ryhead)];
CRhead=[cos(rzhead) -sin(rzhead) 0; sin(rzhead) cos(rzhead) 0; 0 0 1];
Rhead=ARhead*BRhead*CRhead;
%Making a vector
ptheadtip=[theadtip(a,1);theadtip(a,2);theadtip(a,3)];
%position of the head (everyting is calculated from the waist. So position head is:)
poshead = Rwaist*(Rspine*(Rchest*(Rneck*(Rhead*ptheadtip+pthead)+ptneck)+ptchest)+ptspine)+ptwaist;
%transpose te matrix
posheadtip2=transpose(posheadtip);
%drwawing the lines between headtip and head, so I can plot these
pts_hth=[posheadtip2; poshead2];
%plot
plot3(pts_hth(:,1), pts_hth(:,2), pts_hth(:,3),'g','LineWidth',1.5)
scatter3(poshead2(:,1),poshead2(:,2),poshead2(:,3),'r','filled')
end
I do this for every point, creating a stickman.

This is supposed to be someone doing a squat. As you can see, the left leg is bent the wrong way...
I have no idea how to fix this, because I don't know what the problem is.
Hope someone can help!
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Kinect For Windows Sensor in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!