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

playback keep reading the same frames while writing frames to disk by stbi_write_png #2242

Closed
hflsdupont opened this issue Aug 15, 2018 · 3 comments
Assignees

Comments

@hflsdupont
Copy link

hflsdupont commented Aug 15, 2018

  • 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 D435
Firmware Version 5.9.14
Operating System & Version Win10
Platform PC
SDK Version 2.14.1

Issue Description

Hi, I'm currently using playback to read from two rosbag files and synchronize those frames. As far as I don't write those frames to disk by stb, pipe.wait_for_frames() return each frames in .bag file correctly. However, when I try to call stbi_write_png, the next call of playback.resume() and pipe.wait_for_frames() return exactly the same frameset as the previous one.

  auto device = pipe.get_active_profile().get_device();
  rs2::playback playback = device.as<rs2::playback>();

  playback.resume();
  frameset = pipe.wait_for_frames(); 
  playback.pause();
void saveImages(video_frame & f, std::stringstream & filename, std::string & dir, std::string & subdir)
{
  std::stringstream path; 
  path << dir << "\\" << subdir << "\\" << filename.str(); 
  
  stbi_write_png(path.str().c_str(), f.get_width(), f.get_height(),
            f.get_bytes_per_pixel(), f.get_data(), f.get_stride_in_bytes());
  
  std::cout << "Saved " << path.str() << std::endl;
}

Thanks for the help

@dorodnic
Copy link
Contributor

Hi @hflsdupont
We are looking into this issue. The short story is that pause and resume have some unintended consequences on synchronization. If you avoid pause and resume I believe you will get the frames in correct sequence, but processing is likely to cause frame drops. One idea (I still need to test) is decreasing playback speed.

@hflsdupont
Copy link
Author

Hi @dorodnic
Thank you for the quick reply. I noticed playback.set_real_time() has similar functions as calling pause and resume, but it doesn't work for me as well. I'll try decreasing playback speed.

@dorodnic
Copy link
Contributor

Hi @hflsdupont
Sorry for long delay. We believe this should be now resolved (since 2.16.1 release).
Do you need additional support on this issue?

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

3 participants