Skip to content
steakunderscore edited this page Oct 17, 2011 · 9 revisions

#Computer Vision System

A computer vision system has been implemented for use in guiding the kart and serving as a basic demonstration of the kart's abilities. This system tracked a leader which had a marker placed on it, finding the marker using a CV algorithm. This page serves to give a rough overview of what was implemented and its status, for a full and in depth look at this system and its development refer to this report on the system.

#The methods looked at

Three computer vision techniques - colour detection, SURF and chessboard detection - were evaluated to see if they could be used to locate the marker. SURF, colour detection and chessboard detection.

SURF, which stands for Speeded Up Robust Features, locates points that are the same in two different images; it was used to locate a marker image in a scene provided by the camera. In testing SURF performed slowly and only at very short ranges. An example of the SURF algorithm is shown in the picture below

The SURF algorithm in action

Colour detection was looked at using a brightly coloured marker for location in the cameras image. This was found to be too sensitive to lighting changes but otherwise a viable option.

Chessboard detection is an algorithm that scans an image for a chessboard of known dimensions. During examination it was found to meet all the needs of the system with the exception of having a reasonably short range.

##The chessboard implementation

The chessboard algorithm was used in the implementation of the tracking algorithm. The code for locating the chessboard made heavy use of the OpenCV computer vision libraries for its location. The implementation was also largely based on material presented in a COSC428 computer vision lecture, only minor changes were made so that the function output the data in an appropriate format. The code for this implementation can be found in chessboard.cpp.

##The tracking algorithm

The tracking algorithm works by taking in data from the on board speed sensor and the encoder giving the angle of the wheel to build up a picture of the kart's absolute position and orientation.

Once it has this information it uses the chessboard detection to obtain the relative position of the chessboard in relation to it and from this the boards absolute position. This information allows it to record the path that the chessboard takes. It then attempts to follow this path by following a simple routine which is written in pseudo code below

Current_Point = next point on path
while (
  (Distance from Current_Point to kart < SET_DISTANCE) and
  (Time since Current_Point was set < SET_TIME)
) {
    drive towards Current_point
}

This simple algorithm means that the kart attempts to follow the path of the marker board while ignoring small bumps and path deviations (due to the SET_DISTANCE value). The SET_TIME value means if the kart is lagging behind or cant turn as tightly as the vehicle it is following it will start cutting corners and ignoring points to keep itself from loosing the leader. All this code has been implemented in the main tracking algorithm file main.cpp.