Computer Vision, CS34110
The vast majority of the materials and resources for this module are on the
Blackboard site. However, that platform is not very good at displaying interactive webpages, and I have come across (and/or written:-) a handful of useful demonstrations which use JavaScript to highlight computer vision concepts. These I will collect here.
Python based OpenCV code samples
There are various demos and videos I've used during the module and as I go I'll also put the code up here. Most of these are basically hacks of the OpenCV sample code - they're just demos of standard methods, after all.
To use these:
- Install OpenCV with Python support and the samples
- Copy (from the samples/python2 directory) video.pyc video.py common.pyc and common.py to your 341 directory
- Put the python files below in the same directory
- Look at the comments of my hacky stuff to see what it takes in terms of parameters (it will either take none, or an image filename, probably!)
- You can download the whole lot here as a .tgz file: demos.tgz
Generic opencv
Edge detection, and edge grouping
- edge.py: Canny edge detection; takes webcam input, detects and draws Canny edges on it. Parameters as trackbars.
- sobel.py: This takes the webcam input then does Sobel in the x, Sobel in the y, and Sobel in both. Warning: if you do Sobel-X and Sobel-Y on a normal webcam which is pointing at your face, your face looks really strange in the output.
- dog.py: experimenting with difference of Gaussians; does blurs, and takes one blur away from another.
- An interactive demonstration of the Hough Transform: hough.html written in JavaScript
- houghcircles.py: circular Hough transform; takes webcam input, finds and draws circles, parameters as trackbars.
Feature and corner detection
- harris.py: a super-basic demo of the Harris corner detector. Takes a single image file, detects and draws the Harris corners on it.
- klt.py: a super-basic demo of the KLT interest point detector. Takes a single image file, detects and draws the KLT features on it.
- orb.py: a super-basic demo of the ORB interest point detector. Takes a single image file, detects and draws the ORB features on it.
Non-free features...
You can install some very popular and common non-free features in opencv if you want. Note: these aren't installed on the uni machines so won't work in the delph.
- sift.py: a super-basic demo of the SIFT interest point detector. Takes a single image file, detects and draws the SIFT features on it.
- surf.py: a super-basic demo of the SURF interest point detector. Takes a single image file, detects and draws the SURF features on it.
Objects
cd introlab-find-object-1f44524/
cmake .
make
cd bin/
./find_object
Background subtraction
- background-simple.py: a basic demo of single-frame background subtraction, allows you to vary the threshold
- background-movingaverage.py: a demo of moving average background subtraction, allows you to vary the threshold and the size of the framebuffer used to generate the moving average. shows input, background model (average image) and output of subtraction
- mog.py: a demo of mixture of Gaussians background subtraction, automatic model order (number of Gaussians) and shadow detection switched on. Program shows input, a visualisation of the background model (average image) and output of subtraction, shadows in grey
Feature tracking
- optical_flow_farneback.py shows Farneback's optical flow calculations - a dense method - using the OpenCV sample code pretty much out of the box. This is interesting to play with, but slow...
- lk_track.py is a demo of the KLT/Lucas Kanade/KLTS tracker; it not only finds the points, but then finds a similar point in the next frame (and the next and so on) giving you "tracklets" that you can then follow across the scene
I am not a python guru (by anyone's measure) - usually I code in c++. I've gone for Python here as I have been told that installing c++ OpenCV on Windows is terrible, but python is OK, and these are just simple demos for you to play with.
Note - the Facebook Group will also be used for linking online demos, and I will link to the materials here from Blackboard, too. So you don't need to watch this page, it's just a repository.