openCV library for Renesas RZ/A

Dependents:   RZ_A2M_Mbed_samples

Committer:
RyoheiHagimoto
Date:
Fri Jan 29 04:53:38 2021 +0000
Revision:
0:0e0631af0305
copied from https://github.com/d-kato/opencv-lib.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
RyoheiHagimoto 0:0e0631af0305 1 /*M///////////////////////////////////////////////////////////////////////////////////////
RyoheiHagimoto 0:0e0631af0305 2 //
RyoheiHagimoto 0:0e0631af0305 3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
RyoheiHagimoto 0:0e0631af0305 4 //
RyoheiHagimoto 0:0e0631af0305 5 // By downloading, copying, installing or using the software you agree to this license.
RyoheiHagimoto 0:0e0631af0305 6 // If you do not agree to this license, do not download, install,
RyoheiHagimoto 0:0e0631af0305 7 // copy or use the software.
RyoheiHagimoto 0:0e0631af0305 8 //
RyoheiHagimoto 0:0e0631af0305 9 //
RyoheiHagimoto 0:0e0631af0305 10 // License Agreement
RyoheiHagimoto 0:0e0631af0305 11 // For Open Source Computer Vision Library
RyoheiHagimoto 0:0e0631af0305 12 //
RyoheiHagimoto 0:0e0631af0305 13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
RyoheiHagimoto 0:0e0631af0305 14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
RyoheiHagimoto 0:0e0631af0305 15 // Copyright (C) 2013, OpenCV Foundation, all rights reserved.
RyoheiHagimoto 0:0e0631af0305 16 // Third party copyrights are property of their respective owners.
RyoheiHagimoto 0:0e0631af0305 17 //
RyoheiHagimoto 0:0e0631af0305 18 // Redistribution and use in source and binary forms, with or without modification,
RyoheiHagimoto 0:0e0631af0305 19 // are permitted provided that the following conditions are met:
RyoheiHagimoto 0:0e0631af0305 20 //
RyoheiHagimoto 0:0e0631af0305 21 // * Redistribution's of source code must retain the above copyright notice,
RyoheiHagimoto 0:0e0631af0305 22 // this list of conditions and the following disclaimer.
RyoheiHagimoto 0:0e0631af0305 23 //
RyoheiHagimoto 0:0e0631af0305 24 // * Redistribution's in binary form must reproduce the above copyright notice,
RyoheiHagimoto 0:0e0631af0305 25 // this list of conditions and the following disclaimer in the documentation
RyoheiHagimoto 0:0e0631af0305 26 // and/or other materials provided with the distribution.
RyoheiHagimoto 0:0e0631af0305 27 //
RyoheiHagimoto 0:0e0631af0305 28 // * The name of the copyright holders may not be used to endorse or promote products
RyoheiHagimoto 0:0e0631af0305 29 // derived from this software without specific prior written permission.
RyoheiHagimoto 0:0e0631af0305 30 //
RyoheiHagimoto 0:0e0631af0305 31 // This software is provided by the copyright holders and contributors "as is" and
RyoheiHagimoto 0:0e0631af0305 32 // any express or implied warranties, including, but not limited to, the implied
RyoheiHagimoto 0:0e0631af0305 33 // warranties of merchantability and fitness for a particular purpose are disclaimed.
RyoheiHagimoto 0:0e0631af0305 34 // In no event shall the Intel Corporation or contributors be liable for any direct,
RyoheiHagimoto 0:0e0631af0305 35 // indirect, incidental, special, exemplary, or consequential damages
RyoheiHagimoto 0:0e0631af0305 36 // (including, but not limited to, procurement of substitute goods or services;
RyoheiHagimoto 0:0e0631af0305 37 // loss of use, data, or profits; or business interruption) however caused
RyoheiHagimoto 0:0e0631af0305 38 // and on any theory of liability, whether in contract, strict liability,
RyoheiHagimoto 0:0e0631af0305 39 // or tort (including negligence or otherwise) arising in any way out of
RyoheiHagimoto 0:0e0631af0305 40 // the use of this software, even if advised of the possibility of such damage.
RyoheiHagimoto 0:0e0631af0305 41 //
RyoheiHagimoto 0:0e0631af0305 42 //M*/
RyoheiHagimoto 0:0e0631af0305 43
RyoheiHagimoto 0:0e0631af0305 44 #ifndef OPENCV_OBJDETECT_C_H
RyoheiHagimoto 0:0e0631af0305 45 #define OPENCV_OBJDETECT_C_H
RyoheiHagimoto 0:0e0631af0305 46
RyoheiHagimoto 0:0e0631af0305 47 #include "opencv2/core/core_c.h"
RyoheiHagimoto 0:0e0631af0305 48
RyoheiHagimoto 0:0e0631af0305 49 #ifdef __cplusplus
RyoheiHagimoto 0:0e0631af0305 50 #include <deque>
RyoheiHagimoto 0:0e0631af0305 51 #include <vector>
RyoheiHagimoto 0:0e0631af0305 52
RyoheiHagimoto 0:0e0631af0305 53 extern "C" {
RyoheiHagimoto 0:0e0631af0305 54 #endif
RyoheiHagimoto 0:0e0631af0305 55
RyoheiHagimoto 0:0e0631af0305 56 /** @addtogroup objdetect_c
RyoheiHagimoto 0:0e0631af0305 57 @{
RyoheiHagimoto 0:0e0631af0305 58 */
RyoheiHagimoto 0:0e0631af0305 59
RyoheiHagimoto 0:0e0631af0305 60 /****************************************************************************************\
RyoheiHagimoto 0:0e0631af0305 61 * Haar-like Object Detection functions *
RyoheiHagimoto 0:0e0631af0305 62 \****************************************************************************************/
RyoheiHagimoto 0:0e0631af0305 63
RyoheiHagimoto 0:0e0631af0305 64 #define CV_HAAR_MAGIC_VAL 0x42500000
RyoheiHagimoto 0:0e0631af0305 65 #define CV_TYPE_NAME_HAAR "opencv-haar-classifier"
RyoheiHagimoto 0:0e0631af0305 66
RyoheiHagimoto 0:0e0631af0305 67 #define CV_IS_HAAR_CLASSIFIER( haar ) \
RyoheiHagimoto 0:0e0631af0305 68 ((haar) != NULL && \
RyoheiHagimoto 0:0e0631af0305 69 (((const CvHaarClassifierCascade*)(haar))->flags & CV_MAGIC_MASK)==CV_HAAR_MAGIC_VAL)
RyoheiHagimoto 0:0e0631af0305 70
RyoheiHagimoto 0:0e0631af0305 71 #define CV_HAAR_FEATURE_MAX 3
RyoheiHagimoto 0:0e0631af0305 72
RyoheiHagimoto 0:0e0631af0305 73 typedef struct CvHaarFeature
RyoheiHagimoto 0:0e0631af0305 74 {
RyoheiHagimoto 0:0e0631af0305 75 int tilted;
RyoheiHagimoto 0:0e0631af0305 76 struct
RyoheiHagimoto 0:0e0631af0305 77 {
RyoheiHagimoto 0:0e0631af0305 78 CvRect r;
RyoheiHagimoto 0:0e0631af0305 79 float weight;
RyoheiHagimoto 0:0e0631af0305 80 } rect[CV_HAAR_FEATURE_MAX];
RyoheiHagimoto 0:0e0631af0305 81 } CvHaarFeature;
RyoheiHagimoto 0:0e0631af0305 82
RyoheiHagimoto 0:0e0631af0305 83 typedef struct CvHaarClassifier
RyoheiHagimoto 0:0e0631af0305 84 {
RyoheiHagimoto 0:0e0631af0305 85 int count;
RyoheiHagimoto 0:0e0631af0305 86 CvHaarFeature* haar_feature;
RyoheiHagimoto 0:0e0631af0305 87 float* threshold;
RyoheiHagimoto 0:0e0631af0305 88 int* left;
RyoheiHagimoto 0:0e0631af0305 89 int* right;
RyoheiHagimoto 0:0e0631af0305 90 float* alpha;
RyoheiHagimoto 0:0e0631af0305 91 } CvHaarClassifier;
RyoheiHagimoto 0:0e0631af0305 92
RyoheiHagimoto 0:0e0631af0305 93 typedef struct CvHaarStageClassifier
RyoheiHagimoto 0:0e0631af0305 94 {
RyoheiHagimoto 0:0e0631af0305 95 int count;
RyoheiHagimoto 0:0e0631af0305 96 float threshold;
RyoheiHagimoto 0:0e0631af0305 97 CvHaarClassifier* classifier;
RyoheiHagimoto 0:0e0631af0305 98
RyoheiHagimoto 0:0e0631af0305 99 int next;
RyoheiHagimoto 0:0e0631af0305 100 int child;
RyoheiHagimoto 0:0e0631af0305 101 int parent;
RyoheiHagimoto 0:0e0631af0305 102 } CvHaarStageClassifier;
RyoheiHagimoto 0:0e0631af0305 103
RyoheiHagimoto 0:0e0631af0305 104 typedef struct CvHidHaarClassifierCascade CvHidHaarClassifierCascade;
RyoheiHagimoto 0:0e0631af0305 105
RyoheiHagimoto 0:0e0631af0305 106 typedef struct CvHaarClassifierCascade
RyoheiHagimoto 0:0e0631af0305 107 {
RyoheiHagimoto 0:0e0631af0305 108 int flags;
RyoheiHagimoto 0:0e0631af0305 109 int count;
RyoheiHagimoto 0:0e0631af0305 110 CvSize orig_window_size;
RyoheiHagimoto 0:0e0631af0305 111 CvSize real_window_size;
RyoheiHagimoto 0:0e0631af0305 112 double scale;
RyoheiHagimoto 0:0e0631af0305 113 CvHaarStageClassifier* stage_classifier;
RyoheiHagimoto 0:0e0631af0305 114 CvHidHaarClassifierCascade* hid_cascade;
RyoheiHagimoto 0:0e0631af0305 115 } CvHaarClassifierCascade;
RyoheiHagimoto 0:0e0631af0305 116
RyoheiHagimoto 0:0e0631af0305 117 typedef struct CvAvgComp
RyoheiHagimoto 0:0e0631af0305 118 {
RyoheiHagimoto 0:0e0631af0305 119 CvRect rect;
RyoheiHagimoto 0:0e0631af0305 120 int neighbors;
RyoheiHagimoto 0:0e0631af0305 121 } CvAvgComp;
RyoheiHagimoto 0:0e0631af0305 122
RyoheiHagimoto 0:0e0631af0305 123 /* Loads haar classifier cascade from a directory.
RyoheiHagimoto 0:0e0631af0305 124 It is obsolete: convert your cascade to xml and use cvLoad instead */
RyoheiHagimoto 0:0e0631af0305 125 CVAPI(CvHaarClassifierCascade*) cvLoadHaarClassifierCascade(
RyoheiHagimoto 0:0e0631af0305 126 const char* directory, CvSize orig_window_size);
RyoheiHagimoto 0:0e0631af0305 127
RyoheiHagimoto 0:0e0631af0305 128 CVAPI(void) cvReleaseHaarClassifierCascade( CvHaarClassifierCascade** cascade );
RyoheiHagimoto 0:0e0631af0305 129
RyoheiHagimoto 0:0e0631af0305 130 #define CV_HAAR_DO_CANNY_PRUNING 1
RyoheiHagimoto 0:0e0631af0305 131 #define CV_HAAR_SCALE_IMAGE 2
RyoheiHagimoto 0:0e0631af0305 132 #define CV_HAAR_FIND_BIGGEST_OBJECT 4
RyoheiHagimoto 0:0e0631af0305 133 #define CV_HAAR_DO_ROUGH_SEARCH 8
RyoheiHagimoto 0:0e0631af0305 134
RyoheiHagimoto 0:0e0631af0305 135 CVAPI(CvSeq*) cvHaarDetectObjects( const CvArr* image,
RyoheiHagimoto 0:0e0631af0305 136 CvHaarClassifierCascade* cascade, CvMemStorage* storage,
RyoheiHagimoto 0:0e0631af0305 137 double scale_factor CV_DEFAULT(1.1),
RyoheiHagimoto 0:0e0631af0305 138 int min_neighbors CV_DEFAULT(3), int flags CV_DEFAULT(0),
RyoheiHagimoto 0:0e0631af0305 139 CvSize min_size CV_DEFAULT(cvSize(0,0)), CvSize max_size CV_DEFAULT(cvSize(0,0)));
RyoheiHagimoto 0:0e0631af0305 140
RyoheiHagimoto 0:0e0631af0305 141 /* sets images for haar classifier cascade */
RyoheiHagimoto 0:0e0631af0305 142 CVAPI(void) cvSetImagesForHaarClassifierCascade( CvHaarClassifierCascade* cascade,
RyoheiHagimoto 0:0e0631af0305 143 const CvArr* sum, const CvArr* sqsum,
RyoheiHagimoto 0:0e0631af0305 144 const CvArr* tilted_sum, double scale );
RyoheiHagimoto 0:0e0631af0305 145
RyoheiHagimoto 0:0e0631af0305 146 /* runs the cascade on the specified window */
RyoheiHagimoto 0:0e0631af0305 147 CVAPI(int) cvRunHaarClassifierCascade( const CvHaarClassifierCascade* cascade,
RyoheiHagimoto 0:0e0631af0305 148 CvPoint pt, int start_stage CV_DEFAULT(0));
RyoheiHagimoto 0:0e0631af0305 149
RyoheiHagimoto 0:0e0631af0305 150 /** @} objdetect_c */
RyoheiHagimoto 0:0e0631af0305 151
RyoheiHagimoto 0:0e0631af0305 152 #ifdef __cplusplus
RyoheiHagimoto 0:0e0631af0305 153 }
RyoheiHagimoto 0:0e0631af0305 154
RyoheiHagimoto 0:0e0631af0305 155 CV_EXPORTS CvSeq* cvHaarDetectObjectsForROC( const CvArr* image,
RyoheiHagimoto 0:0e0631af0305 156 CvHaarClassifierCascade* cascade, CvMemStorage* storage,
RyoheiHagimoto 0:0e0631af0305 157 std::vector<int>& rejectLevels, std::vector<double>& levelWeightds,
RyoheiHagimoto 0:0e0631af0305 158 double scale_factor = 1.1,
RyoheiHagimoto 0:0e0631af0305 159 int min_neighbors = 3, int flags = 0,
RyoheiHagimoto 0:0e0631af0305 160 CvSize min_size = cvSize(0, 0), CvSize max_size = cvSize(0, 0),
RyoheiHagimoto 0:0e0631af0305 161 bool outputRejectLevels = false );
RyoheiHagimoto 0:0e0631af0305 162
RyoheiHagimoto 0:0e0631af0305 163 #endif
RyoheiHagimoto 0:0e0631af0305 164
RyoheiHagimoto 0:0e0631af0305 165 #endif /* OPENCV_OBJDETECT_C_H */