$search
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 // Third party copyrights are property of their respective owners. 00016 // 00017 // Redistribution and use in source and binary forms, with or without modification, 00018 // are permitted provided that the following conditions are met: 00019 // 00020 // * Redistribution's of source code must retain the above copyright notice, 00021 // this list of conditions and the following disclaimer. 00022 // 00023 // * Redistribution's in binary form must reproduce the above copyright notice, 00024 // this list of conditions and the following disclaimer in the documentation 00025 // and/or other materials provided with the distribution. 00026 // 00027 // * The name of the copyright holders may not be used to endorse or promote products 00028 // derived from this software without specific prior written permission. 00029 // 00030 // This software is provided by the copyright holders and contributors "as is" and 00031 // any express or implied warranties, including, but not limited to, the implied 00032 // warranties of merchantability and fitness for a particular purpose are disclaimed. 00033 // In no event shall the Intel Corporation or contributors be liable for any direct, 00034 // indirect, incidental, special, exemplary, or consequential damages 00035 // (including, but not limited to, procurement of substitute goods or services; 00036 // loss of use, data, or profits; or business interruption) however caused 00037 // and on any theory of liability, whether in contract, strict liability, 00038 // or tort (including negligence or otherwise) arising in any way out of 00039 // the use of this software, even if advised of the possibility of such damage. 00040 // 00041 //M*/ 00042 00043 #ifndef _OPENCV_PRECOMP_HPP_ 00044 #define _OPENCV_PRECOMP_HPP_ 00045 00046 #if defined _MSC_VER && _MSC_VER >= 1200 00047 // disable warnings related to inline functions 00048 #pragma warning( disable: 4251 4711 4710 4514 ) 00049 #endif 00050 00051 #include "opencv2/imgproc/imgproc.hpp" 00052 #include "opencv2/imgproc/imgproc_c.h" 00053 #include "opencv2/core/internal.hpp" 00054 #include <math.h> 00055 #include <assert.h> 00056 #include <string.h> 00057 #include <stdlib.h> 00058 #include <stdio.h> 00059 #include <limits.h> 00060 #include <float.h> 00061 00062 /* helper tables */ 00063 extern const uchar icvSaturate8u_cv[]; 00064 #define CV_FAST_CAST_8U(t) (assert(-256 <= (t) || (t) <= 512), icvSaturate8u_cv[(t)+256]) 00065 #define CV_CALC_MIN_8U(a,b) (a) -= CV_FAST_CAST_8U((a) - (b)) 00066 #define CV_CALC_MAX_8U(a,b) (a) += CV_FAST_CAST_8U((b) - (a)) 00067 00068 // -256.f ... 511.f 00069 extern const float icv8x32fTab_cv[]; 00070 #define CV_8TO32F(x) icv8x32fTab_cv[(x)+256] 00071 00072 // (-128.f)^2 ... (255.f)^2 00073 extern const float icv8x32fSqrTab[]; 00074 #define CV_8TO32F_SQR(x) icv8x32fSqrTab[(x)+128] 00075 00076 namespace cv 00077 { 00078 00079 static inline Point normalizeAnchor( Point anchor, Size ksize ) 00080 { 00081 if( anchor.x == -1 ) 00082 anchor.x = ksize.width/2; 00083 if( anchor.y == -1 ) 00084 anchor.y = ksize.height/2; 00085 CV_Assert( anchor.inside(Rect(0, 0, ksize.width, ksize.height)) ); 00086 return anchor; 00087 } 00088 00089 void preprocess2DKernel( const Mat& kernel, vector<Point>& coords, vector<uchar>& coeffs ); 00090 void crossCorr( const Mat& src, const Mat& templ, Mat& dst, 00091 Point anchor=Point(0,0), double delta=0, 00092 int borderType=BORDER_REFLECT_101 ); 00093 00094 } 00095 00096 typedef struct CvPyramid 00097 { 00098 uchar **ptr; 00099 CvSize *sz; 00100 double *rate; 00101 int *step; 00102 uchar *state; 00103 int level; 00104 } 00105 CvPyramid; 00106 00107 #define CV_COPY( dst, src, len, idx ) \ 00108 for( (idx) = 0; (idx) < (len); (idx)++) (dst)[idx] = (src)[idx] 00109 00110 #define CV_SET( dst, val, len, idx ) \ 00111 for( (idx) = 0; (idx) < (len); (idx)++) (dst)[idx] = (val) 00112 00113 /* performs convolution of 2d floating-point array with 3x1, 1x3 or separable 3x3 mask */ 00114 void icvSepConvSmall3_32f( float* src, int src_step, float* dst, int dst_step, 00115 CvSize src_size, const float* kx, const float* ky, float* buffer ); 00116 00117 #undef CV_CALC_MIN 00118 #define CV_CALC_MIN(a, b) if((a) > (b)) (a) = (b) 00119 00120 #undef CV_CALC_MAX 00121 #define CV_CALC_MAX(a, b) if((a) < (b)) (a) = (b) 00122 00123 void 00124 icvCrossCorr( const CvArr* _img, const CvArr* _templ, 00125 CvArr* _corr, CvPoint anchor=cvPoint(0,0), 00126 double delta=0, int borderType=IPL_BORDER_REPLICATE); 00127 00128 CvStatus CV_STDCALL 00129 icvCopyReplicateBorder_8u( const uchar* src, int srcstep, CvSize srcroi, 00130 uchar* dst, int dststep, CvSize dstroi, 00131 int left, int right, int cn, const uchar* value = 0 ); 00132 00133 CvStatus CV_STDCALL icvGetRectSubPix_8u_C1R 00134 ( const uchar* src, int src_step, CvSize src_size, 00135 uchar* dst, int dst_step, CvSize win_size, CvPoint2D32f center ); 00136 CvStatus CV_STDCALL icvGetRectSubPix_8u32f_C1R 00137 ( const uchar* src, int src_step, CvSize src_size, 00138 float* dst, int dst_step, CvSize win_size, CvPoint2D32f center ); 00139 CvStatus CV_STDCALL icvGetRectSubPix_32f_C1R 00140 ( const float* src, int src_step, CvSize src_size, 00141 float* dst, int dst_step, CvSize win_size, CvPoint2D32f center ); 00142 00143 CvStatus CV_STDCALL icvGetQuadrangleSubPix_8u_C1R 00144 ( const uchar* src, int src_step, CvSize src_size, 00145 uchar* dst, int dst_step, CvSize win_size, const float *matrix ); 00146 CvStatus CV_STDCALL icvGetQuadrangleSubPix_8u32f_C1R 00147 ( const uchar* src, int src_step, CvSize src_size, 00148 float* dst, int dst_step, CvSize win_size, const float *matrix ); 00149 CvStatus CV_STDCALL icvGetQuadrangleSubPix_32f_C1R 00150 ( const float* src, int src_step, CvSize src_size, 00151 float* dst, int dst_step, CvSize win_size, const float *matrix ); 00152 00153 #include "_geom.h" 00154 00155 #endif /*__OPENCV_CV_INTERNAL_H_*/