2D joint orientation to draw my own skeleton using images (Pimages) in Processing 2.0

340 views
Skip to first unread message

Ashley Brown

unread,
Jul 17, 2013, 6:18:53 AM7/17/13
to simple-ope...@googlegroups.com
HI guys great software been using it a while for basic kinect tracking and for doing some physics based stuff too.

Doing what i thought would be a simple task and im pretty stuck on the maths (i think) . Im trying to get the correct rotation of each of the joints so i can draw my own skeleton (avatar) using PImages. Im mainly fussed about the arms and legs really and i only need it to be 2d - kinda like the old captain pugwash styled paper cutout 2de animation.

I found from greg (atduskgreg) on github some examples from his book and there is the user3d example but its not working for me - i dont need the z 3d rotation.

I thought i could use atan() and find the angle between 2 Pvectors (one from each of the joints) and use PI to work out the angle but im literaly just guessing.

If anyone has any ideas or if this has been done can you point me in the right direction i would appreciate it

Thanks a lot - i can happily make a donation for any help received once i have what i want working :-)

Ashley 


now1here .

unread,
Jul 17, 2013, 7:46:41 AM7/17/13
to simple-ope...@googlegroups.com
you mean that you need the vector math functions to rotate points
i've used some methods to rotate Kinect point clouds about a point I regard as kinect origin, in Z axis (plan rotation) and tilt  (side view rotation).
check the video to see if this is what you want to do, and then see my processing sketch to find the actual methods which can apply to your case
http://at-nowhere.tumblr.com/post/32751176163/kinect-interaction-design-framework-processing
i am using toxic libraries Vec3D class which I recommend.



Ashley 


--
Sie haben diese Nachricht erhalten, weil Sie der Google Groups-Gruppe simple-openni-discuss beigetreten sind.
Um Ihr Abonnement für diese Gruppe zu beenden und keine E-Mails mehr von dieser Gruppe zu erhalten, senden Sie eine Email an simple-openni-di...@googlegroups.com.
Weitere Optionen: https://groups.google.com/groups/opt_out
 
 

Ashley Brown

unread,
Jul 17, 2013, 7:54:26 AM7/17/13
to simple-ope...@googlegroups.com
That looked cool but isnt what i am after

Imagine a flat 2d puppet that looks like a skeleton that moves as you do with a kinect - im not after 3d data just literally if the arm rotates then rotate the skeleton on the screen the correct way.
I have Images for each of the body parts but i cant get them to rotate correctly.


I tried this

PVector LHposition = new PVector();
       context.getJointPositionSkeleton(userPuppet, SimpleOpenNI.SKEL_LEFT_ELBOW, LHposition);
      PMatrix3D LHorientation = new PMatrix3D();
       float confidence = context.getJointOrientationSkeleton(userPuppet, SimpleOpenNI.SKEL_LEFT_ELBOW, LHorientation);
  //
       pushMatrix();
       
        translate(LHposition.x, LHposition.y, LHposition.z);
        applyMatrix(LHorientation);
        // draw lines x, y, z
        rotateY(PI);
        stroke(255, 0, 0);
        strokeWeight(6);
        line(0, 0, 0, 150, 0, 0);
        image(armL2,0,0);
        popMatrix(); 


This gets me close and the red line drawn is correct - the correct way and rotates right but becuase its 3d the image is also drawn in 3d and i only want to constrain to 2d so the image often doesnt get drawn right.

I guess i am trying to replace the inbuilt drawLimb with drawImage ! Maybe its a feature request


Um Ihr Abonnement für diese Gruppe zu beenden und keine E-Mails mehr von dieser Gruppe zu erhalten, senden Sie eine Email an simple-openni-discuss+unsub...@googlegroups.com.
Weitere Optionen: https://groups.google.com/groups/opt_out
 
 

Ashley Brown

unread,
Jul 17, 2013, 7:58:34 AM7/17/13
to simple-ope...@googlegroups.com

SO this is this skeleton - when you love your arms have it move and rotate the images to fit and match your arms .

Hope this makes sense
hbl-section-body-0001.png

Ashley Brown

unread,
Jul 17, 2013, 8:09:41 AM7/17/13
to simple-ope...@googlegroups.com

I originally just thought about using the angleBetween() function between 2 PVector positions but this didnt give the correct numbers out.

Im not sure but i tried atan2() function as well but this also didnt work.

Ashley Brown

unread,
Jul 17, 2013, 9:30:01 AM7/17/13
to simple-ope...@googlegroups.com
FIXED IT

using atan2() and getting the 2 joint positions did work - i mistakenly wasn subtracting the difference between the two PVectors before performing the atan2() function followed by the rotateZ

now1here .

unread,
Jul 17, 2013, 7:42:34 PM7/17/13
to simple-ope...@googlegroups.com
nice! ;)

2013/7/17 Ashley Brown <ashleyb...@googlemail.com>
FIXED IT

using atan2() and getting the 2 joint positions did work - i mistakenly wasn subtracting the difference between the two PVectors before performing the atan2() function followed by the rotateZ

--
Sie haben diese Nachricht erhalten, weil Sie der Google Groups-Gruppe simple-openni-discuss beigetreten sind.

Esteban Cabrera Cejas

unread,
Oct 14, 2014, 12:49:29 PM10/14/14
to simple-ope...@googlegroups.com
Grats! 

Hi there, im doing a sketch for a children Hallowen party in my town. Im looking for the same project, but im very frustrated coz the rotation and the scalling of the objects. Do you have some working example?

Thanks in advance
Reply all
Reply to author
Forward
0 new messages