43 #ifndef __OPENCV_OBJDETECT_HPP__
44 #define __OPENCV_OBJDETECT_HPP__
56 #define CV_HAAR_MAGIC_VAL 0x42500000
57 #define CV_TYPE_NAME_HAAR "opencv-haar-classifier"
59 #define CV_IS_HAAR_CLASSIFIER( haar ) \
61 (((const CvHaarClassifierCascade*)(haar))->flags & CV_MAGIC_MASK)==CV_HAAR_MAGIC_VAL)
63 #define CV_HAAR_FEATURE_MAX 3
118 const
char* directory,
CvSize orig_window_size);
122 #define CV_HAAR_DO_CANNY_PRUNING 1
123 #define CV_HAAR_SCALE_IMAGE 2
124 #define CV_HAAR_FIND_BIGGEST_OBJECT 4
125 #define CV_HAAR_DO_ROUGH_SEARCH 8
130 int min_neighbors CV_DEFAULT(3),
int flags CV_DEFAULT(0),
140 CvPoint pt,
int start_stage CV_DEFAULT(0));
177 float fineFunction[4];
279 enum { HAAR = 0, LBP = 1 };
283 virtual int getFeatureType()
const;
285 virtual bool setImage(
const Mat&,
Size origWinSize);
286 virtual bool setWindow(
Point p);
288 virtual double calcOrd(
int featureIdx)
const;
289 virtual int calcCat(
int featureIdx)
const;
320 enum { DO_CANNY_PRUNING = 1, SCALE_IMAGE = 2,
321 FIND_BIGGEST_OBJECT = 4, DO_ROUGH_SEARCH = 8 };
328 CV_WRAP bool load(
const string& filename);
330 CV_WRAP void detectMultiScale(
const Mat& image,
331 CV_OUT vector<Rect>& objects,
332 double scaleFactor=1.1,
333 int minNeighbors=3,
int flags=0,
364 enum { DEFAULT_NLEVELS=64 };
367 cellSize(8,8), nbins(9), derivAperture(1), winSigma(-1),
368 histogramNormType(HOGDescriptor::L2Hys), L2HysThreshold(0.2), gammaCorrection(true),
369 nlevels(HOGDescriptor::DEFAULT_NLEVELS)
373 Size _cellSize,
int _nbins,
int _derivAperture=1,
double _winSigma=-1,
375 double _L2HysThreshold=0.2,
bool _gammaCorrection=
false,
377 : winSize(_winSize), blockSize(_blockSize), blockStride(_blockStride), cellSize(_cellSize),
378 nbins(_nbins), derivAperture(_derivAperture), winSigma(_winSigma),
379 histogramNormType(_histogramNormType), L2HysThreshold(_L2HysThreshold),
380 gammaCorrection(_gammaCorrection), nlevels(_nlevels)
395 CV_WRAP size_t getDescriptorSize()
const;
396 CV_WRAP bool checkDetectorSize()
const;
397 CV_WRAP double getWinSigma()
const;
399 CV_WRAP virtual void setSVMDetector(
const vector<float>& _svmdetector);
409 CV_OUT vector<float>& descriptors,
411 const vector<Point>& locations=vector<Point>())
const;
412 CV_WRAP virtual void detect(
const Mat& img,
CV_OUT vector<Point>& foundLocations,
413 double hitThreshold=0,
Size winStride=
Size(),
415 const vector<Point>& searchLocations=vector<Point>())
const;
416 CV_WRAP virtual void detectMultiScale(
const Mat& img,
CV_OUT vector<Rect>& foundLocations,
417 double hitThreshold=0,
Size winStride=
Size(),
419 int groupThreshold=2)
const;
423 static vector<float> getDefaultPeopleDetector();