You can configure the stream at a script's start-up with the cfg_emable-stream instruction. An example script is linked to below.
Taking a line from that script and breaking it down to explain it:
cfg.enable_stream(RS2_STREAM_COLOR, 640, 480, RS2_FORMAT_BGR8, 30);
This refers to the type of stream that you want to set up. If you want to use a depth stream, change this command to RS"_STREAM_DEPTH. If you want an infrared stream, change it to RS"_STREAM_INFRARED
The two numbers after the RS2_STREAM instruction refer to the resolution. So if you wanted to set it to 1080x720 for example, you would change 640,480 in the script to 1080,720
In this section, you are setting the pixel format that you want to use in your stream. The link below has a script with a list of image formats on lines 54 to 74.
Finally, the number at the end of the line defines the frame rate that you want the stream to use. Change it to the value appropriate for the resolution and stream type that you are using.
I have attempted to use this function in conjunction with the multicam sample. However, since my project relies on the multicam sample's device container functions, I'm wondering if/how an enabled stream could be treated like an rs2::device and added to the '_devices' map using _devices.emplace(). I would like to continue using sample functions such as render_textures(), poll_frames(), etc. But I would first need to add the enabled stream to '_devices' or drastically change the structure of the sample.
Is it possible to change the default stream given to a device before or after the _devices.emplace() function is called? I would like to know where the c.enable_device() function associates a device with a default stream, so that I could optimize that stream.
I've done this. You're going to want to look at the rs2::config class.
Generally speaking, I find the C++ RS2 API to be rather obfuscated, and too much of their 'realsense-viewer' app's functionality has trickled down into the API. I recommend looking at the C API first, then working your way back through the mess that is the C++ API.
Thanks, @SMM77. Could you specify what your approach was? Were you enabling a stream (using the first overload of config::enable_stream) and somehow adding it to the _devices map? Or were you modifying the existing streams of already-enabled devices from within the sample's device_container::enable_device() function?
This message was posted on behalf of Intel Corporation
Our engineering team says that inserting
should do the trick.
Intel Customer Support