OPENCV is an open source image processing library developed by Intel and currently maintained by WillowGarage. It is very powerful and can be coded in C/C++ or Python. I chose C, as it is more comfortable to me.

Bottle Detection

Bottle Detection

Object detection can be done using SURF or by using  Haartraining using Viola Jones algorithm to form a cascade file. Even though detection using Haartraining is more difficult to train  compared to SURF, it is less error prone and of course faster to run in real time.I used Haartraining to detect  a bottle. I just experimented. The first step was to  take some positive and negative images, I took about 180 photos containing the bottle to be detected (positive images) and about 260 background images which did not have the bottle (negative images). It was really a small  number of images compared to about 5000 images used to train the classifier for face detection.STEP

The next step was to mark the object in the positive set of images using Objectmarker tool to yield a description file, a description file for negative samples was also created. Then using createsamples utility provided with opencv, a training sample , ie, a vec file was created. Now I started Haartraining using the haartraining tool. 25 stages was defined. It was going really fast upto the 15th stage, then gradually it slowed down, in fact training the 25th stage took me about 2 days. The whole process  took about 4 days, after which the xml file was created. the xml file can also be created in between using the convert_cascade program provided with opencv. The screenshots at various stages are given below.

Marking the object to be detected using Objectmarker

Output of the createsamples tool

An intermediate stage  during Haartraining

Intermediate output showing the haartraining progress

Here comes the outputs, the bottle in my hand is identified and encircled

some more............

The final outputs………

I am now working on an image processing robot that will track down objects, go near to them and pick them  and  handle them to the operator, upon his command to take something. It is for our college technical fest. Now I have to train some more cascades to detect various household objects