Got opencv to detect eyes from the collection of portraits that I have. Got more than 1700+ eyes, that’s way more than the 100 or so I had. Eye detection with opencv works like a charm. There are false positives but the ratio is very small (10 out of 1500 or so)..
Using those and metapixel, I created a composite which you can see below:
Next step is to use something like zoomify to let you see the actual component eyes in detail.
Got Open CV from ubuntu along with the python bindings.
Turns out the one available on ubuntu karmic is opencv 1.x.
OpenCV 2.x is out so, want to make sure I take advantage of any improvements in the library. (see previous post
Following a bunch of sources, (including an easier python binding framework), I finally settled upon compiling opencv and using the new python bindings on ubuntu 64. Too bad I couldn’t use the pyopencv bindings.. looked cool but no x64 support yet.
After mucking around, I got it to capture frames from a webcam and detect my face and my eyes and track it. I’m using the default haarcascade_frontalface_alt.xml and haarcascade_eye.xml cascade files that come with opencv.
Here’s the sample image
In a nutshell, face detection, eye detection (any object detection) using opencv works pretty well as long as you have a properly defined haarcascades file for it.
Next up, rewriting the script to a runnable script for extracting and saving eyes from images.
Getting there… 🙂
After 2, 3 years, I still don’t have enough eye photographs. This would require thousands (see previous post).
One good idea would be to extract eyes from existing photographs of people that I already have. That would mean detecting, cutting, pasting and saving eye images from thousands of pics.
Sounds like a programming job. You’d think!
Turns out there aren’t any free libraries out there.. and coming up with a pattern matching algorithm on your own is not trivial..
Enter OpenCV, an open source computer vision package started by Intel. Besides giving you lots of image manipulation stuff, it gives you object detection using HaarCascades, based on a paper by Viola and Jones, “Rapid object detection using boosted cascade of simple features”, Computer Vision and Pattern Recognition.
The detect object feature basically uses trained classifiers based on known object images to detect similar objects in a given image. The classifiers are stored in xml files that the library can load up. The opencv framework even gives you tools to create and train your own classifiers AND a set of sample cascade files. There are other cascade files available on the net.