Ask Your Question
1

custom object recognition with OpenCV

asked 2015-01-18 07:41:59 -0600

cryptid gravatar image

updated 2015-01-18 08:21:25 -0600

I'm trying to use OpenCV to detect and subsequently distinguish between different types of an object. Say that I want to be able to detect if an object is a bottle and then based on some of its specific characteristics I'd like to be able to distinguish what kind of bottle it is (eg beer bottle, wine bottle, etc). How would I approach this? My idea so far has been to create a separate classifier for each type of the object, and then run comparison on all these classifiers. However this seems inefficient, especially if there are thousands of different types of an object, and I'd like to be able to get a result within few seconds...

I would appreciate if somebody could point me in the right direction here.

On another note as you might imagine I'm completely new to the field of computer vision, so if you can recommend some useful material to learn this from the ground up, I'd be very grateful.

edit retag flag offensive close merge delete

Comments

Thanks Steven. Are there any particular OpenCV tutorials that talk about making a 'smart classifier'? I've seen a few that talk about face recognition, but they seem to be overly specific to faces and not to general objects...

cryptid gravatar imagecryptid ( 2015-01-18 08:09:58 -0600 )edit

Ok I will post a more detailed explanation below. Give me a minute!

StevenPuttemans gravatar imageStevenPuttemans ( 2015-01-18 08:11:35 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
5

answered 2015-01-18 07:45:57 -0600

updated 2015-01-18 08:21:58 -0600

For a starter the upcomming book we are writing on OpenCV Blueprints will be a great guideline for you, but basically all OpenCV books can give you a head start. For the time being I would suggest to make a single bottle object detection model, so mix up all types of bottles, then try to make a smart classifier based on features to destinguish between types, like for example Bag Of Words, SVM, ...

EDIT: answer to your second question

OpenCV comes with several interfaces for training an object detector. However it might seem that some of them are very specific for a case, but almost always it will be able to train your own classifer with it for any possible object category.

  1. Start by making sure that you need an object detection framework. Is your first task explicitly detecting the bottles location or only varifying that it is on the expected location. In the first case you will need an object detector followed by a classifier. In the second case you actually need a recognition system instead of a detection system, maybe combined with a second classifier.
  2. If you need a detector, then there are several options. Take a look at cascade classifiers, which are used for faces, but could be applied to any possible objects, as illustrated here.
  3. Another idea could be to follow the approach of HOG+SVM, mainly used for pedestrian detection, but again applicable for each possible object category. Steps would be to first look for the HOG descriptor(do not worry on the GPU part, it exists also in CPU but the documentation is gone ..) of your object windows, then apply SVM training (or use the basic version) on the descriptors to learn a model.
  4. Finally if you have found your general object class, which will be bottles, then you will need to apply feature detection first. Several options could be SIFT, SURF, BRISK, ORB or even HOG features, color histograms, shape filters, ...
  5. Those will then again be added to a classifier learning process. For this you could use either the multiclass approach like multiclass SVM classifiers or you could apply a 1 versus 1 binary classification problem, where you make a classifier for each class with class, no class output and then try to look for that classifier that yields a hit. This can be done with linear SVM classifiers, naive bayes classifiers, random trees, ...

Enough info to start reading?

edit flag offensive delete link more

Comments

1

Yeah, that helps clear things up, thanks! Just one more thing, regarding:

Is your first task explicitly detecting the bottles location or only verifying that it is on the expected location.

what is the difference?

cryptid gravatar imagecryptid ( 2015-01-18 09:19:12 -0600 )edit
1

Well imagine you have an automated pipeline where glass bottles are passing a scanner device. In that case you could hard code the region of interest in a fixed camera setup. Mainly because you know where the bottle will be if you want to analize it. Then there is no need anymore for a bottle detector but only for a classifier to destinct several bottles.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-01-18 09:21:46 -0600 )edit
0

answered 2015-08-31 12:12:56 -0600

shamshun gravatar image

I think you can use Neural Networks for classification of such objects. You need to have a database of objects (bottles), each one classified (beer,etc) as training data. Then your neural network learns (long story, you have to read about it) somehow, and afterwards the network can magically classify the new objects in images it has never seen before! You can use OpenCV for object detection, segmentation and then feed the output to the neural network.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2015-01-18 07:41:59 -0600

Seen: 4,330 times

Last updated: Jan 18 '15