|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Colour Recognition
well, just to point you in the right direction,
Spoiler for not the most efficient algorithm, but one of the simplest:
I don't use LabView, and I'm not good a image processing, so I'll be of little help with that, but I'd be surprised if there wasn't some pre-written library with a function, or whatever LV calls it, that can tell you if a certain color appears in an image. Last edited by PAR_WIG1350 : 05-05-2012 at 19:45. |
|
#2
|
|||||
|
|||||
|
Re: Colour Recognition
Others will fill in the details, here's the "big picture" version:
To follow a line, you look down with 3 sensors (one left, one center, and one right). If the center sensor "sees" the line, you go forward. If the left sensor "sees" the line, you turn left (towards the line). Right sensor, same thing. OK, now let's say you must follow the RED line and ignore all the others. You make your sensor able to tell the difference, and just do what I wrote above. Now, instead of 3 sensors, you have a color camera. The 'follow' part just analyzes the camera image, and if the 'line' is to the left, you turn left (towards the line) until it's centered...then go forward. If it's a RED line, then you just "look" at red. The color part is actually pretty easy. A color camera gives you four 'channels' of information, red, green, blue and luminance (think 'brightness'). These can be separated and analyzed separately in software. The 'follow' thing is a tiny bit harder, but basically you identify the "blob" representing the line, and do some math to find the center of the blob. The center will be either left, right or center.... get it? (By the way, you only have to evaluate the 'blob' along a horizontal line, not the full height of the camera image - that makes it a lot easier, since it is in one dimension and not 2) I hope this helps you understand the concepts behind what you are trying to do. Of course, you can get really crazy and follow the "thin" line, or the double yellow, or look ahead and anticipate the next turn, or... But let's get the basics down, then you can run wild with the cool-factor stuff. Don |
|
#3
|
|||
|
|||
|
Re: Colour Recognition
Thanks for the response, I read a few other tutorials and I understand the concept now, I just need to know how to technically program it.
I can find examples of what I need but none of them have notes. could some one break down the major part of a colour reading program and tell me what each part does? |
|
#4
|
|||||
|
|||||
|
Re: Colour Recognition
Do you have access to the 2012 LabVIEW software package for FRC teams? There's a vision assistant program included. It lets you plug together various functions for detecting and analyzing colors and objects.
What camera are you using? How are the four motors connected to the four wheels, and what sort of wheels are they? |
|
#5
|
|||
|
|||
|
Re: Colour Recognition
Yes I do have access to the 2012 frc package according to my teacher. Ill try to find it.
The cameras are Axis M1031-W with a ring of lights around the lens. On the bot Im working on there is one motor for each wheel (mechanome I belive was the phrase my teacher used) and the wheels are "omni-wheels" (I dont know if thats a technical term or a class nic name) If thats a problem there is another robot I could use that has a pair of motors for a pair of wheels and has traditional wheels. EDIT: Found the example, trying to make sense of it. Last edited by reidmc : 08-05-2012 at 12:54. |
|
#6
|
|||||
|
|||||
|
Re: Colour Recognition
You're in luck. The WPI function libraries for FRC support the Axis camera communication protocol. You'll have to follow the documentation for setting everything up properly before it will work; look here and find the section dealing with the camera. You should be able to use the Vision Assistant to play with image processing and figure out a sequence of steps to find the color you want to follow.
The 2012 Vision Whitepaper posted on the firstforge site might be helpful. Your drivebase sounds like a mecanum setup, with diagonal rollers on otherwise conventionally-mounted wheels. It's capable of moving in any direction at any time, either while facing in a constant direction or while turning. Again, you're in luck. The FRC libraries support mecanum drive directly. Just supply a number from -1 to 1 to control how quickly it moves forward or reverse, another number from -1 to 1 to control how quickly it moves left or right, and yet another number to control how quickly it spins counterclockwise or clockwise. |
|
#7
|
|||
|
|||
|
Re: Colour Recognition
Thanks for the help, I tnink I can manage from here but Ill post if I hit another roadblock.
|
|
#8
|
|||||
|
|||||
|
Re: Colour Recognition
We'd all love to hear how you made out, once you're done.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|