Items with no label
3338 Discussions

Using rs2_get_video_stream_resolution

MAbdo2
New Contributor I
1,928 Views

I wish to get the image sizes by calling the rs2_get_video_stream_resolution API. I am unclear as to what the 1st parameters passed in should be and how/where I would get this parameters. Any snippet of code to show to use this API is appreciated.

My code looks like this:

rs2_get_video_stream_resolution(Rs2StreamProfile,

&Width,

&Height,

NULL);

What should I put for "Rs2StreamProfile"?

Thanks,

Mo

0 Kudos
3 Replies
idata
Employee
668 Views

Hello MoA,

 

 

 

Thank you for your interest in the Intel RealSense Technology.

 

 

In regards to your query, the following sample, demonstrates how to get stream profiles for sensors: https://github.com/IntelRealSense/librealsense/blob/13f3db2d7576b06162230a3af92b502aa5a94736/examples/sensor-control/rs-sensor-control.cpp

 

 

 

You can also follow https://github.com/IntelRealSense/librealsense/blob/0040d1f21b2f6e0b9d6e6cb7153fb12acdd8796b/examples/sensor-control/api_how_to.h api_how_to.h for detailed documentation and explanations, on the following link: https://github.com/IntelRealSense/librealsense/blob/0040d1f21b2f6e0b9d6e6cb7153fb12acdd8796b/examples/sensor-control/readme.md

 

 

Let me know if this is helpful.

 

 

Regards,

 

Casandra

 

0 Kudos
MAbdo2
New Contributor I
668 Views

Thank you for the update.

Concerning the stream selection, I looked up the "how_to" section, but it really doesn't provide the solution I am looking for. I am not interested in finding out how many different stream profiles a sensor can provide ..., rather I need to the know the image resolution of whatever video stream is already selected. Think of the situation as two (2) simple steps, shown below:

Step 1 : Select the device (somehow, by index, by serial number, whatever). So, we now have our device selected

Step 2 : Find the resolution of the image that would be acquired, if the pipe starts. This is where my problem is, I just need to know what resolution an image that would be taken by the pipe would have. I just want to know the resolution of the next immediate image that pipe would produce; I really don't care about how many streams there could potentially be supported, etc. etc.

What is the best way to achieve Step 2 above?

Mo

0 Kudos
idata
Employee
668 Views

Hello MoA,

 

 

The api_how_to.h file shows how to cycle through the stream profiles for a given sensor in the function, static rs2::stream_profile choose_a_streaming_profile(const rs2::sensor& sensor). The stream_profile has a bool called stream_profile.is_default(); that will tell you if the stream_profile is the default or not. Once you have the default profile you can find out the height, width, fps. See the rest of the code in the choose_a_streaming_profile function to see how to get these parameters in lines 420 - 429.

 

 

Regards,

 

Jesus G.

 

Intel Customer Support
0 Kudos
Reply