Ask Your Question

What is the difference between traincascade and other feature detector?

asked 2013-01-17 08:58:26 -0500

Jean-François Côté gravatar image

updated 2020-11-02 17:25:45 -0500


We have a project that needs to detect animals on pictures. We started with rats and we are using trainscascade for this. Since we are not experiencing any luck with this method, I started looking in openCV documentation and found other method like template, SURF, etc...

Are these method also good for detecting complex things like animals (for example, rats?). Do you have any experience with them and could tell me the good and bad of each? Also, let me know if I'm wrong but the traincascade use the XML that we train ourselve (via the apps given by opencv) but how to we train the other type of feature detector?

Sorry if this question is dumb, I just want to learn :)

edit retag flag offensive close merge delete

1 answer

Sort by » oldest newest most voted

answered 2013-01-17 09:38:21 -0500

Ben gravatar image

There is a difference between object detection and feature detection. Object detection is a very difficult task and its results strongly depend on the object you want to detect and image samples you used for training. A Haar cascade for example works good for rigid, non rotated objects taken from the same perspective. This is, why you get good results for faces, because they are rather rigid and usually have the same orientation.

Features describe somehow characteristic image spots or regions like edges or corners. A feature consists of

  • a keypoint with
    • x- and y-coordinates
    • scale (for scale invariant features)
    • orientation (for orientation invariant features)


  • a descriptor, which is usually a fixed-length vector describing the area defined by the keypoint. Computing image features consists of first detecting keypoints and then extracting their descriptors. There is no training needed for that.

Using features for object detection can be done for example with a method called 'Bag of Words' (BOW). BOW extracts features from the object samples and tries to define a set of features, which are characteristic for that object.

A method, which I find returns impressive results in terms of detection accuracy is the LatentSvmDetector. Unfortunately, OpenCV doesn't provide any methods to train your own objects (yet?). There are a few trained models available like people, cats, airplanes, but I'm afraid there's no rats ;)

edit flag offensive delete link more


Very clear answer! Thanks a lot

Jean-François Côté gravatar imageJean-François Côté ( 2013-01-17 10:31:19 -0500 )edit

(yet?) - yes, we don't have the code for the training procedure.

AlexanderShishkov gravatar imageAlexanderShishkov ( 2013-01-17 10:44:15 -0500 )edit

Question Tools


Asked: 2013-01-17 08:58:26 -0500

Seen: 658 times

Last updated: Jan 17 '13