Items with no label
3335 Discussions

set/get iso, shutter speed, aperture and ev using librealsense

ychan261
Beginner
2,985 Views
Required InfoCamera ModelR200I want to make sure how to set and get iso, shutter speed, aperture and exposure value by using librealsense.I think
  • the aperture is fixed, so we can't change.
  • iso may be the color_gain, shutter speed may be the color_exposure, how about EV, can I get this information?
0 Kudos
9 Replies
MartyG
Honored Contributor III
997 Views

Out of that set of requirements, I think all that you will be able to achieve is control over the exposure. This can be done with a Librealsense script called cpp-config-ui. Lines 378 to 397 of the script should be particularly interesting to you.

https://github.com/IntelRealSense/librealsense/blob/master/examples/cpp-config-ui.cpp librealsense/cpp-config-ui.cpp at master · IntelRealSense/librealsense · GitHub

Regarding the aperture and shutter, a developer called ddiakopoulos who seems to know what he is doing with Librealsense told somebody that "current-generation RealSense cameras are not designed to compete with the feature set of industrial vision sensors."

Having said that, the same developer did author a Librealsense script in which it seems as though the user can give priority to the shutter or the aperture using the Auto Exposure mode (see line 310 of the script).

https://travis-ci.org/IntelRealSense/librealsense/builds/103946984 Travis CI - Test and Deploy Your Code with Confidence

0 Kudos
ychan261
Beginner
997 Views

It sounds like I can't set EV +/- option to let camera to auto adjust exposure time and ISO. I can only adjust color_gain(ISO) and color_exposure(or color_enable_auto_exposure (shutter speed)), right?

0 Kudos
MartyG
Honored Contributor III
997 Views

Although Librealsense has an auto exposure function (the official RealSense SDK hasn't implemented it, but Librealsense has), you can still control exposure yourself if you need to. Manual exposure is done with the instruction RS_OPTION_R200_LR_EXPOSURE.

The Librealsense documentation says that "this control allows manual adjustment of the exposure time value for the L/R imagers". You can find Librealsense scripts that use the instruction by googling for 'RS_OPTION_R200_LR_EXPOSURE'.

Edit: I found some interesting values for the camera settings that were posted by Intel support staff member Jesus G.

0 Kudos
ychan261
Beginner
997 Views

Hi, MartyG,

I forgot to mention that I only want to use color camera now, the IR cameras are the next stage I will use. I think RS_OPTION_R200_LR_EXPOSURE is the option for the left and right IR cameras, but also thanks for your information.

0 Kudos
MartyG
Honored Contributor III
997 Views

It looks as though color camera exposure is controlled with RS_OPTION_COLOR_EXPOSURE

A script says it "controls exposure time of color camera. Setting any value will disable auto exposure";

0 Kudos
ychan261
Beginner
997 Views

Yes, I have found that too.

In fact I have mentioned it in my question "iso may be the color_gain, shutter speed may be the color_exposure", the color_gain and color_exposure are in https://github.com/IntelRealSense/librealsense/blob/master/include/librealsense/rs.hpp# L92 librealsense/rs.hpp at master · IntelRealSense/librealsense · GitHub . I'm not sure the relation, so I use "may be".

0 Kudos
MartyG
Honored Contributor III
997 Views

If you google for 'RS_OPTION_COLOR_EXPOSURE' there are only 10 search results. If you add the word 'shutter' to the search then you get just three results, which are about the 'giving priority to shutter or aperture' mode that we looked at earlier.

I would speculate that maybe you could adapt that code for manual exposure by changing the auto exposure instruction for the manual instruction. For example, adapting the auto-exposure code from earlier, you could try changing

case RS_OPTION_COLOR_ENABLE_AUTO_EXPOSURE: return set_pu(handle, subdevice, ct_unit, UVC_CT_AE_MODE_CONTROL, value ? 2 : 1); // Modes - (1: manual) (2: auto) (4: shutter priority) (8: aperture priority)

to

case RS_OPTION_COLOR_EXPOSURE: return set_pu(handle, subdevice, ct_unit, UVC_CT_AE_MODE_CONTROL, value ? 2 : 1); // Modes - (1: manual) (2: auto) (4: shutter priority) (8: aperture priority)

0 Kudos
ychan261
Beginner
997 Views

Can RealSense R200 control aperture? I think that such small lens couldn't change its aperture, just like the camera on the phone.

0 Kudos
MartyG
Honored Contributor III
997 Views

I'm not sure that the R200's physical aperture is changeable, but I did find a script for thr R200's Enhanced Photography mode that virtually simulates an aperture. You may get something useful from that code.

https://software.intel.com/en-us/articles/intel-realsense-camera-r200-enhanced-photography-code-sample RealSense - Intel® RealSense™ Camera R200 Enhanced Photography Code Sample | Intel® Software

There is also this one, under the DepthRefocus section of the RealSense documentation.

https://software.intel.com/sites/landingpage/realsense/camera-sdk/v1.1/documentation/html/index.html?apply_depthrefocus_pxcenhancedphoto.html Intel® RealSense™ SDK 2016 R2 Documentation

Although these articles are for the RealSense SDK instead of the Librealsense you are using, it does suggest strongly that the effect of changing the camera aperture is simulated with software instead of done physically.

0 Kudos
Reply