View Full Version : Brightness on 2016 vision samples
For all of the images we were given to test vision processing with, they all look like they were taken in a room with the lights off. Was this done with some setting on the camera? I've personally never been to an event that had the lights of, except maybe on Einstein...
Sky Captain
23-01-2016, 12:11
My team was also wondering this. The image recognition works really well with the low lighting, but in normal lighting, the recognition seems to take longer/be not as easy.
CurlyFries
23-01-2016, 13:45
I would assume that they changed the camera settings to filter out certain levels of light. There is a screensteps tutorial here.
https://wpilib.screenstepslive.com/s/4485/m/24194/l/288984-camera-settings
simon-andrews
23-01-2016, 13:50
I believe the images were taken with a low exposure setting.
Here is the Wikipedia article about exposure in photography (https://en.wikipedia.org/wiki/Exposure_%28photography%29) and an article talking about exposure with examples of overexposed and underexposed images (http://www.tested.com/tech/photography/558-underexposed-vs-overexposed-photos-which-is-worse/).
CurlyFries
23-01-2016, 13:58
I would agree. There's also a setting on the camera webpage to adjust the exposure level; the screensteps talk about that too.
Greg McKaskle
24-01-2016, 09:22
There are many ways to set up the camera and get images, but I'll list the elements using the WPILib terminology.
The retroreflective tape is such a strong reflector that you can think of it as an amplifier of the ring light. The material will return either 300 or 600 times as much light as bright white paint. I no longer remember the spec for the material being used. It is so bright that it can overwhelm the camera's sensor and auto settings and you will actually get an image with a white target and an LED colored fringe. This is called sensor bloom. Fancier camera sensors will postpone the blooming, but sufficiently bright light is a challenge.
The good news is that you can use this to your advantage. If you lower the exposure time and/or lower the brightness of the image, the background will darken and the tape will turn from white to the LED color. This also helps with processing performance, by the way, because many of the color conversion and processing algorithms will then be dealing with lots of dark pixels which they can quickly dismiss.
So FIRST did this on purpose. You can too by setting the brightness and/or the exposure settings. You may also want to turn off the auto white balance and choose something that will stay predictable.
Greg McKaskle
Ronso007
24-01-2016, 15:24
I would agree. There's also a setting on the camera webpage to adjust the exposure level; the screensteps talk about that too.
I would assume that they changed the camera settings to filter out certain levels of light. There is a screensteps tutorial here.
https://wpilib.screenstepslive.com/s/4485/m/24194/l/288984-camera-settings
There are many ways to set up the camera and get images, but I'll list the elements using the WPILib terminology.
The retroreflective tape is such a strong reflector that you can think of it as an amplifier of the ring light. The material will return either 300 or 600 times as much light as bright white paint. I no longer remember the spec for the material being used. It is so bright that it can overwhelm the camera's sensor and auto settings and you will actually get an image with a white target and an LED colored fringe. This is called sensor bloom. Fancier camera sensors will postpone the blooming, but sufficiently bright light is a challenge.
The good news is that you can use this to your advantage. If you lower the exposure time and/or lower the brightness of the image, the background will darken and the tape will turn from white to the LED color. This also helps with processing performance, by the way, because many of the color conversion and processing algorithms will then be dealing with lots of dark pixels which they can quickly dismiss.
So FIRST did this on purpose. You can too by setting the brightness and/or the exposure settings. You may also want to turn off the auto white balance and choose something that will stay predictable.
Greg McKaskle
Any idea how you change those settings with the "Lifecam 3000" Camera?
we were wondering this same thing. We looked into it and from what we can tell you can change the settings using a program however i do not think you can save the settings. Has anyone solved this issue
The FRC update for Labview has VIs for setting these. They aren't as nice as I'd like, so I've been working on reading the limits directly and developing my own.
Greg McKaskle
24-01-2016, 21:03
The WPILib Camera VIs were originally written for the Axis VAPIX API. When USB cameras were added, they were added via the NI IMAQdx libraries. About half of the properties return a "not supported" error, but some others were extended to have a custom setting.
Lately, I've been using the Vision Acquisition express block configuration. It leads through five wizard screens with a test mode to view the changes as you experiment. It then generates code for IMAQdx. Once done, I will generally right-click and Open the Front Panel which will convert it to a VI. This gives a good starting point for more advanced configuration.
To darken, you can make adjustments to exposure, gain, and brightness.
Greg McKaskle
Ronso007
25-01-2016, 11:59
The WPILib Camera VIs were originally written for the Axis VAPIX API. When USB cameras were added, they were added via the NI IMAQdx libraries. About half of the properties return a "not supported" error, but some others were extended to have a custom setting.
Lately, I've been using the Vision Acquisition express block configuration. It leads through five wizard screens with a test mode to view the changes as you experiment. It then generates code for IMAQdx. Once done, I will generally right-click and Open the Front Panel which will convert it to a VI. This gives a good starting point for more advanced configuration.
To darken, you can make adjustments to exposure, gain, and brightness.
Greg McKaskle
The FRC update for Labview has VIs for setting these. They aren't as nice as I'd like, so I've been working on reading the limits directly and developing my own.
we were wondering this same thing. We looked into it and from what we can tell you can change the settings using a program however i do not think you can save the settings. Has anyone solved this issue
Is there an easier way? we getting trouble connecting the vision acquisition to the dashboard image loop
Greg McKaskle
27-01-2016, 07:32
The camera API to an Axis camera can be remote, since it is a conversation between the laptop and the camera's web server. But the USB camera needs to have the call made on the robot, where the session was opened.
Greg McKaskle
robert1356
27-01-2016, 09:02
we were wondering this same thing. We looked into it and from what we can tell you can change the settings using a program however i do not think you can save the settings. Has anyone solved this issue
I just posted a new thread with some specifics. We are using Java, I can set the values into the USBCam object and save the values (using the Preferences class), but they don't seem to be taking effect. No change in exposure or brightness.
The Screensteps are only for the Web interface of the Axis Cam. It would be nice if there were some examples or documentation on doing these basic settings from Java or C++
robert1356
27-01-2016, 09:05
Is there an easier way? we getting trouble connecting the vision acquisition to the dashboard image loop
Ron, check the thread I just started (LifeCam USBCamera changing settings from java) - it's not about this connection, but it does contain sample code showing how to do it. Basically you create a USBCam object, open the connection, start the capture, then you loop getting and image and passing that image to the CameraServer object. It's actually pretty simple - now if I can figure out the rest, which I thought was going to be simple, but so far has not been
I apologize for not doing my homework.
The question is: Can the EXPOSURE of the USB camera be held or set manually? If it can be held will it hold through an on/off/on power cycle?
TNX
robert1356
27-01-2016, 09:24
Jonboy, In my thread, http://www.chiefdelphi.com/forums/showthread.php?t=142633, that is exactly what I am trying to do - the code is there, the methods are there, but it doesn't seem to be working.
According to the USBCamera class, there is a setExposureManual(int exp) and a setBrightness(int bright) methods, which is what I'm using. Whether they get saved across power cycles or not, I'm not sure, but I don't care because I've connected it to the SmartDashboard and using the Preferences class, it will update to whatever values I save in the preferences file.
Jonboy, In my thread, http://www.chiefdelphi.com/forums/showthread.php?t=142633, that is exactly what I am trying to do - the code is there, the methods are there, but it doesn't seem to be working.
According to the USBCamera class, there is a setExposureManual(int exp) and a setBrightness(int bright) methods, which is what I'm using. Whether they get saved across power cycles or not, I'm not sure, but I don't care because I've connected it to the SmartDashboard and using the Preferences class, it will update to whatever values I save in the preferences file.
In the past I've altered the camera settings on a LifeCam Studio through the LifeCam software. If I remember correctly the changes persisted.
https://www.microsoft.com/hardware/en-us/d/lifecam-hd-3000
Roscoe Plowbots
27-01-2016, 10:46
My team has been using NI Vision assistant and we now know how to track objects on the screen; however, we were wondering how to impliment the tracking to motor movement. We want our robot to find the target then auto adjust to score. If anyone has any code, websites, or tips for us that would be great. Thank you.
euhlmann
27-01-2016, 11:01
I apologize for not doing my homework.
The question is: Can the EXPOSURE of the USB camera be held or set manually? If it can be held will it hold through an on/off/on power cycle?
TNX
The USBCamera class is able to set exposure manually. It worked on our logitech camera.
Edit: sorry, didn't see that this was already answered.
robert1356
27-01-2016, 17:27
In the past I've altered the camera settings on a LifeCam Studio through the LifeCam software. If I remember correctly the changes persisted.
https://www.microsoft.com/hardware/en-us/d/lifecam-hd-3000
This is VERY cumbersome - it requires disconnecting the cam on the robot and connecting it to a PC, attempting to set the parameters based on venue, then saving them, then plugging back into the robot - it might be A way to do it, but certainly not optimal :/
simon-andrews
27-01-2016, 20:26
I've been setting exposure on the Lifecam from programs with v4l-utils (http://linuxtv.org/wiki/index.php/V4l-utils). You can play with exposure settings using QV4L2 on your development computer, then in your code include a call to v4l2-ctl to set your exposure:
v4l2-ctl --set-ctrl=exposure_absolute=9 --device=1
I'm working on Raspberry Pi, but since roboRIO is also Linux I'm pretty sure you will be able to install v4l-utils on it as well. Not the best solution but it works well enough.
robert1356
28-01-2016, 09:10
Has ANYONE been able to get DARK images out of the life cam, using ANY method? Images that come anywhere close to being as dark as the sample images for the FRC vision processing? I'm beginning to think that the LifeCam is simply not adjustable to that low of an exposure. I can see changes when I adjust the brightness, but exposure doesn't seem to be changing anything and even with both exposure and brightness set to minimums, the image still looks "normal" (a decent image for the average person to look at) not DARK like is needed for the image processing.
robert1356
28-01-2016, 09:37
I just confirmed it is possible - I'm running on a Mac and I just installed "Webcam Settings Panel" from the app store. It allowed me to adjust the exposure to a BLACK image. It also seems to confirm that it is not doing any of this in software, but is actually querying the camera for it's capabilities. The setting options are different between the LifeCam, my laptop iSight and my monitor's iSight, for example, the LifeCam has a backlight compensation slider while the iSights show up as simply on/off options.
I also confirmed that the settings are saved in the camera (or at least in the driver) - quit the settings panel (so I know it wasn't restoring the values) and unplugged the cam and plugged it back in and the image was the same as when I had unplugged it. This is all good news, now if I can just figure out how to use the USBCamera, NIVision.IMAQ or something on the RoboRIO to make these same adjustments, I would be happy.
robert1356
28-01-2016, 09:41
CORRECTION - I THOUGHT I had closed "Web Cam Settings" - I hadn't. IT was storing and re-storing the settings. I made sure I quit it and tested again. When I replugged the camera, it reverted to Autoexposure
Sky Captain
30-01-2016, 15:05
One of the questions my team had is, can we change the camera settings for autonomous, and have them go back to normal for teleop? We'd like to have dark picture for vision analysis, but standard colors for real time feed for complicated driving. Is this possible?
It is possible. You just need a routine to reset the camera settings again and have it run at the begining of teleop.
Greg McKaskle
31-01-2016, 09:17
You don't mention what language you are using, but the camera settings are adjusted using the WPILib camera property sets. The initialization code often has similar set calls.
Greg McKaskle
In Labview, we were able to use the stock VIs for camera control to adjust the settings of the LifeCam. In particular, settings that produced images where the target is brightly lit, but all surroundings are dark were:
Exposure 0
Brightness 20-30
We left the white balance on auto.
Where are the Vision Samples? I'd be interested to see what we should be shooting for.
Greg McKaskle
31-01-2016, 21:21
The LV examples include about 100 images. I didn't find them immediately, but I'm pretty sure they are on first forge or WPI or another public site.
Greg McKaskle
robert1356
01-02-2016, 11:21
I was finally able to get the camera to work the way I wanted it. There appears to be some issue related to calling the camera settings function too often or to close together (in time). I haven't spent the time tracking down the issue, but do have a good work around. Previously, I had in my loop, a check that if the setting changed, it would call the appropriate set setting, then immediately call the getImage() function. This would get the image, but I could never get the exposure to work. The change/workaround that makes it work is:
(This is all Java, but applies equally to C++)
- I created a separate function the when called, updates the specified setting (brightness or exposure)
- it retrieves the value from a Preferences object on the SmartDashboard.
- I added a button on the SmartDashboard to trigger this function call.
- I also added a button (and function) for setAuto and setHoldCurrentExposure (which switches to manual exposure)
- My loop now does just:
- USBCamera.getImage()
- CameraServer.setImage()
- Now when I click one of the buttons, I get exactly what I expect, the exposure or the brightness changes according to the value in the Preferences table. I can get a VERY dark image and I can get a VERY bright image or anything in between.
So for those asking about dark for autonomous and normal for teleop, you can explicitly call the settings and get the exposure/brightness you need. I think the important thing is to call them each only once in a given time period (not sure what the time period is, 100's of milli-seconds or seconds I would guess) and don't call getImage() immediately after the settings change.
I'm honestly not sure why this approach works and the other doesn't someone that knows the internals of the NIVision.IMAQ class would probably have to chime in. I don't have the time to dig into it. If someone wants the code example, let me know and I'll post it somewhere.
They are located in (from memory so I might be a little off)
C:\Program Files (x86)\National Instruments\Labview 2015\Examples\FRC\Vision\roboRIO\2016 Vision Code\Sample Images\
I may have some of those swapped but that should let you find it provided you have the FRC update installed.
vBulletin® v3.6.4, Copyright ©2000-2017, Jelsoft Enterprises Ltd.