Ask Your Question

Is HaarDetectObjects rotation invariant ?

asked 2012-08-29 09:44:54 -0600

humbleAR gravatar image

updated 2012-08-29 09:45:46 -0600

Hello everyone,

I understand that the HaarDetectObjects function based on Viola-Jones algorithm takes in consideration different window scales so I guess it is scale invariant. But Nothing being said about rotation invariance, I read that it's possible to make it rotation invariant by choosing the right Haar features (for example 4x rotated features by 45 degrees). But is it done by default in the provided XML file ?

Also, I would like to know, if it is symmetry invariant. For example, training on profiles of people looking to the right will work on people looking to the left ?

Thanks in advance.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2012-08-29 09:57:03 -0600

Ben gravatar image

No, it's not rotation invariant. And it's not symmetry invariant.

The rotated features you mentioned are probably the tilted Haar-like features. They don't provide rotation invariance.

edit flag offensive delete link more


Interesting, so, is there an alternative to that ? I mean, what to do to have something that is rotation invariant ? and as a bonus symmetry invariant ?

humbleAR gravatar imagehumbleAR ( 2012-08-29 09:59:45 -0600 )edit

For example to detect planes that can be flying or landing or taking off...

humbleAR gravatar imagehumbleAR ( 2012-08-29 10:02:09 -0600 )edit

You can rotate/mirror the image and run multiple detections, but that's expensive and will result in many more false positives. Have a look at the CvLatentSvmDetector. It can handle such things much better. And you're lucky: there is already a training for planes under <OpenCV trunk>/opencv_extra/testdata/cv/latentsvmdetector/models_VOC2007/aeroplanes.xml

Ben gravatar imageBen ( 2012-08-29 10:15:01 -0600 )edit

Thanks a lot for the info, very helpful.

humbleAR gravatar imagehumbleAR ( 2012-08-29 10:39:05 -0600 )edit

@Ben: Latent SVM takes a lot of time in detection. Its consuming 10-20 secs per frame for me. Do we have the aeroplane model available for Haartraining as well?

vinayverma gravatar imagevinayverma ( 2013-05-12 23:47:06 -0600 )edit

I have never used CvLatentSvmDetector but I would be surprised if it is rotation invariant. The underlying method is not.

SR gravatar imageSR ( 2013-06-30 16:36:30 -0600 )edit

I'm not a LatentSVM expert, but I think you can use training samples with different rotation angles to achieve rotation invariance. This won't work with HaarDetection. I tested some of the LatentSVM models provided in OpenCV some time ago and they seemed to be rather robust regarding perspective changes, so I guess rotation invariance should be achievable with it, too.

Ben gravatar imageBen ( 2013-07-01 02:51:51 -0600 )edit

Question Tools

1 follower


Asked: 2012-08-29 09:44:54 -0600

Seen: 4,000 times

Last updated: Aug 29 '12