USB Camera - Super Exposed


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


We are using the Microsoft Lifecam 3000.

Let me know what you think. Thanks

If it’s plugged right into the RIO you can use v4l if you can install it on the Rio. If its plugged into a raspberry pi you can also use v4l as I’m pretty sure it’s in the default repo

Awesome. We will have to look into that. Thanks!

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.

Fancy! That sounds a lot easier than what we were doing in 2016!

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


Tune in next week to find out the shady use cases teams have found for the Logitech HD Webcam, right here on USB Camera - Super Exposed!

Wow! You are the best, this solved our issue, thanks very much.

The CameraServer code automatically handles this for LifeCam cameras, so you can use “normal” percentage exposure values and it will pick the nearest valid raw value.