Go to Post They are "Human Dream and Inspiration Enablement Devices" but since that takes too long to say and explain I use the word "robot". - Foster [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 30-01-2010, 20:48
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
ball tracking w/ camera

Any thoughts or code on the feasibility of using the camera to detect gamepieces?
I've been using the NI Vision assistant, and I came up with two methods so far.

The first one uses the "find geometric shapes" VI to find the circle.
The second one does a color threshold, and then uses the "Find circles" VI.

It seems like the second one should be more robust, but I haven't gotten it to detect the ball yet, because it's not quite a continuous circle. I think the gray stripes wreak havoc with actually trying to represent the ball as a circle.
However, I'm worried that the first method will pick up the goal target as well.

I've uploaded both scripts, and a sample image, so you can try. (It's zipped, because Chief Delphi doesn't allow an .scr file to be uploaded)
Attached Files
File Type: zip ball tracking.zip (69.5 KB, 188 views)
__________________
-- Marshal Horn
  #2   Spotlight this post!  
Unread 30-01-2010, 23:26
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: ball tracking w/ camera

Quote:
Originally Posted by kamocat View Post
...I'm worried that the first method will pick up the goal target as well.
What if it does? If you mount your camera at an appropriate height, the balls will all be below horizontal and the targets will be above it.
  #3   Spotlight this post!  
Unread 30-01-2010, 23:34
sloteera's Avatar
sloteera sloteera is offline
Registered User
AKA: Rafa
FRC #1860 (Cephatron)
Team Role: Coach
 
Join Date: Mar 2007
Rookie Year: 2004
Location: Brazil
Posts: 190
sloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud ofsloteera has much to be proud of
Re: ball tracking w/ camera

Could you make an combination between Color Location and Find Geometric Shapes to prevent any confusion of the camera between ball and target?

If you consider that the floor is green and ball is white, you'll have a good enviroment to use these two functions.

I tryed it... but I think that I hadn't success because we are use our camera with mirrors associated!!!
  #4   Spotlight this post!  
Unread 30-01-2010, 23:36
daltore's Avatar
daltore daltore is offline
Electronics/programming/design
AKA: Aaron Osmer
FRC #3529 (ausTIN CANs)
Team Role: Mentor
 
Join Date: Dec 2007
Rookie Year: 2007
Location: San Antonio, TX
Posts: 272
daltore has a spectacular aura aboutdaltore has a spectacular aura aboutdaltore has a spectacular aura about
Send a message via AIM to daltore Send a message via MSN to daltore Send a message via Yahoo to daltore
Re: ball tracking w/ camera

Is this just for the robot to find the balls laying on the ground, or flying through the air? Because if it's through the air, there's no way you can get a good enough data rate on that.

I remember something when they released the system last year about blob detection, would that be a better solution? (Not sure, haven't really done any vision processing before this year) I would think the gray stripes would be discounted in blob detection because overall, the majority of the ball is white.
  #5   Spotlight this post!  
Unread 31-01-2010, 00:26
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: ball tracking w/ camera

Alan: You're right, a RIO would probably fix that, and make it considerably faster, too.

Sloteera:
Thank you! I forgot that the floor was green this year. I was thinking grey again.
What that means is I can very effectively filter that out by separating the RGB image, thresholding the red and blue, and ANDing that back together. That should also eliminate the problem with the stripes.

Aaron:
I by no means plan to track, or even interact with, balls flying through the air. I was actually intending to locate fairly stationary balls.
I believe what you're referring to is the "size ordered morphology" of last-year's tracking code. It might be my best bet to use that, however, I would have to investigate the reflective properties of the field, as this would would not filter it to just round objects.


I'll upload a test in a bit. I don't have the near-official one right with me, but I figured this picture would do.

EDIT:
I got it done. For simplicity, I just did a color threshold (instead of separating them out just to ignore the green).
Also, I used a "measure particles" VI for analysis, as opposed to the "find circles". I'm assuming that with less than a 1.2 ratio between width and height, and less than 20% holes, it will be a valid gamepiece.
Attached Files
File Type: zip method 3.scr.zip (1,023 Bytes, 106 views)
__________________
-- Marshal Horn

Last edited by kamocat : 31-01-2010 at 02:35.
  #6   Spotlight this post!  
Unread 31-01-2010, 12:29
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,753
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: ball tracking w/ camera

I think you are on the right track. The blob detection, or particle analysis as it is also called, can return a huge number of measurements and is very fast once you have the binary image.

I've played with this a bit, and it is helpful to play with a few discrete things.

First, it is useful to find filters that will clean up the image. In particular, you can probably filter out all small particles. This is often a good first step. Second, the balls punch a pretty good circular hole in the carpet color, but since balls cast shadows they will rarely make a perfectly circular hole. Anyway, it may be necessarily to perform one of the morphology steps like an open or close -- which is built on erode and a dilate cycles. Either play with these in the script or read the concept manual for more detail on when to use them and how they work.

Finally, if you measure terms like the Heywood circularity and perimeter and area. If you lay out balls on the carpet and get some sample images, you can view these measurements to find some factors that are unique to round objects. If you need more info, just ask.

Greg McKaskle
  #7   Spotlight this post!  
Unread 31-01-2010, 12:35
MrForbes's Avatar
MrForbes MrForbes is offline
Registered User
AKA: Jim
FRC #1726 (N.E.R.D.S.)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Sierra Vista AZ
Posts: 6,025
MrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond reputeMrForbes has a reputation beyond repute
Re: ball tracking w/ camera

balls are round and glossy, lights shining on the field are very bright, good luck!
  #8   Spotlight this post!  
Unread 31-01-2010, 12:45
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,753
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: ball tracking w/ camera

Quote:
balls are round and glossy, lights shining on the field are very bright, good luck!
This does indeed make it difficult to specifically see the balls. Add to that the ball color is not richly saturated day-glow colors, and it is an all new problem.

This is why the approach kamocat was using is a good one to experiment with. It doesn't look for the ball directly, it looks for missing carpet. Carpet is not shiny, and carpet doesn't even move around on the field. Now if only you can characterize the missing carpet as being a robot or a ball or a line or a wall.

Greg McKaskle
  #9   Spotlight this post!  
Unread 02-02-2010, 16:29
nathanww nathanww is offline
Hacker
FRC #1678 (Citrus Circuits)
Team Role: Programmer
 
Join Date: Dec 2008
Rookie Year: 2007
Location: Davis, CA
Posts: 224
nathanww is just really nicenathanww is just really nicenathanww is just really nicenathanww is just really nice
Re: ball tracking w/ camera

Quote:
balls are round and glossy, lights shining on the field are very bright, good luck!
Hmmm...

This could be a detriment, but it could also be a pretty fast-to-process, reliable signature if combined with some basic logic looking at thing like height and size.
__________________
Get yer robot source code here!
  #10   Spotlight this post!  
Unread 07-02-2010, 10:47
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: ball tracking w/ camera

Does anyone have any photos of balls on the green carpet? also, some in front of the bumps would be nice (red and green)
Its kinda hard to do ball recognition that will work on a field with a dull used off-white ball and regular carpet
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
  #11   Spotlight this post!  
Unread 07-02-2010, 10:54
whcirobotics's Avatar
whcirobotics whcirobotics is offline
Registered User
FRC #1514 (Vikings)
 
Join Date: Nov 2008
Rookie Year: 2009
Location: WHCI
Posts: 174
whcirobotics is an unknown quantity at this point
Re: CODE FOR KICKER

Hi does anyone have a default code for the kicking machanism so we have an idea what to work towards, becasue we are not that experienced. Tnx
  #12   Spotlight this post!  
Unread 07-02-2010, 10:58
Vikesrock's Avatar
Vikesrock Vikesrock is offline
Team 2175 Founder
AKA: Kevin O'Connor
no team
Team Role: Engineer
 
Join Date: Mar 2006
Rookie Year: 2007
Location: Manchester, NH
Posts: 3,305
Vikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond reputeVikesrock has a reputation beyond repute
Send a message via AIM to Vikesrock Send a message via MSN to Vikesrock Send a message via Yahoo to Vikesrock
Re: CODE FOR KICKER

Quote:
Originally Posted by whcirobotics View Post
Hi does anyone have a default code for the kicking machanism so we have an idea what to work towards, becasue we are not that experienced. Tnx
Teams are designing all sorts of different kicking mechanisms that are actuated in many different ways.

It is unlikely that another team's code will work for you.

If you need help please start your own thread in the appropriate programming forum here (Labview, C++ or Java) and describe exactly what you are trying to do (make motors move for X seconds, control pneumatics, control servos or whatever else actuates your kicker). Please try to be as specific as possible.
__________________


2007 Wisconsin Regional Highest Rookie Seed & Regional Finalists (Thanks 930 & 2039)
2008 MN Regional Semifinalists (Thanks 2472 & 1756)
2009 Northstar Regional Semifinalists (Thanks 171 & 525)
  #13   Spotlight this post!  
Unread 17-02-2010, 01:46
joxphoto joxphoto is offline
Registered User
FRC #0369
 
Join Date: Mar 2009
Location: Brooklyn, NY
Posts: 9
joxphoto is an unknown quantity at this point
Re: ball tracking w/ camera

Quote:
Originally Posted by sloteera View Post
Could you make an combination between Color Location and Find Geometric Shapes to prevent any confusion of the camera between ball and target?

If you consider that the floor is green and ball is white, you'll have a good enviroment to use these two functions.

I tryed it... but I think that I hadn't success because we are use our camera with mirrors associated!!!
--------------

Our team has been successful in identifying a white ball against a green background. I recommend a two-level test (meaning you will have to create 2 scripts in VA): 1- Identify a round object using appropriate steps in VA, 2- another script to identify the appropriate range of color that would be the official ball color for the competition. This methodology would at least increase your chance of finding THE ball, instead of just another round object in the playing field.
  #14   Spotlight this post!  
Unread 20-02-2010, 17:49
byteit101's Avatar
byteit101 byteit101 is offline
WPILib maintainer (WPI)
AKA: Patrick Plenefisch
no team (The Cat Attack (Formerly))
Team Role: Programmer
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Worcester
Posts: 699
byteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of lightbyteit101 is a glorious beacon of light
Re: ball tracking w/ camera

We have written a ball tracker in VA, but can't seem to get it to work on the robot (C++) It worked once (we were seeing numbers come out) but hasen't since then. also writing an image to file does not work, Is there a way to stream the binary image after particle analysis?
attached is the scr, some sample images, and the C++ code (adapted from 2010VisionDemo, added in exported VA C code)
Attached Files
File Type: zip images and scr.zip (507.7 KB, 66 views)
File Type: zip code.zip (15.2 KB, 59 views)
__________________
Bubble Wrap: programmers rewards
Watchdog.Kill();
printf("Watchdog is Dead, Celebrate!");
How to make a self aware robot: while (∞) cout<<(sqrt(-∞)/-0);
Previously FRC 451 (The Cat Attack)
Now part of the class of 2016 at WPI & helping on WPILib
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Camera Tracking Tanner NI LabVIEW 5 01-02-2009 11:28
Camera locked in "tracking", but not tracking geeknerd99 Programming 1 18-02-2007 22:47
camera tracking geekofband007 Programming 15 15-02-2007 23:50
Camera Tracking Problem cprogrammer Programming 1 18-02-2005 15:00
CMU Camera Tracking auditt241 Programming 0 03-02-2005 16:33


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

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