-
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 specific frame by index #3121
Comments
The SDK has an instruction called set_real_time that Dorodnic the RealSense SDK Manager says should enable frames to be fetched one frameset at a time. A user came up with a sample script for frame by frame bag replay that uses set_real_time. |
Hi @amaanda |
Thanks for the quick reply! |
When recording a bag with ROS, there is the option to set the recording to automatically end a clip and start a new one after a certain period of time - a process called Split - so you end up with a number of smaller clips instead of one giant one. This may help with choosing which parts you want to keep. |
Will do that. Thank you! |
@amaanda Any other questions about this ticket? Looking forward to your update. Thanks! |
Hi, so, what I am trying to do now is: I need to access pre-recorded .bag files, do some processing and generate the .ply in a |
What I was previously trying to do was to use the timestamps in order to get only the aligned frames.
I was losing a lot of frames by doing this, and depending on the speed of the running object, I would still be getting desynchronized frames. |
@amaanda Noticed that you're testing on Windows, please refer to below link to enable metadata which might helps. |
Yes, I have already followed all the steps on that tutorial. I still get dropped frames. |
@amaanda Then could you please follow the rs-align example instead of using timestamp? |
rs-align example was my first attempt on getting the frames, and I still get the same problem |
@amaanda Could you please provide your code snippet that referring to rs-align so that we can further look into this? Thanks! |
|
I also want to get aligned infrared frames, which I believe will be done the same way it works for color frames. |
I will try using the cpp applications then. Do you think the rs-align example will also solve the frame drop problem? From what I've read on this forum, it seems to be a problem on every programming language the librealsense is implemented, inherent to the .bag format. |
@amaanda Did you try the live streaming to see if any problem? |
The live streaming looks fine. The problem is when I try saving the frames: I get around 514 depth frames and only 323 infrared frames. To export the frames I used the rs-convert cpp application. I added a flag to save only the infrared frames. I'm starting to think it is a problem when the file is recorded, inherent to the .bag format, maybe? |
The .bag file is around 17 seconds long, the viewer shows the FPS to be 30 for all channels. This means I should get roughly around 510 frames for each channel. I don't know if these infrared frames are not really there or what. |
@amaanda |
Tried using frame.keep and still got the same problem.
|
The .bag file is 11.635678 seconds long, which in a 30FPS should give around 349 frames. By running the code above I get the maximum of 228 frames per channel. |
I think it might be a problem in the python wrapper. According to this comment, it seems to work fine on c++. Is there some example using keep()? I couldn't find it. |
First of all, as python in has larger overhead in general than c++, this is
totally possible.
However, if you look at the issue you linked, you'll notice that they use
two for loops. One for calling keep and saving all the frames in memory,
and a second for accessing the frames from memory to do the actual
processing
|
@lramati Sorry, I don't see where they are using keep() on that code. |
@amaanda Is it possible for you to try C++ first? I'm afraid we need some time to check what's the problem of python wrapper. |
@RealSense-Customer-Engineering That is my next step now. If you have any tips or a project/tutorial I could take a look at, please share. |
@amaanda Sure. Will share here if I get update. Any progress for your testing with C++? Any issue there? |
@amaanda Any good news about your test with C++? Thanks! |
@RealSenseCustomerSupport sorry for taking so long, I had to focus on a few other issues that came up. I tried recording using the viewer on different PCs and apparently the trouble I was facing was due to pc performance. |
Ok. I've been running a few tests using c++ and now I only seem to have the frame dropping problem when I try recording all 4 channels provided by the realsense camera: infrared 1, 2, color and depth. So I went to check the log files of these tests and I saw the following error message: 06/03 17:55:02,363 WARNING [7936] (playback_device.cpp:198) Playback device does not provide a matcher Any guesses on what might be causing the problem, or how to solve this? |
@amaanda What's the resolution and FPS configuration when you get the warning issue for 4 channels recording? |
@RealSense-Customer-Engineering 1380x720 30fps |
@amaanda The warning should be related to the frame drops during the recording which is very possible to happen when record high resolution for several channels. The number of frames included in your .bag file can be checked with Rosbag Inspector https://github.com/IntelRealSense/librealsense/tree/master/tools/rosbag-inspector |
@amaanda Any other questions about this ticket? Looking forward to your update. Thanks! |
Not for now. Thanks! |
Hello, I am just trying to do the same thing : access any frame from a .bag file previously recorded. It is not clear for me the conclusion of this discussion and how to do it ... It seems to be about set_real_time(false) or keep() but I am not sure Does someone can provide a minimal example on how to do it in python ? |
Hi @julienguegan Yes, reading bag file frames typically involves set_real_time(false). There is another Python case that discusses indexing bag frames, with scripting provided, at the link below: |
@MartyG-RealSense thank you, I have found good ressources... But I have a problem, for reading I first get the number of frame in the .bag file :
and then I get all the frames by doing :
It gives me that I have 1080 frames to read but when displaying the images read, I realized that there is not all images from my video, and when trying to loop on more number (like 5000), I can actually read more image ... Does someone know how to have the real number of frame in my video ? did you have may be already seen this problem @MartyG-RealSense ? |
Hello,
I am currently trying to access a specific frame index from a playback .bag using the python wrapper. I need to access infrared, RGB and depth images from each frame. I am trying to do this by using the seek method, however I would prefer a better option where I could direcly access each frame by their index.
Thanks in advance!
The text was updated successfully, but these errors were encountered: