### Computer Science 154Problem Set 4, due Wednesday, May 2Visual tracking

Write-up
SooYoung Jung
04/30/01

Problem Approach

Part I

The goal is to build a tracking Frisbee algorithm that will work on more than just this image sequence.
Therefore, I decided to define the red color first, and detect the Frisbee from the occurrence of the red in the image.

The first approach was to make a circle region in the circle, which is as same size as the Frisbee is, and calculate the occurrence of the red in the region.  If the red occurred more than certain amount, which was 60% of the region, it can be considered as a Frisbee.  However, this approach was very inefficient because I checked all circle regions for all pixels in the image.  This approach consumed about 90% CPU of turing machine.

The second approach was to check the red occurrence in the image and average x and y coordinate to get the center of the Frisbee.   This works quite well and until the small red ball appears in the image.

As a result, I had to cut off other occurrence of red object if it is possible.  Therefore, I improved the second approach to the final approach.
The final approach is to check the first image using my second approach.  After the first image is passed, I will have the center of the Frisbee from the first image.  I use this previous center coordinate for the next search region.  I have strong assumptions that the Frisbee will move slowly and the Frisbee will show face up only.  Therefore, I estimate the size of the Frisbee, which was about 40-pixel diameter circle, and the distance that Frisbee will travel for one frame, which was exceed 10 pixels.  In summery, after getting the previous center coordinate, the program will search 60x60 pixels squire area only and find the center of the Frisbee.

Part II

To keep the nomad to see the center of the Frisbee, I passed the center of x and y coordinates to the angle function which is from the previous homework and calculate the angle to the center of the Frisbee from the center of the image.

Hardest aspect of the problem

The hardest aspect of the problem was how to determine the red color in the image.  Therefore, I decided to see what the red values looks like in RGB format.  Here is some picture that I defined the red

This is the exact red value (255, 0, 0) and some region that can be considered as red

As G and B value goes higher, it can be seen as red and I bounded the red as shown in the images.

However, the real Frisbee wasn't quite these values and shows some patterns.  When the R is goes higher number, G and B also goes higher.  It does as follow:
- when the R is between 128 ~ 180, G and B are between 32 ~ 64
- when the R is between 180 ~ 256, G and B are between 64 ~ 100

Of course, some other pixels show these color but we can ignore them.

How well the algorithm work

The second approach algorithm works quite well.  But, when the Frisbee is in the glare of the lights, there are not enough red pixels to detect red color.  When it is in the glare of the lights, the color is still red for human eyes but the red values in the program shows that is not red compared to my definition of red.
Also, when there is some other red occurrence other than Frisbee, tracking program lost the center of the Frisbee.  It was not even within the Frisbee.

Here are some result pictures of the second approach tracking. (I couldn't capture the real image.  xv couldn't capture these images.)

 Successful tracking of first image When the Frisbee gets darker When the Frisbee is in the glare of the lights

As I described about final approach, the algorithm works very well.  It tracks the Frisbee all the time.  However, there were still some problems when the Frisbee is in the glare of the lights.  When the Frisbee is in the glare of the lights, there are only some red pixels at the edge of the Frisbee.  Therefore, the + is not at the center but it is within the Frisbee.

 When the Frisbee is in the glare of the lights.Compare to the second approach, very successful result When the Frisbee gets darker.Still good tracking

Source code and link to the problem page