Yellow sub, yellow sub, what do you see?

The vision system begins when the Robot Super Controller Application (RSCA) begins either the task to bump into the slot machine, or to center itself over the pinger crate. In both of these tasks, the objects to be identified are specifically colored. The vision system finds these objects based on their hue. Images are captured using the Intel developed and maintained OpenCV software. OpenCV is available free of charge, and makes capturing and processing images quite simple.

The format of the image is originally in RGB (Red Green Blue) color space (Illustration 1), but is converted to HSV (Hue Saturation Value) color space (Illustration 2) in order to simplify color separation and identification. This switch between color spaces is a simple geometrical conversion following equations 1 through 3 below.

Illustration 1 - RGB color Space [1]

Equation 1 - RGB to Hue

Equation 2 - RGB to Saturation

Equation 3 - RGB to Value

Illustration 2 - HSV Color Space [2]

Since object detection is, in this case, largely based on the hue of the object, parameters for adjusting the color of the object to be found may be changed at any point during the vision system's operation. If any amount of pixels with matching HSV values is found, their center of mass is calculated based on the Value of those pixels. The calculation follows equation 4 below for both x and y centroids.

Equation 4 - Center of mass in either x or y direction

In equation 4, R is a vector with components in each dimension of your sample space. Since we're operating only in x and y pixel space, we found it easier to explicitly specify x and y. This centroid is then turned into a heading, using the center of the picture as the vehicular axis. Adjustments to the robot's direction are made incrementally, based on the overall error of heading calculated from the difference between the current heading, and the heading desired by the vision system. The heading is read by the RSCA, which does this course correction, and employs this tactic until either the objective has been completed, or a timer on the task has expired.

[1] Wikipedia Community, "HSL and HSV" http://en.wikipedia.org/wiki/HSV_color_space July 1, 2008

[2] Wikipedia Community, "RGB Color Space", http://en.wikipedia.org/wiki/RGB_color_space April 29, 2008

Blogging Out Find out more about the SMU Robotics Club, including coverage of last year's competition and last-minute building exploits, at our blog. We will continue to update as we approach the 2008 competition.