RS2_OPTION_FRAMES_QUEUE_SIZE and Frame Syncer on frame management
Hi, I have 3 questions relating to frame management.
(Q1)Is this correct way to modify queue size for each sensor from initial value 16 to custom value like this "set_sensor_option(sensors[0 or 1], RS2_OPTION_FRAMES_QUEUE_SIZE, buffersize)"?
Then, "rs2::frameset frameset = pip.wait_for_frames()" gives RGB, Depth data from the customeized queue, right?
(Q2)Are there any way to get info. about the queue status? The queue is not defined explicitly.
(Q3)It seems pip.wait_for_frames() gives syncronized RGB/Depth data. But SDK provides dev.create_syncer() function. I'd like to know the effects of create_syncer() while using D455.Should I use this function to get synchnorinzed RGB/Depth?
Thanks.
-
Hi Tsubota Kazuhiro Thanks very much for your questions.
1. Yes, you can modify the queue size using the RS2_OPTION_FRAMES_QUEUE_SIZE instruction. By default the queue can circulate 16 frames at a time for each stream type that is enabled. Frame drops can occur though if the queue size is increased to hold onto more frames.
At the link below however, a RealSense team member advises not changing the queue size with RS2_OPTION_FRAMES_QUEUE_SIZE due to the risk of breaking the streams.
https://github.com/IntelRealSense/librealsense/issues/5041#issuecomment-542241323
The recommendation is instead to use rs2::frame_queue to add latency in order to reduce frame drops by increasing the queue size. The default queue size is '1', whilst a queue size of '2' is suggested if two streams are active instead of one.
2. RS2_OPTION instructions can have their status queried and their current value printed with a C++ std::cout command. Something like this:
std::cout << "Frame queue size= " << dev.query_sensors()[0].get_option(rs2_option::RS2_OPTION_FRAMES_QUEUE_SIZE ) << std::endl;
The RealSense SDK also has an OpenCV-based tool for estimating latency.
https://github.com/IntelRealSense/librealsense/tree/master/wrappers/opencv/latency-tool
3. Information about syncer can be found here:
If you are aiming for synchronized RGB / depth though then in addition to using wait_for_frames (which attempts to find the best timestamp match between streams), instead of using syncer you could try to ensure that RGB and depth have the same FPS, as sync between the sensors should kick in when both depth and RGB have a matching FPS.
It is easier to achieve this if you have auto-exposure enabled and also disable an RGB option called Auto-Exposure Priority. When auto-exposure priority is enabled and auto-exposure priority is disabled, the SDK will attempt to enforce a constant FPS instead of permitting FPS to vary. Make sure to set the sensor's index number to '1' instead of the default of '0' so that the RGB sensor is accessed instead of the depth sensor so that auto-exposure priority can be disabled.
-
Hi MartyG thank you for your quick reply, again!
Is that right syncer could provide better combined sync data than pipeline's wait_for_frame?
I'd like to know your suggestion which is the best option.
Thanks. -
In the link below a RealSense user found that using syncer instead of pipeline did not provide an improvement, and a RealSense team member advised them that both syncer and pipeline match frames using the same logic.
-
Hi MartyG thanks for your comment. I understand pipeline is the easiest way to have the same sync effect.
So, I'll continue to use pipeline, and I'd like to know how to extend buffer size while using pipleline.
This suggest how to extend buffer size in pipeline ,but doesn't show in detail.Could I have an sample code?
Frame Buffering Management in RealSense SDK 2.0 · IntelRealSense/librealsense Wiki (github.com)
Thanks. -
Example C++ code in Intel's API How-To page at the link below, under the 'librealsense2' heading, demonstrates using rs2::frame_queue to change the queue capacity value.
https://dev.intelrealsense.com/docs/api-how-to#do-processing-on-a-background-thread
-
Thanks very much for sharing the script!
1. The link below has a C++ script for queue.poll_for_frame(&frame)) that uses depth and color.
https://github.com/IntelRealSense/librealsense/issues/4625
2. As far as I am aware, parallel processes are not required for rs2::queue
Please sign in to leave a comment.
Comments
6 comments