Go to Post It's always better to figure out why a design actually works and the best ways to implement it than to just assume upgrading to a "better" material will make everything work. - Cory [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-02-2013, 15:19
Gmercer Gmercer is offline
Registered User
None #1631
 
Join Date: Jan 2013
Location: Las Vegas
Posts: 15
Gmercer is an unknown quantity at this point
My auto aim system depends on specific lighting, how to fix?

I just recently finished my auto aim system for the robot(written in java). My problem comes in with lighting, i wrote my auto aim system to catch reflective tape values and cull all other values and place into a binary file. I had expected everything to work perfectly when we brought it over to another school for testing, until i realized lighting is a huge factor in my code. The brighter lighting at the school caused my auto aim system to completely fail, no matter where i was.


How can i remove the 'lighting' factor from my auto aim function? I would want the function to work the same regardless of lighting of the room. Thanks!
  #2   Spotlight this post!  
Unread 18-02-2013, 15:24
Tom Line's Avatar
Tom Line Tom Line is offline
Raptors can't turn doorknobs.
FRC #1718 (The Fighting Pi)
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1999
Location: Armada, Michigan
Posts: 2,521
Tom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond reputeTom Line has a reputation beyond repute
Re: My auto aim system depends on specific lighting, how to fix?

The short answer is that you can't. You can minimize the effect by overexposing your camera so that the view is quite dark all the time. Do that by shining a bright light into your camera while in the http interface and setting it to hold those values.

That is why some regionals will give teams time on the field to calibrate to the lighting on the field. Unfortunately, you'll find that even the lighting differences between the opposite ends of the field can create problems.

In my experience, different lighting at different locales is about 90% of the problems most teams experience with vision.
  #3   Spotlight this post!  
Unread 18-02-2013, 16:30
fb39ca4 fb39ca4 is offline
Registered User
FRC #1899
 
Join Date: Jan 2012
Location: Bellevue, WA
Posts: 195
fb39ca4 is a name known to allfb39ca4 is a name known to allfb39ca4 is a name known to allfb39ca4 is a name known to allfb39ca4 is a name known to allfb39ca4 is a name known to all
Re: My auto aim system depends on specific lighting, how to fix?

You can try adaptive rather than global thresholding.

http://homepages.inf.ed.ac.uk/rbf/HIPR2/adpthrsh.htm
  #4   Spotlight this post!  
Unread 18-02-2013, 16:31
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: My auto aim system depends on specific lighting, how to fix?

Setting both the exposure and white balance to hold values should minimize variations between different lighting situations. It's not something that can be eliminated entirely though.
__________________
I code stuff.
  #5   Spotlight this post!  
Unread 18-02-2013, 16:41
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: My auto aim system depends on specific lighting, how to fix?

Some random vision tips:

-You really need a light on the robot to see the retroreflective tape. It has to be fairly bright and/or focused, and you have to know the color (the exact color is not important)

-You would then cal the thresholds around the color of the light, and overexpose the image to adjust the auto-exposure then hold.

-Do you really need vision?
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #6   Spotlight this post!  
Unread 21-02-2013, 19:43
pickle27 pickle27 is offline
Registered User
FRC #2809 (KBotics)
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Canada
Posts: 7
pickle27 is on a distinguished road
Re: My auto aim system depends on specific lighting, how to fix?

Hey I had this issue last year and I did two things, first last year we had our vision system save images from the field so we could tune in between matches. Then this season we built a vision system that doesn't rely on absolute thresholds.

The full source code is here:
https://github.com/KBotics/2809_vision2013

and I wrote an explanation on my website:
http://kevinhughes.ca/2013/02/21/frc...vision-system/
  #7   Spotlight this post!  
Unread 22-02-2013, 20:25
F22Rapture's Avatar
F22Rapture F22Rapture is offline
College Student, Mentor
AKA: Daniel A
FRC #3737 (4H Rotoraptors)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Goldsboro, NC
Posts: 476
F22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant futureF22Rapture has a brilliant future
Re: My auto aim system depends on specific lighting, how to fix?

Is it better to have a colored LED array, or is white sufficient?
__________________
Research is what I’m doing when I don’t know what I’m doing.
- Wernher von Braun
Attending: Raleigh NC Regional
  #8   Spotlight this post!  
Unread 22-02-2013, 20:52
Ginto8's Avatar
Ginto8 Ginto8 is offline
Programming Lead
AKA: Joe Doyle
FRC #2729 (Storm)
Team Role: Programmer
 
Join Date: Oct 2010
Rookie Year: 2010
Location: Marlton, NJ
Posts: 174
Ginto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of lightGinto8 is a glorious beacon of light
Re: My auto aim system depends on specific lighting, how to fix?

Quote:
Originally Posted by F22Rapture View Post
Is it better to have a colored LED array, or is white sufficient?
Both will show up in the image just as well, but white is a very common color; fluorescent lights, sunlight, etc. will add noise that can't be eliminated by thresholding. Vivid green, on the other hand, rarely appears with very high saturation values except when a green light bounces off a reflective surface.
__________________
I code stuff.
  #9   Spotlight this post!  
