Logitech camera issue - dark image on dashboard

Hello, greetings from team 1156
We’re having trouble with our USB camera (Logitech C270 Webcam)
What happens is that our camera image on the dashboard is too dark, we tried to fix it by changing the settings in the vision processing VI’s in LabView but the image remained the same. When we connect the camera via USB to the computer, the image appears fine.

I have attached a screenshot of the camera in the dashboard.

Thanks for the help!





On the roboRIO, try manually setting the exposure. For example, in C++:

cs::UsbCamera camera;
camera = CameraServer::GetInstance()->StartAutomaticCapture();
camera.SetExposureManual(75);

We had same issue. If we would unplug the camera and replug the image to dashboard would brighten.

I believed we tried the equivalent of that in Labview, i attached a screenshot of our vision processing vi.

This happens for us too, but we wanted to make sure that the image is good when we boot the robot in the field.

thanks!


Ok. I wasn’t sure whether you were trying something on the dashboard side.

The rest of my reply will not help you directly. But in sharing some observations I made, it may help add insight that may be of some assistance.

Our team implemented computer vision on a Raspberry PI (RPI), which is Linux (Raspian), and with a LifeCam HD-3000 connected to the RPI via USB. Our camera team has had a great deal of difficulty with the frames captured on the RPI becoming increasingly over- or under-exposed the longer the camera is plugged into the RPI USB port.

The temporary solution to the RPI problem throughout build season has been to frequently unplug the camera from the RPI, wait 15-20 seconds and then plug it back in. This seemed to have the greatest adverse impact when using a particular LifeCam (one used with a green LED ring mounted around it. It does not appear that the LED ring had anything to do with the issue since the problem would also occur when we took the camera out of the mount.

I set about investigating a solution to this problem and found one that will work for our problem. Linux contains a command, v4l2-ctl, that can be typed into a terminal window. ‘vl42’ stands for Video4Linux2 Application Programming Interface (API). You can read about it here: https://lwn.net/Articles/203924/. For example, the command

v4l2-ctl -c exposure_absolute=1000

will set the exposure level of the camera.

v4l2-ctl -c brightness=100

will set the brightness. These two particular values – 1000 and 100, respectively, will produce a mid-level exposure.

The good thing about setting these values this way (i.e., from the command line) is that the values seem to stick, and the camera exposure no longer goes off the rails over time.

Note that every type of camera has its own control parameters. To find out what they are for a given camera, (and assuming that only one USB camera is connected), type the following command (on Linux):

v4l2-ctl --list-ctrls

Please note that I did not observed a similar problem for a “First Person View” (FPV) camera (also LifeCam HD-3000) running on the roboRIO itself when that image is sent to the Driver Station.

Bruno,

I’ve spent some time looking through the Vision Processing. I think I have an idea of what’s causing this but it’ll require more work to figure it out 100%.

When a session is started with the camera in the dashboard, a URL gets sent and processed by the roboRIO. The URL doesn’t include a brightness value.

Open up your robot project and use CTRL+F to search for “WPI_Camera HTTP Connection Respondervi.vi” and it should show up in your dependencies. Open this VI.

In the lower left corner of this VI, there’s a cluster constant named “Additional Settings” that has some default values. One of these values is Brightness = -1. If you’re curious, the loop just after this goes through, finds parameters, and updates that value in the cluster. As the URL doesn’t include brightness, this value is never touched and outputs as -1. Change the brightness value to 50 (or whatever brightness you desire). Save the VI. Close it out.

When you push your code, this should fix the issue where you’re seeing it quickly drop to a darker setting.

As a quick caveat, the VI you’re changing is part of the LabVIEW installation. In the unlikely event you’ve got multiple robot projects that each have a different brightness setting, you’d need to figure out another way to set this value here or to set the value after it changes. This VI will be used by all projects and use the constant value chosen here when the connection is created. After that point, it’ll take whatever values you choose to set.

As a result, updating the train track of VIs prior to the loop in Vision Processing won’t fix the issue you’re running into. Shortly after this is read, the session will be opened and override your original setting.

The CameraServer library for C++/Java (cscore) provides access to the same V4L2 settings that the v4l2-ctl command does. Functions like setExposureManual() and setBrightness() on the UsbCamera object can be used to change the camera settings. The CameraServer library also provides a webpage that can be used to tune these settings interactively.