Monday, January 11, 2010

11 Jan

Report and Code Understanding of B-Human Framework:
Main idea in the starting is to understand how the ball perception is implemented and what are the algorithms used in its implementation. The whole procedure for perception of various objects or targets(goal, line, field, ball etc) involves image processing which is divided in 3 steps and then the final(3rd) step branches out for each target. The 3 steps of image processing are following:
  1. Segmentation and region building
  2. Region classification
  3. Feature extraction
Main focus here is 3rd step concerning with BALL PERCEPTION, but a brief introduction for other steps are given.

  1. Segmentation and region building: This step basically uses the camera image(to be read and discuss) and creates region after doing segmentation of the image. Regionizer is the method/file used for doing this step. And configuration of various parameters for various criteria or thresholding can be done in regionizer.cfg. This method gives RegionPercept which contains the segments, regions, borders etc. This is used in the next step.
  2. Region Classification: This step is carried by RegionAnalyzer method/class. This itereates over all the regions in RegionPercept and classifies the region as a line of ball and discards everything else. This returns LineSpots and BallSpots which contains possible candidate for line related targets(field line, goal) and ball target respectively.
  3. Feature Extraction: This steps involves detecting the field line, the goal and ball. The main focus related to project work is on detecting the ball. This is discussed below.
DETECTING THE BALL: This task is handled by BallPerceptor class. This uses the BallSpots found in 2nd step. It itereates over each BallSpot in BallSpots and give likelihood value called validity(in the report) between 0 and 1 and finally selects the most likely BallSpot as the ball. Each BallSpot goes through some stage and get some validity. Then BallSpot with validity below some threshold value are discarded i.e. these can't be ball. And if validity are above some other threshold value then these can be considered as ball. All other between these threshold have to go through other stage. (Here, I need to find out which configuration file is used for setting the threshold value.)

A method called scanForBallPoints in BallPerceptor class takes each BallSpot from BallSpots and find the ball points(points in the ball, stored in vector form) in it by scanning the image in eight directon (left, right, up, down, and the four diagonal directions) from the BallSpot following some boundary condition. The ball points are handled by BallPointList class defined in the same file.

Now another method named computeBallInImageLevenbergMarquardt runs over each BallSpot, it uses its ball points and finds the center and radius of that particular BallSpot. This method handles two cases for ball

case 1: when ball is fully visible : radius = maximum distance between two different ball points;and center = average of those two ball points(as the ball point is stored in vector their avg. will give the center.)

case 2: when the ball is partially visible maybe due to occlusion or position at border of image - initially it comes to mind that if one knows 3 boundary point of the circle then one can easily find the center and radius of the cirlce but it was not that easy. In the report they are using Levenberg-Marquart method(Least Square fitting). The given reference is The NUbot 2003 Team Report. Section 3.6 in the above given reference report explains about the use of least square circle fitting and demerits of using 3 point circle fitting very nicely.

And both of these cases are implemented in the method
computeBallInImageLevenbergMarquardt

Now using the center of the ball and its location relative to the horizon, location of the ball is calculated in world coordinate relative to the robot (this method has to be found out). Now on this location the ball is projected back and validity of the BallSpot is calculated.(this method is also to be found out)

calculateValidityFirstRun first handles that each BallSpot has a validity and all those having value below certain threshold are discarded and above a different threshold can be thought as a ball. BallSpots in between these thresholds go through analysis based on color classes. This is done by covering the BallSpot by three different size of square box and then calculated the values of percentage of orange color lie in each region and compared with set threshold for each regions. The three square are following:
  1. 1st square is the biggest square that fits the calculated ball of BallSpot.
  2. 2nd square is the smallest sq. bigger than the complete ball without all the points inside the first region.
  3. 3rd square has an edge = square root(2)*diameter of the circle with center same as circle.
Threshold for each sq.
  1. 1st region = 90% of orange points
  2. 2nd region is ignored
  3. 3rd region = 2% of orange points
Using this the likelihood or validity of the BallSpots are calculated handled by calculateValiditySecondRun

All these BallSpots with their validities are stored in ExtendedBallPercepts and when all the BallSpots are analysed then the one with highest value of validity is stored in BallPercept as ball.


*Most of the text are directly from the report of B-Human project.*


No comments:

Post a Comment

Followers

Contributors