Unread 22-02-2013, 21:15
Mk.32's Avatar
Mk.32 Mk.32 is offline
Registered User
AKA: Mark
FRC #2485 (W.A.R. Lords)
Team Role: Engineer
 
Join Date: Jan 2011
Rookie Year: 2011
Location: San Diego
Posts: 770
Mk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud ofMk.32 has much to be proud of
Re: My auto aim system depends on specific lighting, how to fix?

Quote:
Originally Posted by apalrd View Post
-Do you really need vision?
+1000
__________________
Engineering mentor: Team 2485: WARLords 2013-

Team President: Team 3647 2010-2013
  #10   Spotlight this post!  
Unread 23-02-2013, 09:17
Greg McKaskle Greg McKaskle is offline
Registered User
FRC #2468 (Team NI & Appreciate)
 
Join Date: Apr 2008
Rookie Year: 2008
Location: Austin, TX
Posts: 4,751
Greg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond reputeGreg McKaskle has a reputation beyond repute
Re: My auto aim system depends on specific lighting, how to fix?

As mentioned earlier, the camera defaults to use adaptive exposure and white balance. While useful for some situations, when you want to ignore most of the light except for what you are providing, I'd recommend calibrating the camera and turning off the adaptive options.

You can control this in code or from the web page. I'd recommend logging into the camera web page, setting the color to Fluorescent 1 or another fixed setting, and for the exposure, expose the camera to a bright light for a few seconds, then set it to hold. Feel free to look at other camera settings.

This should help a lot. Feel free to post photos of what the camera is taking with the ring light and we may be able to help more. Also, it is important to use multiple criteria for selecting the target. If you use a single measurement it will be far less tolerant of noise. Two measurement areas covered in the white paper are shape and color/brightness.

White light is much more common, so most of the work will fall to shape measurements. If you can use a colored LED ring, that won't guarantee uniqueness, so I wouldn't eliminate shape, but you will typically have far fewer elements to consider.

Greg McKaskle

Last edited by Greg McKaskle : 23-02-2013 at 09:17. Reason: spelling
  #11   Spotlight this post!  
Unread 11-03-2013, 18:38
tp2357 tp2357 is offline
Registered User
AKA: Tyler Pawlaczyk
FRC #0340 (Greater Rochester Robotics)
Team Role: Programmer
 
Join Date: Mar 2012
Rookie Year: 2011
Location: North Chili, NY
Posts: 5
tp2357 is an unknown quantity at this point
Re: My auto aim system depends on specific lighting, how to fix?

Something else that might help is changing the color representation from Red-Green-Blue (or Blue-Green-Red, if you're an OpenCV user) to Hue-Saturation-Value.

Thinking about it geometrically, RGB (or BGR) maps colors as a cube, with the corner on the origin being black, and the corner opposite diagonal from it being white. HSV, on the other hand, plots colors as a Cylinder. With Hue (the type of color, i.e. red, green, blue) being a value rotated around the centre of the cylinder, and saturation ranges, on has a color as it appears in all lights. If you set a wide range for the value (how light or dark the color is i.e. how close the image is to being black) you have a more light-difference representations of the colors that you're looking for. Just be sure that you convert back to your original color representation notation, or you'll run into problems there.

I hope this helps, i'd be more than willing to answer any questions you may have on top of this.
__________________
Java, Embedded C and LISP.
  #12   Spotlight this post!  
Unread 12-03-2013, 09:36
techkid86's Avatar
techkid86 techkid86 is offline
Magic Programer
FRC #3044 (0xBE4)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: ballston spa
Posts: 58
techkid86 is an unknown quantity at this point
Re: My auto aim system depends on specific lighting, how to fix?

what we have learned from our vision experience is that it is a luxury. if you don't really need it, you should not use it.

But on the other hand, if you do need it:

1: Calibrate all settings before the match during your time on the field. this includes white balance, exposure, and all values previously mentioned.

2: Find your threshold. the broader it is, the more it recognizes. If you have a vivid green LED as mentioned earlier, you can have a reasonably large threshold. ((I don’t know values off hand... sorry)), just note the larger the threshold, the more it sees.

3: if you are having issues, you may wish to work on some filtering. We have found that many little specs appear in our binary image, so we made a size filter.

PM me, or add me on skype if you have one. My team and I would be more than happy to help with anything we can.
__________________
"you can build a perfect machine out of imperfect parts" -Urza
  #13   Spotlight this post!  
Unread 13-03-2013, 04:01
faust1706's Avatar
faust1706 faust1706 is offline
Registered User
FRC #1706 (Ratchet Rockers)
Team Role: College Student
 
Join Date: Apr 2012
Rookie Year: 2011
Location: St Louis
Posts: 498
faust1706 is infamous around these partsfaust1706 is infamous around these parts
Re: My auto aim system depends on specific lighting, how to fix?

I use ir lights with the kinect, 25 ir leds to be exact. Then threshold. Works beautifully.
__________________
"You're a gentleman," they used to say to him. "You shouldn't have gone murdering people with a hatchet; that's no occupation for a gentleman."
Closed Thread


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 03:07.

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