View Single Post
  #2   Spotlight this post!  
Unread 25-02-2013, 14:27
wre136's Avatar
wre136 wre136 is offline
Registered User
AKA: Will Edds
FRC #2461 (The METAL-SKINS)
Team Role: Programmer
 
Join Date: Jan 2012
Rookie Year: 2002
Location: Oklahoma City
Posts: 30
wre136 is an unknown quantity at this point
Re: Tracking Rectangles with Perspective Distortion

Quote:
Originally Posted by Greg McKaskle View Post
It intentionally doesn't use high level shape detection so that it is more accessible.
The rectangularity score is based on area/bounding rectangle.

The aspect ratio is based on the width and height of the bounding rect, and to make it a bit more robust to distortion, it also uses something called the equivalent rectangle.
The equivalent rectangle uses the area of the particle and the perimeter of the particle and solves for 2X+2Y=perimeter and X*Y=area.

The hollowness counts the pixels that are on for each vertical column of pixels and again for each horizontal row of pixels and compares those counts to thresholds that expect a strong outer band and weak inner band.

Each of these is scaled so that 100 is a good score and lower is not as good. The initial cutoffs are just based on some initial images and are very easy to change.

Can you think of other simple geometric measures that the code could score on the targets?

Greg McKaskle
Greg,

What I would like to work out is some system that detects all edges on the image and if the edges seem to touch (or are with in a few pixels of each other), then they would be considered a corner. If 4 corners could be found consecutively, then we have a quadrilateral which is the shape we want to analyze.

The only thing that stinks about even trying to start my approach is that the edge finding ability of the vision assistant can only find 1 edge per run and you can only run it in the 4 main directions, left-right, right-left, up-down, down-up. Once each of those finds an edge, I cannot detect anymore edges unless I can find a way to subtract those edges from the image and then keep rerunning the edge detection. If I could at least do that, then I could detect the shapes and do the same measurements and calculations we are now. If you can think of anything about this, that would be helpful.

I do have a question about edge detection though. Does it work off of how many pixels in a column report an edge? For example, if all the pixels in column X say they have found an edge, then is the edge found? If some pixels in columns X, Y, Z (columns that are right next to each other) report an edge, then would that be an edge but be partially diagonal? If that is the case, I wonder if and how we can play with that so we can detect edges that are really skewed. Just thinking out loud.

Again, thanks for the help!