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

Access color and depth frame using frame number #8259

Closed
akmaldeen opened this issue Jan 28, 2021 · 4 comments
Closed

Access color and depth frame using frame number #8259

akmaldeen opened this issue Jan 28, 2021 · 4 comments

Comments

@akmaldeen
Copy link

  • Before opening a new issue, we wanted to provide you with some useful suggestions (Click "Preview" above for a better view):

  • All users are welcomed to report bugs, ask questions, suggest or request enhancements and generally feel free to open new issue, even if they haven't followed any of the suggestions above :)


Required Info
Camera Model D455
Firmware Version 05.12.09.00
Operating System & Version {Win (10)
Kernel Version (Linux Only) (e.g. 4.14.13)
Platform PC
SDK Version { legacy / 2.. }
Language {c++ }

Issue Description

Hi I'm new to realsense. I have D455 camera. I'm using c++ in windows, visual studio 2009.

I have to access a selected frame in .bag file using frame number. Let's say 50th frame is my requirement, then my code has to access 50th frame and convert it to opencv Mat file. Also I have to access the color frame depth frame separately.

Please help me with c++ example

@MartyG-RealSense
Copy link
Collaborator

MartyG-RealSense commented Jan 28, 2021

Hi @akmaldeen It may be best to break this programming goal into two sections. First, get conversion to cv::mat of all frames working. And then add a frame index seek mechanism for specific frames once conversion for all frames is working.

In regard to the first step, a C++ bag extraction script that uses cv::mat can be found in the link below.

#1919 (comment)

For the second step (navigating to a specific frame index) with C++, the link below should be helpful:

#6577

@MartyG-RealSense
Copy link
Collaborator

Hi @akmaldeen Do you require further assistance with this case, please? Thanks!

@akmaldeen
Copy link
Author

akmaldeen commented Feb 5, 2021

I have used disable playback technique to poll frame one by one from bag file

rs2::playback play_back = device.asrs2::playback();
play_back.set_real_time(false);

after I can access the particular frame using frame number and basic loop techniques.

Access frame number:
rs2:frameset frames = pipe.wait_for_frames();
auto color_frame = frames.get_color_frame();
auto fr_no = color_frame.get_frame_number();

Thanks for the links

@MartyG-RealSense
Copy link
Collaborator

Great to hear that you developed a solution @akmaldeen - 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