- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is the discussion in the link below of any help to you, please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the fast reply, I've thoroughly read the discussion and made sure that I'm passing the arguments as the RS team specified but still the same issue occurs, also at the end of the discussion omer says that the issue is solved but didn't mention how it was solved
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When you say that rs2_deproject_pixel_to_point returns zero, do you mean that the value of rs2_deproject_pixel_to_point is zero?
Or do you mean that you are using rs2_project_pixel_to_point in your program, and you are seeing '0' values for the depth of the pixels, please?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
vector<float> dist_3d(const rs2::depth_frame& frame, pixel u)
{
float upixel[2]; // From pixel
float upoint[3]; // From point (in 3D)
// Copy pixels into the arrays (to match rsutil signatures)
upixel[0] = u.first;
upixel[1] = u.second;
auto udist = frame.get_distance(upixel[0], upixel[1]);
// Deproject from pixel to point in 3D
rs2_intrinsics intr = frame.get_profile().as<rs2::video_stream_profile>().get_intrinsics(); // Calibration data
rs2_deproject_pixel_to_point(upoint, &intr, upixel, udist);
vector<float> point;
point.push_back(upoint[0]);
point.push_back(upoint[1]);
point.push_back(upoint[2]);
return point;
}
I've attached the function I'm using, this uses rs2_deproject_pixel_to_point to return XYZ position from camera frame, upoint[0],[1] & [2] sometimes contain 0 and -0 values, this is my issue, why does this happen ? note that for the same pixel sometimes 0 and -0 values are returned and sometimes actual correct distance is returned
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If a pixel has a depth of '0' then it usually means either that there is no detail in that area for the camera to see, or that the camera cannot currently perceive the detail in that area.
The official SDK documentation for projection describes it like this: "If a device fails to determine the depth of a given image pixel, a value of zero will be stored in the depth image. This is a reasonable sentinel for "no depth" because all pixels with a depth of zero would correspond to the same physical location, the location of the imager itself".
https://github.com/IntelRealSense/librealsense/wiki/Projection-in-RealSense-SDK-2.0
If the same area is sometimes '0' and other times correct, it suggests that there is a problem with the camera reading the detail in that area of the image under certain circumstances. For example, if a light source is shining on a reflective surface on the observed object then it may temporarily make that area of the object harder for the camera to read.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you this information is very helpful to me, thank you for your time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are totally welcome. I'm really glad I could help! :)

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page