I’ve always been aware of the subject of Computer Vision, but I always signed it off as a completely theoretical subject, or at best something that engineers in the military or nasa work on. I certainly didn’t know enough about its real-world consumer application until about a year ago I was introduced to some computer vision experts. After a few short talks, I was mesmerized about where the field was going, but still never had a chance to fully delve into…until recently.

I am a total beginner to the field, but some folks in the field directed me to OpenCV as a good starting point to learning what can be done. My ultimate use for CV is to do some cool stuff using iOS (for now) which recently has enriched its SDK with AVFoundation to allow developers to have a lot of power over the camera. Anyhow, OpenCV with iOS prove to be a great combo.

However, since OpenCV is a toolkit more than an end solution, it is hard for a noob like me to know exactly how to use it for the needs that I have (in this case i’m trying to do object recognition). So in such scenarios its good to have a set of image frames on your local machine, and apply your alogrithm to them as you tweak it to get the results you’re looking for. The cool thing about OpenCV is that you can compile it with python bindings. So although my eventual algorithm on iOS will be in C++ or Objective-C, I at least have the luxuries of python to get my algorithm in a position where I like it.

OpenCV recently had an update to the 2.2 edition, and although the C++ samples seemed to be working, I found the python samples outdated. It seems quite a few structures and functions have changed with the new Python bindings. So, as an exercise in learning more about OpenCV and a contribution to the OpenCV project, I went about redoing the squares.py sample to conform to the OpenCV 2.2 version. Squares.py basically takes images and detects if there are squares on them. You should go through the process of downloading and installing OpenCV first, then compare the squares.py in the samples folder with the one here. If you are interested in using it, you can download it from here. Let me know if it was helpful.