Computer Vision

From APL
Revision as of 14:37, 2 December 2018 by Aplstudent (talk | contribs) (OpenCV and Computer Vision)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


OpenCV is a python compatible open source library used for computer vision. OpenCV offers a wide range of functionality including built in image filters and AI based image/object recognition. So far, we've used OpenCV and python to to identify stop signs in real time, use image filters to correct for lens distortion on the RaspberryPi's camera, and code has been written to implement edge detection.

Object detection with OpenCV is not very difficult once you have a trained haar cascade. Right now we have a usable haar cascade for stop signs, eyes, and faces. These are three commonly identified image types and thus pre-made haar cascades are available on github and through google searches. Although, making your own haar cascade is possible and discussed in many tutorials. To learn more about using OpenCV and haar cascades I recommend the YouTube series, OpenCV with Python for Image and Video Analysis, by sentdex ([1]). This playlist contains multiple relevant videos which go over how to install OpenCV, how to write code to use OpenCV, how haar cascades are made and used with OpenCV.

Also note that currently OpenCV is not installed on the RaspberryPis and will need to be installed on both your computer and the RaspberryPis to make use of the preexisting code.

Basic Computer Vision

While OpenCV is extremely useful and powerful it does most of the work under the hood, that said for those more interested in learning more about computer vision or implementing their own computer vision based code we recommend exploring those avenues as well. We've written some computer vision code, a Gaussian filter to blur images and a Sobel operator to detect edges. While we've found that this code works better for our purposes it is much slower than OpenCV's filters. For those interested in optimizing this code, one should learn how Gaussian blur filters and Sobel operators work and then update the code accordingly. The current plan for the edge detection is to use the camera to identify edges and approximate the distance of the edge to the car. Code has been written to approximate object distances based on camera pixel location but this is only useful if we can identify objects or edges. The ultimate goal will be to identify obstacles and walls and navigate around them.