So tinkering with OpenCV the past day has been fun. This past summer, a co-worker and I made an application to crop images and resize them automatically to speed up booking at the jail we work at.
The first problem was face detection. To create a method, we first invert the image. Then run a line from left to right until the background color changes. Do the same thing from right to left and then find the center. Do that several times through the picture would lead us to a good center location for the face.
The second problem was that we did all this with Windows API/GDI. These methods were very low level and difficult to run simple methods on.
For some reason, we never found OpenCV until reading a slashdot article last night. This library is awesome for face detection and other visual work. I use a Linux box at home and the work computers use Windows, so I like that code can be compiled with only changes to the compiler going between each computer.
The install in linux was very easy. Ubuntu has great documentation for installing anything with apt. Since I’m using Mint 12 (gotta get away from Gnome 3!), I was able to follow this guide.
For Windows, it was a bit more tricky. I read guides walking me through CMake and such. Fortunately, I found that OpenCV 2.0’s installer does not need to be compiled, just extracted. Using this guide I was able to get it work. To simplify things, I’ve put two zips on my server for anyone to use.
- OpenCV_INSTALL.zip has the installer for OpenCV 2.0, CMake guide for those using Visual C++, and a sample codeblocks project.
- OpenCV_DONE.zip includes the extracted source and a sample codeblocks project.
Let me know if you have any issues. Remember, for the codeblocks project to compile, you’ll have to sent compiler search directory to [src]/include/opencv and the linker search directory to [src]/lib