question about UVC auto exposure mode

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
FeYu_1508691
Level 3
Level 3
First like received

Hello, I have a question about the auto exposure mode setting in Windows.

According to the document, the value of auto-exposure mode control should be one of the mode,

which means it should be 0x01, 0x02, 0x04 or 0x08.

aaaaaaaaaaa.PNG

bbbbbbbbb.PNG

When in Ubuntu, I have write this part using libuvc, and everything goes well.

But when using Directshow in Windows,

the auto-exposure mode control register, exposure time (absolute) control register and exposure time (relative) control register are combined to 1 function, which is very hard to use.

KSPROPERTY\_CAMERACONTROL\_EXPOSURE - Windows drivers | Microsoft Docs

And when setting auto exposure off, PC will set an uncertain number to auto-exposure mode control register(This number is changed due to the exposure time. I have to set an exposure time because there is only 1 function to set auto mode and the manual time).

When setting auto exposure on, it does not set any number.

Using Amcap/VDM or writing code with Directshow library all went to the same result.

My code is like this:

if (valid)

{

hr = pCameraControl->Set(KSPROPERTY_CAMERACONTROL_EXPOSURE, 0, KSPROPERTY_CAMERACONTROL_FLAGS_AUTO);

}

else

{

//read current value, then set to manual

int value, flags;

hr = pCameraControl->Get(KSPROPERTY_CAMERACONTROL_EXPOSURE, (long*)&value, (long*)&flags);

hr = pCameraControl->Set(KSPROPERTY_CAMERACONTROL_EXPOSURE, value, KSPROPERTY_CAMERACONTROL_FLAGS_MANUAL);

}

Does anyone have ever meet this problem?

Thank you

0 Likes
1 Solution
FeYu_1508691
Level 3
Level 3
First like received

I have resolved this problem today.

The last time I tested, I let the firmware always return a fixed value for GET_CUR. (easy for testing)

Today I fixed the code to return the real value,

and then everything seems to be work fine.

Maybe Directshow library will do some check before setting.

View solution in original post

0 Likes
3 Replies
FeYu_1508691
Level 3
Level 3
First like received

I have resolved this problem today.

The last time I tested, I let the firmware always return a fixed value for GET_CUR. (easy for testing)

Today I fixed the code to return the real value,

and then everything seems to be work fine.

Maybe Directshow library will do some check before setting.

0 Likes
Hemanth
Moderator
Moderator
Moderator
First like given First question asked 750 replies posted

Hi,

Please provide more info about the following comments:

"And when setting auto exposure off, PC will set an uncertain number to auto-exposure mode control register(This number is changed due to the exposure time. I have to set an exposure time because there is only 1 function to set auto mode and the manual time).

When setting auto exposure on, it does not set any number."

Regards,

Hemanth

Hemanth
0 Likes

Hello,

And when setting auto exposure off, PC will set an uncertain number to auto-exposure mode control register(This number is changed due to the exposure time. I have to set an exposure time because there is only 1 function to set auto mode and the manual time).

Directshow library only has KSPROPERTY_CAMERACONTROL_EXPOSURE.

A enum like KSPROPERTY_CAMERACONTROL_AUTO_EXPOSURE_MODE is not exist.

The auto-exposure mode control, exposure time (absolute) control and exposure time (relative) control are set in 1 function.

For using auto exposure mode, there is a flag KSPROPERTY_CAMERACONTROL_FLAGS_AUTO,

which can be set like

hr = pCameraControl->Set(KSPROPERTY_CAMERACONTROL_EXPOSURE, 0, KSPROPERTY_CAMERACONTROL_FLAGS_AUTO);

(Exposure time value seems to be useless when flag is KSPROPERTY_CAMERACONTROL_FLAGS_AUTO)

So if you want to set auto exposure mode off,

you have to set an exposure time at the same time.

Meanwhile, if you want to set relative control,

KSPROPERTY_CAMERACONTROL_FLAGS_RELATIVE is needed. (default value is KSPROPERTY_CAMERACONTROL_FLAGS_ABSOLUTE)

When setting auto exposure on, it does not set any number.

It seems that pCameraControl->Set() / pCameraControl->Get() functions will check the value in the buffer before sending command to the camera.

I had set FX3 always return a fixed value for simple testing, and this may cause that set function seems not work.

I have not test others.

Now I can say that when I set FX3 return the correct status, auto exposure mode control goes fine.

0 Likes