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

How to record the depth value in D455 #10878

Closed
JasonChanJY opened this issue Sep 7, 2022 · 7 comments
Closed

How to record the depth value in D455 #10878

JasonChanJY opened this issue Sep 7, 2022 · 7 comments
Labels

Comments

@JasonChanJY
Copy link

I want to record the depth value of depth stream. Is there any method to do that? THX.

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Sep 7, 2022

Hi @JasonChanJY If you are able to use C++ language, a RealSense team member created an adapted version of the RealSense SDK's rs-capture example program that could write depth values to a .csv format file.

https://github.com/dorodnic/librealsense/tree/text_sample/examples/capture

The amended code is highlighted at the link below.

https://github.com/dorodnic/librealsense/blob/text_sample/examples/capture/rs-capture.cpp#L15-L31

Alternatively, you could try recording a bag file (which is like a video file of camera data) in the RealSense Viewer tool and then converting the bag's data to another format such as csv using the SDK's C++ rs-convert tool.

https://github.com/IntelRealSense/librealsense/tree/master/tools/convert

If you prefer to use Python then you could save the depth to an npy file as an array of scaled matrices, like in the script at #4934 (comment)

Another approach would be to save the depth as a .raw format image file that preserves depth information (which the RealSense Viewer's Snapshot option can do), and then retrieve depth from the .raw file using scripting such as the code at #2231 (comment)

@JasonChanJY
Copy link
Author

Hi @JasonChanJY If you are able to use C++ language, a RealSense team member created an adapted version of the RealSense SDK's rs-capture example program that could write depth values to a .csv format file.

https://github.com/dorodnic/librealsense/tree/text_sample/examples/capture

The amended code is highlighted at the link below.

https://github.com/dorodnic/librealsense/blob/text_sample/examples/capture/rs-capture.cpp#L15-L31

Alternatively, you could try recording a bag file (which is like a video file of camera data) in the RealSense Viewer tool and then converting the bag's data to another format such as csv using the SDK's C++ rs-convert tool.

https://github.com/IntelRealSense/librealsense/tree/master/tools/convert

If you prefer to use Python then you could save the depth to an npy file as an array of scaled matrices, like in the script at #4934 (comment)

Another approach would be to save the depth as a .raw format image file that preserves depth information (which the RealSense Viewer's Snapshot option can do), and then retrieve depth from the .raw file using scripting such as the code at #2231 (comment)

Is it possible to get the depth value from .raw format image in Matlab?

@MartyG-RealSense
Copy link
Collaborator

#5824 (comment) offers advice about loading a RealSense .raw file into MATLAB.

@JasonChanJY
Copy link
Author

#5824 (comment) offers advice about loading a RealSense .raw file into MATLAB.

Thank you for your reply. I try to load .raw file into MATLAB successfully. And another question I want to ask that the index of the point as shown in the .png file means 1144 mm?

depth

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Sep 7, 2022

It looks as though it refers not to mm depth but instead to the index value of a particular pixel on an indexed image in MATLAB, as discussed at the links below:

https://stackoverflow.com/questions/25853320/how-to-obtain-the-index-value-from-an-indexed-image-in-matlab

https://stackoverflow.com/questions/34256426/incorrect-pixel-value-from-data-cursor-on-matlab

@JasonChanJY
Copy link
Author

It looks as though it refers not to mm depth but instead to the index value of a particular pixel on an indexed image in MATLAB, as discussed at the links below:

https://stackoverflow.com/questions/25853320/how-to-obtain-the-index-value-from-an-indexed-image-in-matlab

https://stackoverflow.com/questions/34256426/incorrect-pixel-value-from-data-cursor-on-matlab

Thanks. I check depth value in RealSense viewer, and the index value in MATLAB is consist with the depth value.

@MartyG-RealSense
Copy link
Collaborator

Thanks very much @JasonChanJY for the update!

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

No branches or pull requests

2 participants