Tuesday, July 17, 2018

Will it See in the Sea?

After adding the camera enclosure last week, I spent a number of days doing tests with bits of computer-vision code, trying to find something that might help AMOS with obstacle avoidance. To speed up the testing a bit, I modified the "BoatCaptain" software for the PC to request video capture frames from AMOS over our family WiFi network. It seemed to work pretty well, sending a new video frame from AMOS to my PC every 2 seconds, although it tended to slow down and get a bit laggy if AMOS was on the side of the pool furthest from the wireless extender.

So far I have experimented with two different types of feature detection. The first called the FAST algorithm (https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_feature2d/py_fast/py_fast.html#) seemed to work reasonably well at finding corners in the environment, although it was also quite susceptible to reflections in the water, and I think might be difficult to use in practice. Here are some typical examples:


You can see in the above 2 examples that the number of features found is dependent on the "threshold" value (from 0 to 255) that is input to the algorithm. I found that a threshold value of somewhere between 60 and 70 was normally optimal for finding corners in the images. But of course not all corners are obstacles. Some correspond to objects in the far distance (i.e. the treetops). Others correspond to reflections in the water.

The second type of feature detection was called the Canny Edge Detector (https://docs.opencv.org/2.4/modules/imgproc/doc/feature_detection.html?highlight=canny#canny) and it worked pretty well for finding lines and edges, but would also find features that were just reflections in the water:



Of the two algorithms, the Canny Edge Detector seems like it would be a bit better suited to finding real obstacles. I don't know, maybe I'll need to use something else, probably non-vision based. Or maybe a hybrid approach. At any rate, sometime soon I'll take AMOS back out on the river to collect some video footage. The pool is OK for basic testing but it's a bit of a visual overload compared to what AMOS would typically see out on the open water.


No comments:

Post a Comment