Skeleton point with x,y,z values

Hi guys, i am currently new to programming and orbbec camera. May i ask how am i going to get the x,y,z values by using the orbbec camera and visual studio C++? Thank you in advance.

1 Like

Hi, This is possible and not that hard. You can get those points using something as follows…

use the example “SimpleBodyViewer-SFML”

after getting the particular information “body”
do this…

const auto& joints = body.joints();

then

for (const auto& joint : joints)
{
// jointType is one of joints which exists for each joint type
astra::JointType jointType = joint.type();
astra::JointStatus jointStatus = joint.status();

	const auto& depthPos = joint.depth_position();
	const auto& worldPos = joint.world_position();
	
	// orientation is a 3x3 rotation matrix where the column vectors also
        // represent the orthogonal basis vectors for the x, y, and z axes.
        const auto& orientation = joint.orientation();
    
       //printf("Body orientation", orientation.x_axis());
   
      const auto& xAxis = orientation.x_axis(); // same as orientation->m00, m10, m20
      const auto& yAxis = orientation.y_axis(); // same as orientation->m01, m11, m21
      const auto& zAxis = orientation.z_axis(); // same as orientation->m02, m12, m22

        if ((int)jointType == 0) // Head
   {
			cout<<"Positions are : " worldPos.x" , "<<
                                                                " worldPos.y" , "<<
                                                                " worldPos.z" , "<<endl;

   }

}

Hope this helps.

BR,
Prasanna

Hi @pkr97 , where do i put the code you provided above.
I do not get what you mean by after getting the particular information “body” then do the code u provided.

Could you provide a screenshot or guide me along. Thank you for the help.

Regards.

Hello! Thanks for the help. I’ve manage to print out the values. There are 2 questions in my mind, firstly, the values printed out, is it in mm? and secondly, the values of x,y,z are taking which joints as its reference? Thank you so much!!

Nice that you were able to get what you wanted.

I’m not using that now. I assume they are in mm.

The values are probably with respect to camera origin.

BR,
Prasanna