Items with no label
3335 Discussions

how to map jointData to color space?

lqu
Novice
1,494 Views

1.Enable streams

var sm = session.CreateSenseManager();

var mColorReader = SampleReader.Activate(sm);

var mColorReader.EnableStream(StreamType.STREAM_TYPE_COLOR, 1920, 1080);

var mColorReader.EnableStream(StreamType.STREAM_TYPE_DEPTH, 640, 480);

2. Enable hand tracking

HandModule handModule = HandModule.Activate(sm);

// Create the hand data instance

var handData = handModule.CreateOutput();

3.Access hand data

handData.update();

IHand hand;

var HandData.QueryHandData(AccessOrderType.ACCESS_ORDER_BY_TIME, 0, out hand);

var wristJointData = hand.TrackedJoints[JointType.JOINT_WRIST];

var position = wristJointData.positionImage;

Then how to show wrist point in color space(1920x1080)?

0 Kudos
1 Solution
lqu
Novice
343 Views

Thanks,I figure it out by take a look at the Projection(c++) sample.

I translate it to c# .

var wrist = hand.TrackedJoints[JointType.JOINT_WRIST];

ImageData ddata;

if (sample.Depth.AcquireAccess(ImageAccess.ACCESS_READ, PixelFormat.PIXEL_FORMAT_DEPTH, out ddata) >= Status.STATUS_NO_ERROR)

{

unsafe

{

short* ptr = (short*)(ddata.planes[0] + (int)wrist.positionImage.y * ddata.pitches[0]).ToPointer();

float z = (float)ptr[(int)wrist.positionImage.x];

// Point3DF32[] depthPoints = new Point3DF32[] { new Point3DF32(wrist.positionImage.x, wrist.positionImage.y, wrist.positionImage.z) }; this line doesn't work ,strange?

Point3DF32[] depthPoints = new Point3DF32[] { new Point3DF32(wrist.positionImage.x, wrist.positionImage.y, z) };

PointF32[] colorPoints = new PointF32[] { new PointF32(-1, -1) };

projection.MapDepthToColor(depthPoints, colorPoints);

}

sample.Depth.ReleaseAccess(ddata);

}

View solution in original post

0 Kudos
3 Replies
idata
Employee
343 Views

Hi Qule,

 

 

Thank you for contacting us.

 

 

I didn't quite understand your issue, but take a look at the SDK R2 documentation: https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?sample_hands_viewer_javascript.html, you can use this sample as reference.

 

 

You can check this link too: https://software.intel.com/en-us/articles/blend-the-intel-realsense-camera-and-the-intel-edison-board-with-javascript, it also uses the same sample that I think it is what you are trying to do.

 

 

I hope you find this helpful.

 

 

Have a nice day.

 

 

Regards,

 

-Leonardo
0 Kudos
lqu
Novice
344 Views

Thanks,I figure it out by take a look at the Projection(c++) sample.

I translate it to c# .

var wrist = hand.TrackedJoints[JointType.JOINT_WRIST];

ImageData ddata;

if (sample.Depth.AcquireAccess(ImageAccess.ACCESS_READ, PixelFormat.PIXEL_FORMAT_DEPTH, out ddata) >= Status.STATUS_NO_ERROR)

{

unsafe

{

short* ptr = (short*)(ddata.planes[0] + (int)wrist.positionImage.y * ddata.pitches[0]).ToPointer();

float z = (float)ptr[(int)wrist.positionImage.x];

// Point3DF32[] depthPoints = new Point3DF32[] { new Point3DF32(wrist.positionImage.x, wrist.positionImage.y, wrist.positionImage.z) }; this line doesn't work ,strange?

Point3DF32[] depthPoints = new Point3DF32[] { new Point3DF32(wrist.positionImage.x, wrist.positionImage.y, z) };

PointF32[] colorPoints = new PointF32[] { new PointF32(-1, -1) };

projection.MapDepthToColor(depthPoints, colorPoints);

}

sample.Depth.ReleaseAccess(ddata);

}

0 Kudos
idata
Employee
343 Views

Hi Qule,

 

 

That's great, it is good to know that you figured it out.

 

 

Don't doubt to contact us when you have issues.

 

 

I hope you have a nice day.

 

 

Regards,

 

-Leonardo
0 Kudos
Reply