1
/*M///////////////////////////////////////////////////////////////////////////////////////
3
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
5
// By downloading, copying, installing or using the software you agree to this license.
6
// If you do not agree to this license, do not download, install,
7
// copy or use the software.
11
// For Open Source Computer Vision Library
13
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15
// Copyright (C) 2013, OpenCV Foundation, all rights reserved.
16
// Third party copyrights are property of their respective owners.
18
// Redistribution and use in source and binary forms, with or without modification,
19
// are permitted provided that the following conditions are met:
21
// * Redistribution's of source code must retain the above copyright notice,
22
// this list of conditions and the following disclaimer.
24
// * Redistribution's in binary form must reproduce the above copyright notice,
25
// this list of conditions and the following disclaimer in the documentation
26
// and/or other materials provided with the distribution.
28
// * The name of the copyright holders may not be used to endorse or promote products
29
// derived from this software without specific prior written permission.
31
// This software is provided by the copyright holders and contributors "as is" and
32
// any express or implied warranties, including, but not limited to, the implied
33
// warranties of merchantability and fitness for a particular purpose are disclaimed.
34
// In no event shall the Intel Corporation or contributors be liable for any direct,
35
// indirect, incidental, special, exemplary, or consequential damages
36
// (including, but not limited to, procurement of substitute goods or services;
37
// loss of use, data, or profits; or business interruption) however caused
38
// and on any theory of liability, whether in contract, strict liability,
39
// or tort (including negligence or otherwise) arising in any way out of
40
// the use of this software, even if advised of the possibility of such damage.
44
#ifndef __OPENCV_OBJDETECT_C_H__
45
#define __OPENCV_OBJDETECT_C_H__
47
#include "opencv2/core/core_c.h"
56
/** @addtogroup objdetect_c
60
/****************************************************************************************\
61
* Haar-like Object Detection functions *
62
\****************************************************************************************/
64
#define CV_HAAR_MAGIC_VAL 0x42500000
65
#define CV_TYPE_NAME_HAAR "opencv-haar-classifier"
67
#define CV_IS_HAAR_CLASSIFIER( haar ) \
69
(((const CvHaarClassifierCascade*)(haar))->flags & CV_MAGIC_MASK)==CV_HAAR_MAGIC_VAL)
71
#define CV_HAAR_FEATURE_MAX 3
73
typedef struct CvHaarFeature
80
} rect[CV_HAAR_FEATURE_MAX];
83
typedef struct CvHaarClassifier
86
CvHaarFeature* haar_feature;
93
typedef struct CvHaarStageClassifier
97
CvHaarClassifier* classifier;
102
} CvHaarStageClassifier;
104
typedef struct CvHidHaarClassifierCascade CvHidHaarClassifierCascade;
106
typedef struct CvHaarClassifierCascade
110
CvSize orig_window_size;
111
CvSize real_window_size;
113
CvHaarStageClassifier* stage_classifier;
114
CvHidHaarClassifierCascade* hid_cascade;
115
} CvHaarClassifierCascade;
117
typedef struct CvAvgComp
123
/* Loads haar classifier cascade from a directory.
124
It is obsolete: convert your cascade to xml and use cvLoad instead */
125
CVAPI(CvHaarClassifierCascade*) cvLoadHaarClassifierCascade(
126
const char* directory, CvSize orig_window_size);
128
CVAPI(void) cvReleaseHaarClassifierCascade( CvHaarClassifierCascade** cascade );
130
#define CV_HAAR_DO_CANNY_PRUNING 1
131
#define CV_HAAR_SCALE_IMAGE 2
132
#define CV_HAAR_FIND_BIGGEST_OBJECT 4
133
#define CV_HAAR_DO_ROUGH_SEARCH 8
135
CVAPI(CvSeq*) cvHaarDetectObjects( const CvArr* image,
136
CvHaarClassifierCascade* cascade, CvMemStorage* storage,
137
double scale_factor CV_DEFAULT(1.1),
138
int min_neighbors CV_DEFAULT(3), int flags CV_DEFAULT(0),
139
CvSize min_size CV_DEFAULT(cvSize(0,0)), CvSize max_size CV_DEFAULT(cvSize(0,0)));
141
/* sets images for haar classifier cascade */
142
CVAPI(void) cvSetImagesForHaarClassifierCascade( CvHaarClassifierCascade* cascade,
143
const CvArr* sum, const CvArr* sqsum,
144
const CvArr* tilted_sum, double scale );
146
/* runs the cascade on the specified window */
147
CVAPI(int) cvRunHaarClassifierCascade( const CvHaarClassifierCascade* cascade,
148
CvPoint pt, int start_stage CV_DEFAULT(0));
150
/** @} objdetect_c */
155
CV_EXPORTS CvSeq* cvHaarDetectObjectsForROC( const CvArr* image,
156
CvHaarClassifierCascade* cascade, CvMemStorage* storage,
157
std::vector<int>& rejectLevels, std::vector<double>& levelWeightds,
158
double scale_factor = 1.1,
159
int min_neighbors = 3, int flags = 0,
160
CvSize min_size = cvSize(0, 0), CvSize max_size = cvSize(0, 0),
161
bool outputRejectLevels = false );
165
#endif /* __OPENCV_OBJDETECT_C_H__ */