Milestone 4: Treasure Detection

The goal of this lab is to make the robot detect when there are/are not treasures. Further, it will successfully distinguish between red and blue treasures and distinguish a square and triangle shape.

Color Detection

Initially, the image is discolored. We were not able to get the color bar to be in the correct order. The blue color is turning into black and the red color is turning into blue, as shown in the image below

As a result, we simply switch the color detected to be black and blue instead of blue and red. This is more or less hacking the solution. However, since the Arduino only needs to know whether there is treasure, there is no need to change the color in order for the arduino to get the correct result. The color detected is then indicated by the setting the MSB in a three-bit-result register. This result is send back to the Arudino to digital pin 5, 6, 7.

Shape Detection

The shape detection result is produced once the image processor detects there is either red or blue color detected in the frame. The algorithm is fairly strightforward. We get three rows of data from each frame: top, middle, bottom, each row is 10 vertical pixel apart. Using the middle row as reference, we compare the size of the top and bottom row relative to the middle row. If they are approximately the same width, then there is a square. If top is less than middle and bottom is greater than middle, then there is a triangle. If both top and bottom are less than middle, then there is a diamond. This additional piece of code is integrated into image processor.

Result

The end result is as shown in the following videos. The first one is detecting a red triangle and the second one is detecing a blue square.

Work Distribution

The Milestone 4 Work Distribution is as follows:
  - Joyce completed the camera and FPGA functionalities
The Lab Report Work Distribution is as follows:
  - Joyce wrote the lab report
  - Nathalia and Joyce filmed
  - Nathalia edited and uploaded the video
The website work distribution is as follows:
  - Nathalia: Website Milestone 4 Set Up and Maintenance