Go to Post Maybe I'm just a chicken. Not to disparage the ThunderChickens. Those guys are a whole different breed of poultry. - Kevin Sevcik [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 23-02-2016, 00:55
Oromus's Avatar
Oromus Oromus is offline
Lead Programmer, Community Liason
AKA: Ryan
FRC #1902 (Exploding Bacon)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2013
Location: Florida
Posts: 80
Oromus is a splendid one to beholdOromus is a splendid one to beholdOromus is a splendid one to beholdOromus is a splendid one to beholdOromus is a splendid one to beholdOromus is a splendid one to behold
OpenCV, Microsoft HD Lifecam 3000 exposure problems

Okay, so we're using vision tracking this year, since we're shooting for the high goal. We decided to use OpenCV, since we didn't want to deal with FIRST's apis or GRIP's. I wrote up some code for getting images from the camera and did some calculations, and it all works great, except for one thing. 90% of the time I go to take a picture, the entire image is incredibly bright. Have you ever pressed something up close to a webcam and pulled it back and seen the webcam get really bright for a second? Yeah, that type of bright is what we're getting. I think it may be due to how I'm getting the current image (opening the camera, getting the image, and closing the camera), and I'm not sure how to fix it. I haven't figured out how to tell the HD Lifecam to not auto-adjust it's settings, and I haven't been able to find a working alternative to getting the current image other than just turning the camera on and off. We're doing the vision processing on the RIO (I'm aware people like to do it on driver stations instead, but the RIO works fine for what we're doing), so I'd appreciate if any suggestions keep that in mind (I am, however, willing to do it on the DS if there's no other way). So, to summarize all this and put it into question form:

* How can I stop the Microsoft HD Lifecam 3000 from adjusting it's exposure/contrast/brightness/whatever automatically?

* Is there a better, alternate way, using OpenCV, to grab the current image on the camera (Camera.getImage() returns the next frame the camera saw, not the current one).

Thank you to anyone who helps out. If you can, please provide some example code, as I'm much better at understanding your suggestion/logic if at least some of it is laid out in code.
__________________


2016 Roles: Manipulator, Strategy Co-Lead, Programmer
2016 Orlando Regional: Quarterfinalist (Captain w/ 1557, 5557 and 4352)
2016 Rocket City Regional: Quarterfinalist (w/ 283 and 34), Regional Chairman's Award Winner
2016 Championship: N/A (had fun and was inspired, that's what counts)
-------------
2015 Role: Programmer
2015 GSCR: Quarterfinalist (w/ 4189 and 4026), Regional Chairman's Award Winner
2015 Orlando Regional: Semifinalist (w/ 456 and 86), Imagery Award Winner
2015 Championship: Pit Safety Award Winner

Last edited by Oromus : 23-02-2016 at 00:59.
Reply With Quote
  #2   Spotlight this post!  
Unread 23-02-2016, 02:36
pensono pensono is offline
Registered User
FRC #5495
 
Join Date: Jan 2015
Location: Snohomish, WA
Posts: 15
pensono is an unknown quantity at this point
Re: OpenCV, Microsoft HD Lifecam 3000 exposure problems

Here's what we're using to grab images from the camera. We're using OpenCV 2.4 in python, but it should translate directly to other languages.

Code:
camera = cv2.VideoCapture(0)

while(True):
    # Capture frame-by-frame
    ret, frame = camera.read()
    cv2.imshow('Raw', frame)
As for setting the exposure, you can try calling this in OpenCV:
Code:
camera.set(cv2.cv.CV_CAP_PROP_EXPOSURE,-100)
No camera's exposure goes this low, but this will set it as low as possible.

If I remember right, we had to use v4l to set the LifeCam's exposure. It wasn't too difficult to do though, we just had to add it to the same startup script that launched our python vision processing script. Here's the command:

Code:
v4l2-ctl -d /dev/video1 -c exposure_auto=1 -c exposure_absolute=5
You may need to change the video device number to 0.

In addition, we've written documentation on much of the process of setting up our vision system. The "Configure the Raspberry Pi" blog has details about how to set up the camera, and the "The Java MQTT Broker" has a section about writing startup scripts on the roboRIO (and I believe Linux systems in general... don't quote me on that)
http://5495thealuminati.wix.com/shs-...news-blog/ck6w

Our code is also available on GitHub if you wanna poke around: https://github.com/AluminatiFRC/Vision2016
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 21:37.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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