-
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
How can I convert the .raw pixel values from the Depth Map to meters? #3286
Comments
Using the depth_scale instruction may be what you need. Below is another example of use of depth_scale, where the user converts X-Y pixels to X-Y positions in meters. |
I ran the instruction in the .bag file, but when I get the .raw depth (not png image), multiplying the values by the scale provided by |
What I have so far: cv::Mat depth16(720, 1280, CV_16U, (uchar *)buffer.data()); |
Would this script be of any help? It came from a discussion where a person was trying to get the depth data from a .raw file. |
This example seems to work with .png format and not the .raw images. I am already able to get disparity from the .png left and right images. You don't think I would lose information by using the .png instead of the .raw format for the Depth frames? |
I apologize, RealSense programming is not one of my specialties, so I have to rely on what I can research. One of the Intel staff on this forum may be able to give you a better answer about conversion (I do not work for Intel). As @ev-mp says in the link below, you may indeed get better results from a .raw. |
I understand. I will wait for the staff's opinion then. Thanks a lot for your help! |
Hello @amaanda ,
The type of You may also convert to metric units with a single call by passing the scale factor as the third param to |
Hello @ev-mp |
This is the code that is generating the .ply above: std::ifstream file("_Depth_37140.raw", std::ios::binary | std::ios::ate); for (int i = 0; i < size-1; i+=2) { cv::Mat depth16(720, 1280, CV_16U, (uchar *)buffer.data()); stereo_camera_config camera_config; cv::Mat disparityFile = StereoMatching::depthToDisparity(depthfloat, camera_config); |
@amaanda , one thing I notice is that the origin frame data is row-major: |
But 720 is the number of rows, and 1280 the number of columns, isn't it? |
I was able to solve my problem. I used the depth sensor scale and changed the for loop. |
Hi @amaanda , |
That's the problem ... people want help, but they don't help others ... |
I want to generate a .ply from the Depth Map information to compare the results I get from using the Left and Right Infrared images. I opened the .raw Depth file as unsigned 16 bits, and I am having a hard time to convert the Depth pixel values to meters (which will be the input to my function).
So basically what I need to know is the following scale:
depth_meters = depth_raw * scale;
depth_raw contains values from 0 to 65,535. Any help would be appreciated. Thanks!
The text was updated successfully, but these errors were encountered: