Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Meaning of x and y in rs2_deproject_pixel_to_point #11024

Closed
DaveBGld opened this issue Oct 25, 2022 · 3 comments
Closed

Meaning of x and y in rs2_deproject_pixel_to_point #11024

DaveBGld opened this issue Oct 25, 2022 · 3 comments

Comments

@DaveBGld
Copy link

I need to obtain the position in 3D of a pixel in a D435i camera frame to create a new pose in ROS for a robot arm end effector.

After obtaining the color and depth frames, and locating the pixel of interest, I am coding:

rs2_intrinsics intrinsics;
intrinsics = selection.get_stream(RS2_STREAM_COLOR).as<rs2::video_stream_profile>().get_intrinsics();
float pixel[2];
float my3Dpoint[3]; // x, y, z
pixel[0] = sideA.x;  // column
pixel[1] = sideA.y;  // row
float depthofPoint = depth.get_distance (sideA.x, sideA.y);
rs2_deproject_pixel_to_point (my3Dpoint, &intrinsics, pixel, depthofPoint);

In ROS, x is forward, y is left. What is x and y in my3Dpoint? I am assuming z is depth What is the meaning of negative values on these?

Also, do I need to use here the depth stream instrinsics?

Many thanks!!

David

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Oct 26, 2022

Hi @DaveBGld RealSense cameras use a coordinate system where Y is vertical and Z (depth) is forward, as you correctly assume, whilst in the ROS convention Z is vertical. More information about this can be found at IntelRealSense/realsense-ros#1099

RealSense coordinate systems specify coordinates in terms of whether they are to the left, right, above or below the center-line of a sensor. So an X or Y value may be positive or negative depending on where the coordinate is relative to which horizontal / vertical side of the sensor center-line that it is at. #7279 (comment) discusses this.

Depth intrinsics are typically used in RealSense ROS scripts for obtaining the Z-depth value. At IntelRealSense/realsense-ros#807 (comment) advice is provided for obtaining Z by using rs2_deproject_pixel_to_point.

@DaveBGld
Copy link
Author

Thanks @MartyG-RealSense ..

I actually found here that

"... Each stream of images provided by this SDK is also associated with a separate 3D coordinate space, specified in meters, with the coordinate [0,0,0] referring to the center of the physical imager. Within this space, the positive x-axis points to the right, the positive y-axis points down, and the positive z-axis points forward. Coordinates within this space are referred to as "points", and are used to describe locations within 3D space that might be visible within a particular image... "

As I progress I have a different problem with imprecise values from rs2_deproject_pixel_to_point, but I'll post that on a separate issue to keep the history clean...

Thanks!

@MartyG-RealSense
Copy link
Collaborator

You are very welcome, @DaveBGld - thanks very much for the update!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants