-
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
running two cameras inspired by multicam example #10096
Comments
Hi @ilyak93 A 2 core (dual-core) i3 would probably be a low-end configuration for using two cameras simultaneously on the same computer. For example, a computing device known to be able to handle two 400 Series cameras being active at the same time is the Up Squared board, which is available in 4-core (quad core) specifications. https://up-board.org/upsquared/specifications/ If you were collecting 300 frames but only actually needed one frame, a good solution may be a multiple-camera C++ script at #2219 (comment) that was a modification of rs-multicam that captures an image simultaneously from every attached camera. If you decide to use that script, it checks for whether the name of the attached camera is D415 and so you would need to change the code in that check to D455 or remove the checking mechanism. Alternatively, another approach that is suited to short recording sessions of between 10 seconds (on a low-spec computer with modest memory) and 30 seconds (on a computer with larger memory capacity) would be to store the frames in the computer's memory with the Keep() instruction instead of writing them to file. With Keep(), you can store the entire streaming session's frames in memory and then perform batch-processing on them after closing the pipeline to initiate actions such as post-process and align and then save all the frames to file in a single save-action. Keep() is useful for use on computers that may experience bottlenecks when writing to file for reasons such as a storage drive with slow access speed. As you are using both depth and color, you may also have less 'dropped' frames if you set the frame queue size to a value of '2' instead of the default '1' to introduce latency into the pipeline. Use of Keep() and frame queue size is discussed for C++ in #10042 |
@MartyG-RealSense, thank you for your reply. For the There is an easy way for me to check whether the problem is in the fps, and it is to set it lower.
While without it. it works. What is the correct and simplest way to set the frame rate to less then 30 for each Thank you in advance. |
RS2_FORMAT_ANY is hardly ever used. Instead, a specific stream type is defined. Please try changing _ANY to a depth stream. cfg.enable_stream(RS2_STREAM_DEPTH, 1280, 720, RS2_FORMAT_Z16, 30); cfg2.enable_stream(RS2_STREAM_DEPTH, 1280, 720, RS2_FORMAT_Z16, 30); It should be noted that for the depth stream, the optimal resolution for depth accuracy on D455 is 848x480 rather than 1280x720 You could set the frame rate to a lower resolution simply by changing the '30' at the end of the bracket of the cfg instructions to a lower value. Aside from 30 FPS, '15' and '5' are also supported on D455 (the minimum FPS on D455 is 5 FPS, whereas on D435 / D415 it is 6). For example: cfg.enable_stream(RS2_STREAM_DEPTH, 1280, 720, RS2_FORMAT_Z16, 5); |
@MartyG-RealSense, thank you for your reply. About the streams, so if I need both color and depth streams, can I enable both of them that way for the same config for each serial in the following way (?):
so when my callback is called I'll iterate my |
I do not have a D465 to test with - my recollection is that it is a limited-availability RealSense hardware configuration dating back to 2019 that is not sold at retail - and so cannot test its supported resolutions myself, unfortunately. My understanding based on a Python script in #2882 is that you should be able to define pairs of cfg statements for the two separate pipelines by using the same stream definition lines but using cfg and cfg2 to distinguish between them as you did in your scripting above. |
@MartyG-RealSense, Just to make sure I've got your understanding right, you mean that this peace of code:
should produce for me both color and depth for both serials (cams), is that correct ? |
Yes, I am referring to that code. Accessing the second configuration if the list of serial numbers is greater than 1 with if(serials.size() > 1 seems to be an appropriate approach. A C++ script in the link below that selects between a set of 4 cameras also uses this approach. https://support.intelrealsense.com/hc/en-us/community/posts/360053150433/comments/360014118954 The multicam code that you have used for the two pipeline configurations looks okay to me overall too. If cfg is not defined then the default stream profile of the particular RealSense camera model that is being used is applied. |
Hi @ilyak93 Do you require further assistance with this case, please? Thanks! |
@MartyG-RealSense, we're good for now, thank you. |
You're very welcome, @ilyak93 - thanks very much for the update! |
EDIT:
Specs fix: my Camera Model is D465 and not D455 initially written. Sorry for the confusion.
All the answers were made till that point for D455.
After I managed to connect 2 realsense cameras and save frames for them in a buffer, I've noticed that my fps for both in the same amount of time dropped significantly.
For example, for 10 second of asynchronous writing of frames using callback, for each one of the cameras separately I get around 300 frames, for 30 fps it makes sense.
But when I run them simultaneously as proposed in the multi-cam example in the examples solution I get less, some times it a half for both, some times it is 250 and 200 respectively, some times even I get about 300 on the first and only few frames (like 40 or 10 or 2) on the second.
This is the code with which I run it.
I'll appreciate if the developing team could check and detect a wrong or insufficient use of the realsense SDK api or maybe a bug in the implementation or the possibility that my computer specifics cannot afford running 2 cameras with 30 fps each?
My proccessor is Intel(R) Core(TM) i3-4000M CPU @ 2.40GHz 2.39 GHz, 2 cores, 4 threads (maybe it is too weak, how can I do the calculation? I'm not a big expert).
Thank you in advance.
This is the working code:
The text was updated successfully, but these errors were encountered: