Let's Make Robots!

Absolute Simplest Blob Detection on PC with WebCam

Hi There,

We need to know the absolute simplest way to do blob tracking using a windows pc. 

We are building a robot that seeks and collects tennis balls. Everything is working except for the ball recognition. All the PC software has to do is get the x,y coordinates of a yellow blob, and then send the appropriate signal to the COM port (we have 4 values that are sent to the comport to be interpreted by a pic micro and translated into "move forward" "move backward" "turn left" "turn right")

Because all the PC has to do is find blobs and send COM data, we don't care about what language or software package we do it in - we can figure out COM port communication in just about any language (we've done it in c# and VPL so far), we just want the simplest way of getting the x,y values of a yellow blob.

 Thanks very much!

Tennis Robot

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

I was wondering if there was a GNU driver for this to use with a laptop bot, seems all drivers I have found wont pass vars and stuff to either QB,QB64 or batch that I could then pass to basic. I seen it done with java on an EE but I desperately hate OBJoriented languages..

I dloaded the processing prog too, to see if it can or will have some source there that shows some method..

Thanks everyone for the suggestions.

With about 3 hours of work we were able to implement the Microsoft Robotics Studio color segmentation algorithm (with a few tweaks of our own.) We're now chasing tennis balls!

Thanks again! 

Perry

Try downloading processing from http://www.processing.org. there is a brightest pixel script in there that shows you how to track the brightest pixel on screen, this can easily be modified to first of all take a video feed and then to track a certain color. From there you can expand it to make out blobs. It also has a script for edge detection which should help. 
I have tried this, but i always get an error regarding some VDIG software, whenever i try and use my webcam
I will upload it to a server later on tonight for you. 

The hardest thing to deal with here is going to be background noise.

You haven't mentioned what kind of environment the ball and bot are going to be in.

If, for example, you are looking for a yellow ball in a completely blue room then it is not too hard.

 

Get the image from the web camera as a bitmap.

Read the RGB values for each pixel in the image and it becomes apparent where the ball is. Pixels for the ball have a high Red and Green count (red + green = yellow), the blue room has a high blue count.

 Average the location of the yellow pixels to get the balls location. 

  1. Train The Program (Tell it what is yellow)
  2. Look for a blob
  3. Get it's location to two variables (x,y)
  4. If x > Middle_of_View Then send 'r' to COM 5 to turn right...
    turn left if <,
    go straight if close to the middle