opencv on mbed

Dependencies:   mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers objdetect_c.h Source File

objdetect_c.h

00001 /*M///////////////////////////////////////////////////////////////////////////////////////
00002 //
00003 //  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
00004 //
00005 //  By downloading, copying, installing or using the software you agree to this license.
00006 //  If you do not agree to this license, do not download, install,
00007 //  copy or use the software.
00008 //
00009 //
00010 //                          License Agreement
00011 //                For Open Source Computer Vision Library
00012 //
00013 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
00014 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
00015 // Copyright (C) 2013, OpenCV Foundation, all rights reserved.
00016 // Third party copyrights are property of their respective owners.
00017 //
00018 // Redistribution and use in source and binary forms, with or without modification,
00019 // are permitted provided that the following conditions are met:
00020 //
00021 //   * Redistribution's of source code must retain the above copyright notice,
00022 //     this list of conditions and the following disclaimer.
00023 //
00024 //   * Redistribution's in binary form must reproduce the above copyright notice,
00025 //     this list of conditions and the following disclaimer in the documentation
00026 //     and/or other materials provided with the distribution.
00027 //
00028 //   * The name of the copyright holders may not be used to endorse or promote products
00029 //     derived from this software without specific prior written permission.
00030 //
00031 // This software is provided by the copyright holders and contributors "as is" and
00032 // any express or implied warranties, including, but not limited to, the implied
00033 // warranties of merchantability and fitness for a particular purpose are disclaimed.
00034 // In no event shall the Intel Corporation or contributors be liable for any direct,
00035 // indirect, incidental, special, exemplary, or consequential damages
00036 // (including, but not limited to, procurement of substitute goods or services;
00037 // loss of use, data, or profits; or business interruption) however caused
00038 // and on any theory of liability, whether in contract, strict liability,
00039 // or tort (including negligence or otherwise) arising in any way out of
00040 // the use of this software, even if advised of the possibility of such damage.
00041 //
00042 //M*/
00043 
00044 #ifndef __OPENCV_OBJDETECT_C_H__
00045 #define __OPENCV_OBJDETECT_C_H__
00046 
00047 #include "opencv2/core/core_c.h"
00048 
00049 #ifdef __cplusplus
00050 #include <deque>
00051 #include <vector>
00052 
00053 extern "C" {
00054 #endif
00055 
00056 /** @addtogroup objdetect_c
00057   @{
00058   */
00059 
00060 /****************************************************************************************\
00061 *                         Haar-like Object Detection functions                           *
00062 \****************************************************************************************/
00063 
00064 #define CV_HAAR_MAGIC_VAL    0x42500000
00065 #define CV_TYPE_NAME_HAAR    "opencv-haar-classifier"
00066 
00067 #define CV_IS_HAAR_CLASSIFIER( haar )                                                    \
00068     ((haar) != NULL &&                                                                   \
00069     (((const CvHaarClassifierCascade*)(haar))->flags & CV_MAGIC_MASK)==CV_HAAR_MAGIC_VAL)
00070 
00071 #define CV_HAAR_FEATURE_MAX  3
00072 
00073 typedef struct CvHaarFeature
00074 {
00075     int tilted;
00076     struct
00077     {
00078         CvRect  r;
00079         float weight;
00080     } rect[CV_HAAR_FEATURE_MAX];
00081 } CvHaarFeature;
00082 
00083 typedef struct CvHaarClassifier
00084 {
00085     int count;
00086     CvHaarFeature* haar_feature;
00087     float* threshold;
00088     int* left;
00089     int* right;
00090     float* alpha;
00091 } CvHaarClassifier;
00092 
00093 typedef struct CvHaarStageClassifier
00094 {
00095     int  count;
00096     float threshold;
00097     CvHaarClassifier* classifier;
00098 
00099     int next;
00100     int child;
00101     int parent;
00102 } CvHaarStageClassifier;
00103 
00104 typedef struct CvHidHaarClassifierCascade CvHidHaarClassifierCascade;
00105 
00106 typedef struct CvHaarClassifierCascade
00107 {
00108     int  flags;
00109     int  count;
00110     CvSize orig_window_size;
00111     CvSize real_window_size;
00112     double scale;
00113     CvHaarStageClassifier* stage_classifier;
00114     CvHidHaarClassifierCascade* hid_cascade;
00115 } CvHaarClassifierCascade;
00116 
00117 typedef struct CvAvgComp
00118 {
00119     CvRect  rect;
00120     int neighbors;
00121 } CvAvgComp;
00122 
00123 /* Loads haar classifier cascade from a directory.
00124    It is obsolete: convert your cascade to xml and use cvLoad instead */
00125 CVAPI(CvHaarClassifierCascade*) cvLoadHaarClassifierCascade(
00126                     const char* directory, CvSize orig_window_size);
00127 
00128 CVAPI(void) cvReleaseHaarClassifierCascade( CvHaarClassifierCascade** cascade );
00129 
00130 #define CV_HAAR_DO_CANNY_PRUNING    1
00131 #define CV_HAAR_SCALE_IMAGE         2
00132 #define CV_HAAR_FIND_BIGGEST_OBJECT 4
00133 #define CV_HAAR_DO_ROUGH_SEARCH     8
00134 
00135 CVAPI(CvSeq*) cvHaarDetectObjects( const CvArr* image,
00136                      CvHaarClassifierCascade* cascade, CvMemStorage* storage,
00137                      double scale_factor CV_DEFAULT(1.1),
00138                      int min_neighbors CV_DEFAULT(3), int flags CV_DEFAULT(0),
00139                      CvSize min_size CV_DEFAULT(cvSize(0,0)), CvSize max_size CV_DEFAULT(cvSize(0,0)));
00140 
00141 /* sets images for haar classifier cascade */
00142 CVAPI(void) cvSetImagesForHaarClassifierCascade( CvHaarClassifierCascade* cascade,
00143                                                 const CvArr* sum, const CvArr* sqsum,
00144                                                 const CvArr* tilted_sum, double scale );
00145 
00146 /* runs the cascade on the specified window */
00147 CVAPI(int) cvRunHaarClassifierCascade( const CvHaarClassifierCascade* cascade,
00148                                        CvPoint pt, int start_stage CV_DEFAULT(0));
00149 
00150 /** @} objdetect_c */
00151 
00152 #ifdef __cplusplus
00153 }
00154 
00155 CV_EXPORTS CvSeq* cvHaarDetectObjectsForROC( const CvArr* image,
00156                      CvHaarClassifierCascade* cascade, CvMemStorage* storage,
00157                      std::vector<int>& rejectLevels, std::vector<double>& levelWeightds,
00158                      double scale_factor = 1.1,
00159                      int min_neighbors = 3, int flags = 0,
00160                      CvSize min_size = cvSize(0, 0), CvSize max_size = cvSize(0, 0),
00161                      bool outputRejectLevels = false );
00162 
00163 #endif
00164 
00165 #endif /* __OPENCV_OBJDETECT_C_H__ */
00166