COMPUTER-VISION LABRON
Introduction
In fulfilling this Milestone, we were tasked with converting our functioning camera setup into a more nuanced color and shape determination. We set about this by splitting the work for both types of features, hoping to join the complete setup for both in the end.
Color Detection
The colors of interest to us were blue and red. Given that these are primary colors and supported extensively by RGB styled image processing, we hoped to make use of the on-board image converting of our camera and use more simple calulations on our FPGA to determine color. The method we chose was to be a strict majority and over a baseline threshold. To determine what a majority meant, we simply took each pixels' data and examined whether the larger magnitude belonged to red or blue (again, only over a second threshold). The end result was quite accurate color detection.
Shape Detection
Shape detection offere less obvious routes to success compared to color detection. Our singular attack strategy was that we already had a set of well-defined shapes we wanted to search for (triangle, square, diamond). We began by looking for patterns in rows of pixels we received, and after some initial succes in locating "clumps" of red or blue, were able to extrapolate from there with larger shape detection. The most trouble we received was in determining the presence of a diamond. Having a shape very distinctly between a square and a triangle, the inclusion of this third shape made testing quite extensive to be sure we were thresholding all our values correctly. Unfortunately, we were quite hurried in making our video for demonstraction of completion, and so were only able to show the diamond being correctly identified. However, given that this was the hardest shape to determine, it follows that the square and triangle had to be completed before this task.
Shape Detection Update
The shape detection update greatly improved the accuracy and quality after multiple corrections. Here is how we do the image processing to detect the treasure shapes (Triangle, Square, and Diamond). Our concept is to find the upper bound and the last bound of the treasure for locating and thus, could dynamically locate the middle three rows for shape detection.
Key for shape detection
Please beware of that Verilog is a Hardware Design Circuit. Not simply a C like language. You would rather map out the circuit in your mind whenever programming Verilog.
Always keep these in mind when programming Verilog.
Conclusion
Working with the camera again, we found ourselves in a familiar dilemma of dealing with inaccurate hardware and "touchy" wirings that would often fail between successful tests. This made this portion of our final robot all the more challenging, but also rewarding as we began to see resutls. The final color and shape detection are not combined and able to provide accurate results, provided one takes a running average to sort reduce the chance of false positives.