Ask Your Question

Revision history [back]

Okay here comes the bunch of problems

  1. You are using HAAR training specific flags, but you train with the traincascade app and with the LBP features. So start by removing the CV_HAAR_SCALE_IMAGE | CV_HAAR_DO_CANNY_PRUNING it is simply redundant with your model. For explanation look at the docs, which clearly state it is not used anymore.
  2. You are mixing old C - API code with the C++ interface. Start by changing cvSize to Size functions.
  3. You are defining a scale range from 0,0 to 5000,5000 which is probably your image size. That is however not what the size factors are doing. They are there to define the borders of your image pyramid.

Okay here comes the bunch of problems

  1. You are using HAAR training specific flags, but you train with the traincascade app and with the LBP features. So start by removing the CV_HAAR_SCALE_IMAGE | CV_HAAR_DO_CANNY_PRUNING it is simply redundant with your model. For explanation look at the docs, which clearly state it is not used anymore.
  2. You are mixing old C - API code with the C++ interface. Start by changing cvSize to Size functions.
  3. You are defining a scale range from 0,0 to 5000,5000 which is probably your image size. That is however not what the size factors are doing. They are there to define the borders of your image pyramid.pyramid. Also your minimum size can never be smaller than the model size you trained on, the 0,0 dimensions are quite meaningless.

Okay here comes the bunch of problems

  1. You are using HAAR training specific flags, but you train with the traincascade app and with the LBP features. So start by removing the CV_HAAR_SCALE_IMAGE | CV_HAAR_DO_CANNY_PRUNING it is simply redundant with your model. For explanation look at the docs, which clearly state it is not used anymore.
  2. You are mixing old C - API code with the C++ interface. Start by changing cvSize to Size functions.
  3. You are defining a scale range from 0,0 to 5000,5000 which is probably your image size. That is however not what the size factors are doing. They are there to define the borders of your image pyramid. Also your minimum size can never be smaller than the model size you trained on, the 0,0 dimensions are quite meaningless.
  4. A cascade classifier is NOT rotation invariant, so you train it with samples that are oriented all to a same normalized position. If you apply different rotations, than the descriptive power of your model will be reduced yielding more false positive detections and less true positive detections.

So I suggest changing your command to

Okay here comes the bunch of problems

  1. You are using HAAR training specific flags, but you train with the traincascade app and with the LBP features. So start by removing the CV_HAAR_SCALE_IMAGE | CV_HAAR_DO_CANNY_PRUNING it is simply redundant with your model. For explanation look at the docs, which clearly state it is not used anymore.
  2. You are mixing old C - API code with the C++ interface. Start by changing cvSize to Size functions.
  3. You are defining a scale range from 0,0 to 5000,5000 which is probably your image size. That is however not what the size factors are doing. They are there to define the borders of your image pyramid. Also your minimum size can never be smaller than the model size you trained on, the 0,0 dimensions are quite meaningless.
  4. A cascade classifier is NOT rotation invariant, so you train it with samples that are oriented all to a same normalized position. If you apply different rotations, than the descriptive power of your model will be reduced yielding more false positive detections and less true positive detections.

So I suggest changing your command to

object_detect.detectMultiScale(grayImage, object, 1.1, 10);