-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Discrepancy between raw depth frame values when multiplied by units and getDistance function #7264
Comments
Hi @blakat360 The original depth pixel value is the uint16_t value. The pixel value is then multiplied by the depth unit scale provided by get_depth_scale() to convert the pixel value to meters. The documentation also provides an example of getting the distance in meters using get_distance() https://dev.intelrealsense.com/docs/projection-in-intel-realsense-sdk-20#section-depth-image-formats A list of further links to discussions about this subject can be found by scrolling to the bottom of the page at #2348 |
I am taking it as a uint_16, note: I'm confused as to why cumulative error does not stay at 0. I'm assuming I'm indexing into the image incorrectly but can't seem to come up with something that works. |
RealSense 400 Series cameras have a phenomenon called RMS Error where the amount of error in measurements increases over distance. Error is less than 1% of the distance of the object from the camera. So for example, if the camera is 1 meter away then an accuracy of 2.5 mm to 5 mm is expected. |
I understand that - I'm wondering why I get a difference in measurement when I pull the distance out of the raw data using 2 different methods. |
I am trying to understand your script, so thank you for your patience. It looks as though you are calculating the distance in two ways - through uint16 and through frame.get_distance() - and subtracting one from the other. And that you expect that if both methods read the same distance then the result should be zero (e.g 1.5 - 1.5 = 0). Is my interpretation correct, please? I note that in the uint16 part of the calculation, uint16 seems to be multiplied by frame.get_data(). I would have thought that it should be multiplied by frame.get_depth_scale() to get the distance value in meters with that method. |
That is correct! This line; I then loop over the entire frame using the nested for loops and attempt to calculate the distance by I expect the value to be the same. However, it is not. This leads me to believe I'm indexing into the frame the wrong way. I have tested get_depth_scale (through querying the device and then accessing its streams) and in this case it is the same as |
@blakat360 , can you take a second look into the code? for (int row = 0; row < height; row++) {
for (int col = 0; col < width; col++) {
cumulative_error += std::abs(frame.get_distance(col, row) - (double)arr[col + row * col] * units);
}
} Spoiler
|
I'm an idiot, thank you @ev-mp! |
I'm trying to understand the way the raw depth values are stored. This is in order for me to be able to bind the depth texture to a shader and then later query it for distance values.
On some frames the error I'm getting is in excess of 1m.
Is this because get distance linearises the depth values before converting them to a distance? If so, how do I get the near and far planes of the realsense camera?
Edit: the first test script was wrong and added more code for context
The text was updated successfully, but these errors were encountered: