This project was part of programming for the 2019 MATE Ranger competition. I was part of Sidwell’s senior team, Fox Enterprises. You can find that year’s tech report, spec sheet, and job safety analysis hosted on MATE’s website. My documentation for the benthic species detector from that year is available here as part of the GitHub repository for the project.
MATE’s competitions are about high school teams acting as “companies” to propose an underwater remotely operated vehicle (ROV) that they build and is able to complete a series of tasks. The tasks are simulations of realistic applications of ROVs, and a large part of your company’s score is the product demonstration, where your company uses your ROV to attempt to complete as many tasks as possible.
One of the steps from Task 2: Maintaining Healthy Waterways from the competition entailed determining the number and type of benthic species under a rock. Benthic organisms are organisms living on the bottom of bodies of water, but since everything was simulated, there were no living things in the product demonstration. The rock is actually just PVC pipes attached to a corrugated plastic sheet, and the benthic species are an image of of simple shapes each representing an organism.
Our goal was to count how many of each shape there are. If we do it manually we get 5 points, but if we do it with a program we get 20 points. So I set out to write that program.
I used a library called OpenCV to help count the shapes. To demonstrate what the program does by visualizing it on MATE’s image of the species. First I change the image to gray-scale and apply a bilateral filter to sharpen edges and smooth everything else.
Next I use OpenCV’s canny edge detector. Here is a visualization of the edges:
Then I use OpenCV to find polygons that approximate the edges. Here they are shown in red over the original image:
I remove a lot of the bad polygons by only considering the convex polygons:
Unfortunately, this system isn’t perfect. There were many parameters I could adjust to tweak the detection slightly, so it was hard to find the right ones. If I resize the image slightly and then use the same program I get this:
It doesn’t detect the center circle. Another member of our company/team came up with a great idea to make it more reliable and stable. If I just use the maximum shape count the program has seen, that is usually the correct answer.
The program got us the 20 points at internationals, and we placed 12th!
The code for the project is available on my GitHub here.