I’m hoping you guys can provide some guidance, as Google has yielded no results. Basically, our USB Webcam is super exposed and very bright. It is extremely hard to make out what is happening on the camera.
We are using the following to display it to SmartDashboard
So long as there isn’t a problem with the camera hardware itself, you can change the exposure through WPILib.
startAutomaticCapture() returns a UsbCamera object that you can call setExposureManual(val) on to lower the exposure yourself.
This may not be a robust solution for competition environments where lighting is not always consistent, though.
With all that said, I’d expect the default auto exposure for the lifecam to be decent. Does the same issue occur when you view the camera on some other computer?
For quickly determining what image settings to change, you can connect to the camera server using HTTP. Just open your web browser to http://roborio-TEAM-frc.local:1181/ and it will pop up a page with a live camera view and sliders/checkboxes for all of the available camera settings, including exposure and brightness. You can then use the aforementioned UsbCamera functions to make the settings permanent in your code.
There are several things to consider here. The 1st thing I would try is making sure the camera is running in fully automatic mode. Once you have determined that it is verify your brightness settings.
If that yields a normal image then you can move forward with trying things to set the exposure and brightness how you would like them. Keep in mind, the Microsoft implementation only accepts specific values for exposure. For example: 1, 2, 4, 9, 19, 20, 40 etc. These are not the actual value, but represent the odd ball order of values that will work on this camera.
I just dug through some old code and found the following comments I made on actual usable values:
# Setting manual exposure on MS LifeCam will only work with values of:
# 5, 9, 10, 19, 20, 39, 78, 156, 312, 625, 1250, 2500, 5000, 10000.
# 156 is Max value for 30FPS