Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Programming (http://www.chiefdelphi.com/forums/forumdisplay.php?f=51)
-   -   USB MS Lifecam HD 3000 Exposure Issues (http://www.chiefdelphi.com/forums/showthread.php?t=145829)

techhelpbb 18-03-2016 15:51

Re: USB MS Lifecam HD 3000 Exposure Issues
 
Quote:

Originally Posted by billbo911 (Post 1559462)
Because of this thread, and because I had some time to kill, I pulled out my RPi 2 and tried a few tests to see what I could figure out for the LifeCam HD-3000 and adjusting exposure.

The first step was to see if
Code:

V4l2-ctl -L
would list out a setting for exposure. Sure enough it does. You can set it to manual or Aperture Priority mode (auto).
When in manual mode, you need to set the exposure value with exposure_absolute. The range of values it reports as acceptable are: min=5, max=20000.

In testing I found that it still had what amounted to a binary response to inputs while in manual. Any value above 5 resulted in over exposure. 5 resulted in under exposure. It didn't matter if I used anything from 6 to 20000, it was over exposed. 5 resulted in under exposure.

So now the next test is, can we set it to an exposure_absolute=5 and have a bright enough light shine on the target to get acceptable tracking of the target? (Enter the 3 X 3w LED ring).:cool:

It's interesting the newer camera at least announces the range as higher. The older Microsoft camera, still with the OmniVision sensor, did not even manage that at the V4L stack layer. Still basically the same issue. Will try to grab one of my mothballed older Microsoft cameras and the dig up the contact information for the V4L project maintainer. I can also put mine on a Raspberry Pi 2 which I assume Bilbo has Raspbian on: or did you go the Arch route?

billbo911 18-03-2016 15:56

Re: USB MS Lifecam HD 3000 Exposure Issues
 
Quote:

Originally Posted by techhelpbb (Post 1559465)
It's interesting the newer camera at least announces the range as higher. The older Microsoft camera, still with the OmniVision sensor, did not even manage that at the V4L stack layer. Still basically the same issue. Will try to grab one of my mothballed older Microsoft cameras and the dig up the contact information for the V4L project maintainer. I can also put mine on a Raspberry Pi 2 which I assume Bill has Raspbian on: or did you go the Arch route?

Latest Raspbian and OpenCV 2.4.9.

ahartnet 18-03-2016 16:49

Re: USB MS Lifecam HD 3000 Exposure Issues
 
I think there's something more going on. Using the Microsoft lifecam software you can get varying exposure with out it appearing so binary.

But I don't have more to contribute than that. One option we've considered is running a monitor/keyboard with the Kangaroo and having settings for the lifecam set on that. As long as the lifecam doesn't get power cycled, it maintains its exposure and brightness settings.

techhelpbb 18-03-2016 17:31

Re: USB MS Lifecam HD 3000 Exposure Issues
 
Quote:

Originally Posted by ahartnet (Post 1559490)
I think there's something more going on. Using the Microsoft lifecam software you can get varying exposure with out it appearing so binary.

But I don't have more to contribute than that. One option we've considered is running a monitor/keyboard with the Kangaroo and having settings for the lifecam set on that. As long as the lifecam doesn't get power cycled, it maintains its exposure and brightness settings.

Correct - the Windows drivers for the Microsoft USB cameras know how to configure the Microsoft hardware correctly. So on a Kangaroo running Windows it is likely no issue.

Much like this custom driver for the PS3 Eye:
https://codelaboratories.com/products/eye/driver/

However most of the video capture related software in use on the Linux RoboRIO depend on V4L's ability to configure said cameras (GRIP uses OpenCV which uses V4L). As Billbo911 has demonstrated above - on a bunch of models of the Microsoft cameras it doesn't work like you would expect. The V4L project is the core common solution to USB webcam support for Linux systems. If that doesn't work for a particular camera it either needs to be addressed there or a lot of development work would need to happen to create another framework unique to a camera. Course a brighter light or tinted lens as a hack works as well.

billbo911 18-03-2016 17:46

Re: USB MS Lifecam HD 3000 Exposure Issues
 
Quote:

Originally Posted by techhelpbb (Post 1559505)
...

Much like this custom driver for the PS3 Eye:
https://codelaboratories.com/products/eye/driver/...

Interesting that you should mention this specific camera. I was playing around with mine just today as well. I wanted to see if it was recognized natively by Raspbian, and it was. It has more configuration options accessible via V4L than the MS LifeCam does. That said, the image is much noisier than I would ever want to use. I will try to do some additional testing with it and see if the noise is an issue or not. Currently it is just another option for us, but it is somewhat on hold until we compete next weekend. Depending on the outcome of that tournament, I may spend a bit more time on it.

techhelpbb 18-03-2016 17:54

Re: USB MS Lifecam HD 3000 Exposure Issues
 
Quote:

Originally Posted by billbo911 (Post 1559513)
Interesting that you should mention this specific camera. I was playing around with mine just today as well. I wanted to see if it was recognized natively by Raspbian, and it was. It has more configuration options accessible via V4L than the MS LifeCam does. That said, the image is much noisier than I would ever want to use. I will try to do some additional testing with it and see if the noise is an issue or not. Currently it is just another option for us, but it is somewhat on hold until we compete next weekend. Depending on the outcome of that tournament, I may spend a bit more time on it.

You have to play with the settings. We always had a lot of noise until we optimized and, at least in the Java code from years ago, we worked out some crazy tricks that made the noise mostly irrelevant. Those tricks were possible because we did not use OpenCV.

teku14 18-03-2016 19:13

Re: USB MS Lifecam HD 3000 Exposure Issues
 
Quote:

Originally Posted by ahartnet (Post 1559432)
Please see the thread here: http://www.chiefdelphi.com/forums/sh...d.php?t=142633 (or other posts by robert1356).

Basically, you are not doing anything wrong, there's a problem in the USBCamera class that prevents it from working correctly. You might be able to copy and modify the existing class, but it sends a value between 0-100 when it should be something much greater.

We're a labview team XD. But thanks anyway though.


To the person that recommended that we the lifecam software to set exposure, what software did you mean and where can we get it?

techhelpbb 20-03-2016 15:52

Re: USB MS Lifecam HD 3000 Exposure Issues
 
Running late and my Raspbian SD card is acting up...
So I put my ODroid XU4 with MATE on one of the older Microsoft LifeCam VX-6000 cameras I have.

My 'uname -a' on there is as below:
Code:

Linux odroid 3.10.92-71 #1 SMP PREEMPT Fri Dec 18 00:38:54 BRST 2015 armv7l armv7l armv7l GNU/Linux
The camera reports:
Code:

v4l2-ctl -l

User Controls

                    brightness (int)    : min=0 max=255 step=1 default=127 value=127 flags=slider
                      contrast (int)    : min=0 max=255 step=1 default=127 value=127 flags=slider
                    saturation (int)    : min=0 max=255 step=1 default=127 value=127 flags=slider
                            hue (int)    : min=-180 max=180 step=1 default=0 value=0 flags=slider
                    red_balance (int)    : min=0 max=127 step=1 default=40 value=40 flags=slider
                  blue_balance (int)    : min=0 max=127 step=1 default=40 value=40 flags=slider
                          gamma (int)    : min=0 max=255 step=1 default=16 value=16 flags=slider
                      exposure (int)    : min=0 max=6016 step=1 default=51 value=51 flags=inactive
                gain_automatic (bool)  : default=1 value=1 flags=update
                          gain (int)    : min=0 max=28 step=1 default=0 value=0
                horizontal_flip (bool)  : default=0 value=0
                  vertical_flip (bool)  : default=0 value=0

JPEG Compression Controls

            compression_quality (int)    : min=50 max=90 step=1 default=80 value=80
                    brightness (int)    : min=0 max=255 step=1 default=127 value=127 flags=slider
                      contrast (int)    : min=0 max=255 step=1 default=127 value=127 flags=slider
                    saturation (int)    : min=0 max=255 step=1 default=127 value=127 flags=slider
                            hue (int)    : min=-180 max=180 step=1 default=0 value=0 flags=slider
                    red_balance (int)    : min=0 max=127 step=1 default=40 value=40 flags=slider
                  blue_balance (int)    : min=0 max=127 step=1 default=40 value=40 flags=slider
                          gamma (int)    : min=0 max=255 step=1 default=16 value=16 flags=slider
                      exposure (int)    : min=0 max=6016 step=1 default=51 value=51 flags=inactive
                gain_automatic (bool)  : default=1 value=1 flags=update
                          gain (int)    : min=0 max=28 step=1 default=0 value=0
                horizontal_flip (bool)  : default=0 value=0
                  vertical_flip (bool)  : default=0 value=0
root@odroid:/home/odroid# v4l2-ctl --set-ctrl gain_automatic=0

When first plugged in or the system rebooted the image is too dark.
These series of commands fixed it for me:

Code:

v4l2-ctl --set-ctrl gain_automatic=0
v4l2-ctl --set-ctrl gain=10

This differs from our experience several years ago on Ubuntu Karmic.
The ranges are now reasonable for this older camera.
I will order the LifeCam 3000 HD to experiment further.

Below are the options from V4L presented for the Logitech C920 on the same embedded system:

Code:

v4l2-ctl -l

                    brightness (int)    : min=0 max=255 step=1 default=128 value=128
                      contrast (int)    : min=0 max=255 step=1 default=128 value=128
                    saturation (int)    : min=0 max=255 step=1 default=128 value=128
 white_balance_temperature_auto (bool)  : default=1 value=1
                          gain (int)    : min=0 max=255 step=1 default=0 value=0
          power_line_frequency (menu)  : min=0 max=2 default=2 value=2
      white_balance_temperature (int)    : min=2000 max=6500 step=1 default=4000 value=2397 flags=inactive
                      sharpness (int)    : min=0 max=255 step=1 default=128 value=128
        backlight_compensation (int)    : min=0 max=1 step=1 default=0 value=0
                  exposure_auto (menu)  : min=0 max=3 default=3 value=3
              exposure_absolute (int)    : min=3 max=2047 step=1 default=250 value=250 flags=inactive
        exposure_auto_priority (bool)  : default=0 value=1
                  pan_absolute (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                  tilt_absolute (int)    : min=-36000 max=36000 step=3600 default=0 value=0
                focus_absolute (int)    : min=0 max=250 step=5 default=0 value=0 flags=inactive
                    focus_auto (bool)  : default=1 value=1
                  zoom_absolute (int)    : min=100 max=500 step=1 default=100 value=100
                      led1_mode (menu)  : min=0 max=3 default=0 value=3
                led1_frequency (int)    : min=0 max=255 step=1 default=0 value=0
                    brightness (int)    : min=0 max=255 step=1 default=128 value=128
                      contrast (int)    : min=0 max=255 step=1 default=128 value=128
                    saturation (int)    : min=0 max=255 step=1 default=128 value=128
 white_balance_temperature_auto (bool)  : default=1 value=1
                          gain (int)    : min=0 max=255 step=1 default=0 value=0
          power_line_frequency (menu)  : min=0 max=2 default=2 value=2
      white_balance_temperature (int)    : min=2000 max=6500 step=1 default=4000 value=2397 flags=inactive
                      sharpness (int)    : min=0 max=255 step=1 default=128 value=128
        backlight_compensation (int)    : min=0 max=1 step=1 default=0 value=0


adciv 21-03-2016 20:02

Re: USB MS Lifecam HD 3000 Exposure Issues
 
Quote:

Originally Posted by EthanJF123 (Post 1558528)
After several weeks of adjusting and playing with calibrations, I have found that the lifecam's exposure seems to be binary. What we are using is a USB MS Lifecam HD 3000 on Labview with NI Vision example code, and we are using a green LED to try to track the target. In the code I am setting the exposure by making it custom.
When I set the exposure to zero, the camera sees a green target and recognizes it properly. However, even when I change the value to one, the camera sees a white target and cannot find the target. I will change the values to go from one to one-hundred, and I cannot see any change. So, is the exposure acting binary, or am I doing something wrong?

Please see this thread here for a beta project which may meet your needs. Under this code, exposure should be either 5 or 6 from what i have seen. 5 is what we use with a brightness of approximately 185.

http://www.chiefdelphi.com/forums/sh....php?p=1560711

Greg McKaskle 22-03-2016 14:19

Re: USB MS Lifecam HD 3000 Exposure Issues
 
http://comments.gmane.org/gmane.linu...uvc.devel/5717

This is from 2011, and for a slightly different camera, but it seems like this is how MS built their UVC descriptor. The WPILib wrapper turns all properties into a percentage, so these sorta-geometric scalings will be even more difficult to specify, but apparently there are special numbers that set exposure.

Greg McKaskle

techhelpbb 27-03-2016 22:04

Re: USB MS Lifecam HD 3000 Exposure Issues
 
I finally had a chance to put the PS3 Eye and a Microsoft LifeCam HD-3000 on my ODroid XU4:

PS3 Eye:
Code:

v4l2-ctl -l

User Controls

                    brightness (int)    : min=0 max=255 step=1 default=0 value=0 flags=slider
                      contrast (int)    : min=0 max=255 step=1 default=32 value=32 flags=slider
                    saturation (int)    : min=0 max=255 step=1 default=64 value=64 flags=slider
                            hue (int)    : min=-90 max=90 step=1 default=0 value=0 flags=slider
        white_balance_automatic (bool)  : default=1 value=1
                      exposure (int)    : min=0 max=255 step=1 default=120 value=120 flags=inactive, volatile
                gain_automatic (bool)  : default=1 value=1 flags=update
                          gain (int)    : min=0 max=63 step=1 default=20 value=20 flags=inactive, volatile
                horizontal_flip (bool)  : default=0 value=0
                  vertical_flip (bool)  : default=0 value=0
          power_line_frequency (menu)  : min=0 max=1 default=0 value=0
                      sharpness (int)    : min=0 max=63 step=1 default=0 value=0 flags=slider

Camera Controls

                  auto_exposure (menu)  : min=0 max=1 default=0 value=0 flags=update
                    brightness (int)    : min=0 max=255 step=1 default=0 value=0 flags=slider
                      contrast (int)    : min=0 max=255 step=1 default=32 value=32 flags=slider
                    saturation (int)    : min=0 max=255 step=1 default=64 value=64 flags=slider
                            hue (int)    : min=-90 max=90 step=1 default=0 value=0 flags=slider
        white_balance_automatic (bool)  : default=1 value=1
                      exposure (int)    : min=0 max=255 step=1 default=120 value=120 flags=inactive, volatile
                gain_automatic (bool)  : default=1 value=1 flags=update
                          gain (int)    : min=0 max=63 step=1 default=20 value=20 flags=inactive, volatile
                horizontal_flip (bool)  : default=0 value=0
                  vertical_flip (bool)  : default=0 value=0
          power_line_frequency (menu)  : min=0 max=1 default=0 value=0
                      sharpness (int)    : min=0 max=63 step=1 default=0 value=0 flags=slider

Microsoft LifeCam HD-3000:

Code:

v4l2-ctl -l
                    brightness (int)    : min=30 max=255 step=1 default=133 value=133
                      contrast (int)    : min=0 max=10 step=1 default=5 value=2
                    saturation (int)    : min=0 max=200 step=1 default=83 value=83
 white_balance_temperature_auto (bool)  : default=1 value=1
          power_line_frequency (menu)  : min=0 max=2 default=2 value=2
      white_balance_temperature (int)    : min=2800 max=10000 step=1 default=4500 value=2800 flags=inactive
                      sharpness (int)    : min=0 max=50 step=1 default=25 value=0
        backlight_compensation (int)    : min=0 max=10 step=1 default=0 value=0
                  exposure_auto (menu)  : min=0 max=3 default=1 value=3
              exposure_absolute (int)    : min=5 max=20000 step=1 default=156 value=156 flags=inactive
                  pan_absolute (int)    : min=-201600 max=201600 step=3600 default=0 value=201600
                  tilt_absolute (int)    : min=-201600 max=201600 step=3600 default=0 value=0
                  zoom_absolute (int)    : min=0 max=10 step=1 default=0 value=0
                    brightness (int)    : min=30 max=255 step=1 default=133 value=133
                      contrast (int)    : min=0 max=10 step=1 default=5 value=2
                    saturation (int)    : min=0 max=200 step=1 default=83 value=83
 white_balance_temperature_auto (bool)  : default=1 value=1
          power_line_frequency (menu)  : min=0 max=2 default=2 value=2
      white_balance_temperature (int)    : min=2800 max=10000 step=1 default=4500 value=2800 flags=inactive
                      sharpness (int)    : min=0 max=50 step=1 default=25 value=0
        backlight_compensation (int)    : min=0 max=10 step=1 default=0 value=0

I have also confirmed Greg's link above with a caution:
Those values only work at normal room lighting.
If you light the room up abnormally bright - you still see some exposure control- but the camera frame rate is impacted.
Basically it's like the shutter speed on a hand held film or digital camera.
So guess what: if you put sunglasses in front of the camera lens it lowers the light level and the frame rate increases.
I played around a bit, but to be honest, I can't get to the settings from that interface to alter the camera behavior and I can in Windows.


All times are GMT -5. The time now is 00:13.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi