Items with no label
3335 Discussions

Manual Exposure Modification d415

NTELE
Beginner
2,638 Views

Currently using librealsense2 (c++ variant) to manually modify the exposure on the d415's rgb sensor.

I first disable automatic exposure with " sensor.set_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, false); "

Next I set a new exposure value using " sensor.set_option(RS2_OPTION_EXPOSURE, new_exposure); "

Prior to every exposure increment I retrieve its current value with "sensor.get_option(RS2_OPTION_EXPOSURE); "

My issue is that it doesn't seem to take incremental steps of 39 as the sensor option range would suggest. Instead I find the exposure value will remain constant for a few increments and then will suddenly double.

The larger the exposure the more increments it takes for the current value to double. If I print the current exposure (provided by the get_option function) after each supposed increment by 39, it yields the resulting output.

Anyone have any ideas regarding what I could be doing incorrectly when attempting to update this value?

0 Kudos
4 Replies
MartyG
Honored Contributor III
690 Views

How I approach such an increment in my own programming is to set a base value then increment tha, so that when the value is being neither incremented or subtracted then it returns to its default value.. Otherwise you can end up with the kind of multiplication that you experienced

For example, I might create a variable called ExposureValuee that represents the default value of what I am changing. So if my default exposure value was 0.5, I might say 'ExposureValue = 0.5'.

Then, I would do 'ExposureValue = ExposureValue + 0.1' to increment the exposure or 'ExposureValue = ExposureValue - 0.1' to reduce it back down. If the exposure is set to be whatever the value of ExposureValue is then it should linearly increase and decrease exposure by a consistent amount instead of multiplying it.

By using Variable = Variable + or Variable = Variable - (instead of just Variable =), you are preserving the baseline default value.

0 Kudos
NTELE
Beginner
690 Views

Just to clarify my issue. I already use the method of "current_exposure = current_exposure + offset_value; or current_exposure = current_exposure - offset_value; " and have no problems actually getting a linear increment in my exposure value variable. If I print the output of the parameter I am passing into " sensor.set_option(RS2_OPTION_EXPOSURE, current_exposure); " I get a nice linear increment as show in the image below. The previous image was calls to "sensor.get_option(RS2_OPTION_EXPOSURE)" that followed each supposed change in exposure value with sensor.set_option(RS2_OPTION_EXPOSURE, current_exposure); " I have also confirmed with a debugger that the parameter I am passing in is being scaled properly.

My issue is that the rgb sensor, specifically, will not change its exposure value to the one I pass in. Instead I get the strange doubling in exposure value after several consecutive calls to " sensor.set_option(RS2_OPTION_EXPOSURE, current_exposure); " each with a parameter 39 larger than the last.

To further clarify. I am only having this issue on the rgb sensor. If I use the exact same method and only change the sensor from rgb to ir, it works perfectly.

0 Kudos
idata
Employee
690 Views

Hello ibbme2018,

 

 

We have submitted this issue to the RealSense engineering team for further investigation. We will respond to this thread when we get a response.

 

 

Regards,

 

Jesus

 

Intel Customer Support
0 Kudos
idata
Employee
690 Views

Hello @ibbme2018,

 

 

This is caused by the way Windows DirectShow sets the camera control exposure values. The RealSense SDK uses the DirectShow interface for camera control in Windows. According to this article (https://docs.microsoft.com/en-us/windows-hardware/drivers/stream/ksproperty-cameracontrol-exposure https://docs.microsoft.com/en-us/windows-hardware/drivers/stream/ksproperty-cameracontrol-exposure), the

KSPROPERTY_CAMERACONTROL_EXPOSURE values range from n=-7 to 0, which is translated to seconds using 2^n. This means that the exposure times take on these values depending on the values for n.

n

milliseconds

-8

39.0625

-7

78.125

-6

156.25

-5

312.5

-4

625

-3

1250

-2

2500

-1

5000

0

10000

This explains the doubling effect in Windows.

The SDK allows for more granular controls of 39 ms steps but DirectShow does not allow this so it rounds to the nearest Directshow step.

You will not see this phenomenon in Linux. In Linux, you get the 39 ms granularity from the RealSense SDK.

 

 

Regards,

 

Jesus G.

 

Intel Customer Support
0 Kudos
Reply