Ask Your Question

haar classifier detection vs feature detection,extraction and matching

asked 2013-04-13 02:48:41 -0500

sreenidhy gravatar image

updated 2013-04-13 04:49:57 -0500


I have started using opencv from past few weeks. I am learning about ways of doing object detection. I see that there are primarily 2 different approaches to do object detection:

  1. Use positive and negative image set, build classifier and use the classifier to detect objects
  2. Use the keypoint detection, descriptor extraction and matching to detect objects

I would like to know when to apply which technique? I also found that the 2nd method internally has multiple algorithms to do each step like SIFT, SURF, ORB, FlannMatcher so on. My primary aim is to first understand when to use classifier technique and when to use feature extraction technique? Once I understand that, I can further look at the different approaches within them.

Please correct me if my understanding above is wrong and let me know the differences between the 2 approaches.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-04-13 07:08:20 -0500

Guanta gravatar image

First you need to detect the object in your images -> object detection, i.e. locating the object's position in an image (e.g. pedestrians).

If you also want to categorize it -> object recognition, i.e. identifying the object (e.g. a specific person), no information where it is located in the image is involved in this step.

You (and also Steven - no offense!) mix here several things: keypoint-detectors and descriptor-extractors like the mentioned ones can be used for both tasks. Furthermore you can use classifiers for object detection and for object recognition.

You ask, when to use which algorithm. This is a very difficult question and depends very much on your problem you want to solve and the data you are using.

edit flag offensive delete link more


Thanks Guanta. I should have mentioned my use case in the question, sorry about that. My aim is to only detect the presence of an object, like a human in the scene, car in the scene, bicycle in the scene so on. I do not need to be more specific in terms of what exactly is the detected object (not required to tell if the car is say audi or bmw or mustang or whatever). From the answers, I understand that object detection can be done using the different classifier techniques. But, you also mention that keypoint-detectors and descriptor-extractors can be used for same purpose. Could you please tell me if that is the case, for my purposes of just detecting the presence of an object (accurate information is not required), which approach would be better?

sreenidhy gravatar imagesreenidhy ( 2013-04-13 11:37:35 -0500 )edit

Okay, two ways: 1. Either, you train for each of your class a cascade-classifier. 2. Or you can use a bag of words approach (there you need feature detector/descriptor) and classify your bag-of-words-descriptor with your favorite classifier (since you have multiple classes you should use classifiers which inherently support multiple classes (Decision Trees, Random Forests, etc...). Both ways are totally fine, the basic difference is that in the CascadeClassifier you use histograms of LBP-features (or HAAR or HOG), and train them, instead of bag-of-words-descriptors (which you could also create by histogram of LBPs).

Guanta gravatar imageGuanta ( 2013-04-13 12:10:01 -0500 )edit

Thanks for your suggestions!!

sreenidhy gravatar imagesreenidhy ( 2013-04-14 18:48:31 -0500 )edit

answered 2013-04-13 04:58:10 -0500

Basically what you have here is a difference between object detection and object recognition. Let me clear that out for you:

  1. Object recognition means that you know the object beforehand. You know its shape, you know its specific properties. With that knowledge you want to scan an entire scene and see if these properties reoccur. Once they do and enough matches have been found, a recognition can be performed.
  2. Object detection tries to tackle the largest problem of object recognition. Take for example you want to find cows in an image. You know how a cow actually looks like, but you still have alot of variation in between different cows (e.g. different position of black and white regions). This is called intra-class variability. Humans for example are the most variate class you can probably use as an example (different clothing, different sizes, gender differences, ...). What object detection basically does is creating an abstract model of the 'class' of objects that you want to find. It then uses again that model to scan a given scene and look for matches between the model and the scene. If enough overlap is found, then a detection is returned.

Knowing that you can easily say which techniques to use where:

  1. Detection techniques like the cascade classifier of Viola&Jones, an SVM classifier or even a random forest classifier, are all ways to perform object detection.
  2. Recognition techniques are based on similar points which can be extracted as interesting feature points by a feature detector, then a region around the point is converted to a abstract form, called a feature description done by a feature descriptor. Finally a matcher is used to look for samelike structures among these descriptions.

Does this make it more clear for you?

edit flag offensive delete link more


Thanks Steven.

That makes more sense to me now. My purpose is only to detect objects and I do not need to recognize what exactly it is. So from the explanation I understand that I can do this using cascade classifier or svm classifier or random forest classifier. I do not need to consider using the keypoint detection-descriptor extraction-descriptor matching method for now.

sreenidhy gravatar imagesreenidhy ( 2013-04-13 11:27:35 -0500 )edit

Question Tools

1 follower


Asked: 2013-04-13 02:48:41 -0500

Seen: 6,829 times

Last updated: Apr 13 '13