Ask Your Question

Some questions about training LBP classifier.

asked 2014-04-22 05:30:36 -0500

Loam gravatar image

updated 2014-04-22 05:31:33 -0500


I'm working on creating LBP or HAAR classifier for detecting cars top view. I have created LBP classifier and when i checked it's work, it finds only vertically oriented cars and even not all of them: result1 result2

1) Could this be due to the fact that in all samples I used images with a clear cut vertically disposed cars? I mean i rotated them myself vertically and cuted using Adobe Photoshop. For example:

car1 car2 car3

And does this mean that i have to cut cars from images like this (with parts of ground): car1 car2 car3

OR it's just because i used too few pictures (150 positives -> opencv_createsamples -> 600 samples)?

OR because of both reasons?

2) opencv_createsamples.exe applies to much distortions that i do not need, especially Z angle. With wich parameters should i run this programm to not to make Z distortion? (probably: -maxzangle 0 (?))

Pls give me some advises ;)

P.S. sorry for my bad English

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2014-04-22 05:49:39 -0500

  1. Keep in mind that cascade classifiers are not rotation invariant! You should stick to one orientation for your model and then keep rotating the original image until you hit a detection. Also keep in mind that a up facing car, isn't the same as a down facing car. Ratios of gradient regions are completely different!
  2. More positives will definitely be neccesary! Car models are trained using multiple thousand samples. What you did is training a car detector which has to be identical or almost to the cars trained ... to loose those dependencies more data is needed.
  3. Don't use the distortions of createsamples, instead just work with the second option, which is a file containing all detection images and the region of interest. Distortions only create artificial data, which will not be present in real life situations...
edit flag offensive delete link more


  1. You mean to rotate images in programm which uses classifier?
  2. I have to create 2 classifiers for an up facing car and a down facing car or what?
  3. And last. I still can't understand: i have to cut cars neatly rotating them to one direction or just use opencv_objdetect for example, which means i will have a file containing all images and ROI (in ROI will be a car with it's own orientation and pieces of ground).
Loam gravatar imageLoam ( 2014-04-22 06:16:23 -0500 )edit
  1. Yes either that or you create a model for each rotation
  2. Yes you do OR you can basically just flip your image over the horizontal axis and combine all detections
  3. You have to rotate them all, or only use an ROI on upstraight cars! It won't work on multiple orientations ...
StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-22 07:22:25 -0500 )edit

@StevenPuttemans Thank you very much, i'l try what u said and will response later

Loam gravatar imageLoam ( 2014-04-22 15:51:44 -0500 )edit

Shouldn't LBP be rotation invariant?

sachi gravatar imagesachi ( 2016-03-04 05:28:34 -0500 )edit

No - the LBP descriptor is rotation invariant to the position of its center, but the histogram of LBP features used as features for a cascade classifier are NOT rotation invariant.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-03-04 05:50:10 -0500 )edit

whaat can you sugggest for a rotation and orientation invariant object detection?

bertumen.wj gravatar imagebertumen.wj ( 2016-08-28 16:53:21 -0500 )edit

As suggested above, I am using a single model, multiple rotation approach myself. It is described as a possible approach for rotation invariant face detection, in the book OpenCV 3 Blueprints, chapter 5.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-08-29 03:48:03 -0500 )edit

Question Tools

1 follower


Asked: 2014-04-22 05:30:36 -0500

Seen: 1,170 times

Last updated: Apr 22 '14