-
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
Playback from bag files - direct access to frames by index #1579
Comments
Hi @andreabnd |
Hi @dorodnic Thanks |
Hi @dorodnic & @andreabnd, I was looking for the same feature in the API, in order to have frame-by-frame replay without drop, but I first thought this could be handled using the Thx for your help |
The |
@lramati : thx for your answer, I'll stick with pause/resume for now, and wait for the |
it seems like repeated calls to
|
Hi there, I am following up on the previous messages. Did you guys implement any solution to access the frames of a recording sequence by index. Anything helpful in the latest release of the SDK? Thanks in advance for your help! |
[Realsense Customer Engineering Team Comment] |
+1 I'm also looking for indexed access, or fixed |
Thanks for the information! However, I just really want the |
@valkjsaaa @visez @andreabnd - |
[Realsense Customer Engineering Team Comment] |
sorry unfortunately I have been assigned to a new project and I do not have access to the realsense anymore. Thanks for all the support |
[Realsense Customer Engineering Team Comment] |
Hi there, thanks for following up! Actually I still have to try, and I'll let you know as soon as possible Thanks |
Hi, Following my previous question about int main( int argc, char** argv ) try
{
rs2::config config;
rs2::device device;
rs2::pipeline pipe;
rs2::pipeline_profile pipeline_profile;
// enable file playback with playback repeat disabled
config.enable_device_from_file( "test.bag", false );
// start pipeline and get device
pipeline_profile = pipe.start( config );
device = pipeline_profile.get_device();
// get playback device and disable realtime mode
auto playback = device.as<rs2::playback>();
playback.set_real_time( false );
rs2::frameset frames;
size_t frame_index = 0;
bool stop = false;
bool playing = false;
while( !stop )
{
if( pipe.poll_for_frames( &frames ) )
{
playing = true;
// Add some frames processing here...
std::cout << "\rsuccessfully retrieved frame #" << ++frame_index << " (" << playback.current_status() << ")";
}
else
{
using namespace std::chrono_literals;
std::this_thread::sleep_for( 10ms );
}
stop = playing && ( playback.current_status() == RS2_PLAYBACK_STATUS_STOPPED );
}
std::cout << std::endl << "successfully ended file playback" << std::endl;
pipe.stop();
return EXIT_SUCCESS;
}
catch (const rs2::error & e)
{
std::cerr << "RealSense error calling " << e.get_failed_function() << "(" << e.get_failed_args() << "):\n " << e.what() << std::endl;
return EXIT_FAILURE;
}
catch (const std::exception& e)
{
std::cerr << e.what() << std::endl;
return EXIT_FAILURE;
} First thing is I'm not really happy with the stop condition, which I find a bit awkward because it seems like the status is set to RS2_PLAYBACK_STATUS_PLAYING only after the first successful frameset retrieval. Do you have a better recommendation on that? Second thing is Regards |
Hi @MartyG-RealSense, thanks for referencing my script. The thing is I'm not really satisfied with its current functioning, as the two questions from my last comment remain unanswered. I know you might receive a lot of user support requests, but as theses questions are just questions regarding how the API is supposed to work, I'm pretty sure they have simple answers that could help me improve my code. Thanks for your help |
I will recap your questions below to make them easy to find: First thing is I'm not really happy with the stop condition, which I find a bit awkward because it seems like the status is set to RS2_PLAYBACK_STATUS_PLAYING only after the first successful frameset retrieval. Do you have a better recommendation on that? Second thing is poll_for_frames happens to periodically fail and return false even if the stream has not ended, and it's a strange behavior for a query mode not supposed to depend on frame readiness, don't you think? |
@dorodnic : I know my questions are a bit lost in this already closed issue, so would you like me to create a new issue on this topic? thx |
Hi, are there any examples of how to use the set_real_time and how to then fetch frames one frameset at a time? I'd like to then align the depth and color data from the frameset. |
Hello,
I am recording the color and depth streams for offline processing. To reproduce the recorded sequence, I am following the rs-record-playback sample. https://github.com/IntelRealSense/librealsense/tree/master/examples/record-playback
However, my objective is to process every frame of the sequence, and using the below code, I am experiencing a drop of frames (especially if the processing takes a while).
Thus, I was wondering if there is a way to access the frames by index, knowing in advance the number of frames recorded in the sequence.
I have tried to fix the drop of frames by pausing the playback (
playback.pause()
) before to get the frames and doing the processing, and then resuming it (playback.resume()
) after the processing. However, I would definitely prefer to have direct access to the frames by index.I know that using the playback::seek method I can set the playback to a specified timepoint. So, in case I cannot access the frames by index, is there another way to know the timestamp of every frame recorded in the sequence, to get access through the seek function?
Thanks in advance!
The text was updated successfully, but these errors were encountered: