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_IMGPROC_TYPES_C_H__ 00044 #define __OPENCV_IMGPROC_TYPES_C_H__ 00045 00046 #include "opencv2/core/core_c.h" 00047 #include "opencv2/imgproc/types_c.h" 00048 00049 #ifdef __cplusplus 00050 extern "C" { 00051 #endif 00052 00053 /* Connected component structure */ 00054 typedef struct CvConnectedComp 00055 { 00056 double area; /* area of the connected component */ 00057 CvScalar value; /* average color of the connected component */ 00058 CvRect rect; /* ROI of the component */ 00059 CvSeq* contour; /* optional component boundary 00060 (the contour might have child contours corresponding to the holes)*/ 00061 } 00062 CvConnectedComp; 00063 00064 /* Image smooth methods */ 00065 enum 00066 { 00067 CV_BLUR_NO_SCALE =0, 00068 CV_BLUR =1, 00069 CV_GAUSSIAN =2, 00070 CV_MEDIAN =3, 00071 CV_BILATERAL =4 00072 }; 00073 00074 /* Filters used in pyramid decomposition */ 00075 enum 00076 { 00077 CV_GAUSSIAN_5x5 = 7 00078 }; 00079 00080 /* Inpainting algorithms */ 00081 enum 00082 { 00083 CV_INPAINT_NS =0, 00084 CV_INPAINT_TELEA =1 00085 }; 00086 00087 /* Special filters */ 00088 enum 00089 { 00090 CV_SCHARR =-1, 00091 CV_MAX_SOBEL_KSIZE =7 00092 }; 00093 00094 /* Constants for color conversion */ 00095 enum 00096 { 00097 CV_BGR2BGRA =0, 00098 CV_RGB2RGBA =CV_BGR2BGRA, 00099 00100 CV_BGRA2BGR =1, 00101 CV_RGBA2RGB =CV_BGRA2BGR, 00102 00103 CV_BGR2RGBA =2, 00104 CV_RGB2BGRA =CV_BGR2RGBA, 00105 00106 CV_RGBA2BGR =3, 00107 CV_BGRA2RGB =CV_RGBA2BGR, 00108 00109 CV_BGR2RGB =4, 00110 CV_RGB2BGR =CV_BGR2RGB, 00111 00112 CV_BGRA2RGBA =5, 00113 CV_RGBA2BGRA =CV_BGRA2RGBA, 00114 00115 CV_BGR2GRAY =6, 00116 CV_RGB2GRAY =7, 00117 CV_GRAY2BGR =8, 00118 CV_GRAY2RGB =CV_GRAY2BGR, 00119 CV_GRAY2BGRA =9, 00120 CV_GRAY2RGBA =CV_GRAY2BGRA, 00121 CV_BGRA2GRAY =10, 00122 CV_RGBA2GRAY =11, 00123 00124 CV_BGR2BGR565 =12, 00125 CV_RGB2BGR565 =13, 00126 CV_BGR5652BGR =14, 00127 CV_BGR5652RGB =15, 00128 CV_BGRA2BGR565 =16, 00129 CV_RGBA2BGR565 =17, 00130 CV_BGR5652BGRA =18, 00131 CV_BGR5652RGBA =19, 00132 00133 CV_GRAY2BGR565 =20, 00134 CV_BGR5652GRAY =21, 00135 00136 CV_BGR2BGR555 =22, 00137 CV_RGB2BGR555 =23, 00138 CV_BGR5552BGR =24, 00139 CV_BGR5552RGB =25, 00140 CV_BGRA2BGR555 =26, 00141 CV_RGBA2BGR555 =27, 00142 CV_BGR5552BGRA =28, 00143 CV_BGR5552RGBA =29, 00144 00145 CV_GRAY2BGR555 =30, 00146 CV_BGR5552GRAY =31, 00147 00148 CV_BGR2XYZ =32, 00149 CV_RGB2XYZ =33, 00150 CV_XYZ2BGR =34, 00151 CV_XYZ2RGB =35, 00152 00153 CV_BGR2YCrCb =36, 00154 CV_RGB2YCrCb =37, 00155 CV_YCrCb2BGR =38, 00156 CV_YCrCb2RGB =39, 00157 00158 CV_BGR2HSV =40, 00159 CV_RGB2HSV =41, 00160 00161 CV_BGR2Lab =44, 00162 CV_RGB2Lab =45, 00163 00164 CV_BayerBG2BGR =46, 00165 CV_BayerGB2BGR =47, 00166 CV_BayerRG2BGR =48, 00167 CV_BayerGR2BGR =49, 00168 00169 CV_BayerBG2RGB =CV_BayerRG2BGR, 00170 CV_BayerGB2RGB =CV_BayerGR2BGR, 00171 CV_BayerRG2RGB =CV_BayerBG2BGR, 00172 CV_BayerGR2RGB =CV_BayerGB2BGR, 00173 00174 CV_BGR2Luv =50, 00175 CV_RGB2Luv =51, 00176 CV_BGR2HLS =52, 00177 CV_RGB2HLS =53, 00178 00179 CV_HSV2BGR =54, 00180 CV_HSV2RGB =55, 00181 00182 CV_Lab2BGR =56, 00183 CV_Lab2RGB =57, 00184 CV_Luv2BGR =58, 00185 CV_Luv2RGB =59, 00186 CV_HLS2BGR =60, 00187 CV_HLS2RGB =61, 00188 00189 CV_BayerBG2BGR_VNG =62, 00190 CV_BayerGB2BGR_VNG =63, 00191 CV_BayerRG2BGR_VNG =64, 00192 CV_BayerGR2BGR_VNG =65, 00193 00194 CV_BayerBG2RGB_VNG =CV_BayerRG2BGR_VNG, 00195 CV_BayerGB2RGB_VNG =CV_BayerGR2BGR_VNG, 00196 CV_BayerRG2RGB_VNG =CV_BayerBG2BGR_VNG, 00197 CV_BayerGR2RGB_VNG =CV_BayerGB2BGR_VNG, 00198 00199 CV_BGR2HSV_FULL = 66, 00200 CV_RGB2HSV_FULL = 67, 00201 CV_BGR2HLS_FULL = 68, 00202 CV_RGB2HLS_FULL = 69, 00203 00204 CV_HSV2BGR_FULL = 70, 00205 CV_HSV2RGB_FULL = 71, 00206 CV_HLS2BGR_FULL = 72, 00207 CV_HLS2RGB_FULL = 73, 00208 00209 CV_LBGR2Lab = 74, 00210 CV_LRGB2Lab = 75, 00211 CV_LBGR2Luv = 76, 00212 CV_LRGB2Luv = 77, 00213 00214 CV_Lab2LBGR = 78, 00215 CV_Lab2LRGB = 79, 00216 CV_Luv2LBGR = 80, 00217 CV_Luv2LRGB = 81, 00218 00219 CV_BGR2YUV = 82, 00220 CV_RGB2YUV = 83, 00221 CV_YUV2BGR = 84, 00222 CV_YUV2RGB = 85, 00223 00224 CV_BayerBG2GRAY = 86, 00225 CV_BayerGB2GRAY = 87, 00226 CV_BayerRG2GRAY = 88, 00227 CV_BayerGR2GRAY = 89, 00228 00229 CV_YUV420i2RGB = 90, 00230 CV_YUV420i2BGR = 91, 00231 00232 CV_COLORCVT_MAX =100 00233 }; 00234 00235 00236 /* Sub-pixel interpolation methods */ 00237 enum 00238 { 00239 CV_INTER_NN =0, 00240 CV_INTER_LINEAR =1, 00241 CV_INTER_CUBIC =2, 00242 CV_INTER_AREA =3, 00243 CV_INTER_LANCZOS4 =4 00244 }; 00245 00246 /* ... and other image warping flags */ 00247 enum 00248 { 00249 CV_WARP_FILL_OUTLIERS =8, 00250 CV_WARP_INVERSE_MAP =16 00251 }; 00252 00253 /* Shapes of a structuring element for morphological operations */ 00254 enum 00255 { 00256 CV_SHAPE_RECT =0, 00257 CV_SHAPE_CROSS =1, 00258 CV_SHAPE_ELLIPSE =2, 00259 CV_SHAPE_CUSTOM =100 00260 }; 00261 00262 /* Morphological operations */ 00263 enum 00264 { 00265 CV_MOP_ERODE =0, 00266 CV_MOP_DILATE =1, 00267 CV_MOP_OPEN =2, 00268 CV_MOP_CLOSE =3, 00269 CV_MOP_GRADIENT =4, 00270 CV_MOP_TOPHAT =5, 00271 CV_MOP_BLACKHAT =6 00272 }; 00273 00274 /* Spatial and central moments */ 00275 typedef struct CvMoments 00276 { 00277 double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /* spatial moments */ 00278 double mu20, mu11, mu02, mu30, mu21, mu12, mu03; /* central moments */ 00279 double inv_sqrt_m00; /* m00 != 0 ? 1/sqrt(m00) : 0 */ 00280 } 00281 CvMoments; 00282 00283 /* Hu invariants */ 00284 typedef struct CvHuMoments 00285 { 00286 double hu1, hu2, hu3, hu4, hu5, hu6, hu7; /* Hu invariants */ 00287 } 00288 CvHuMoments; 00289 00290 /* Template matching methods */ 00291 enum 00292 { 00293 CV_TM_SQDIFF =0, 00294 CV_TM_SQDIFF_NORMED =1, 00295 CV_TM_CCORR =2, 00296 CV_TM_CCORR_NORMED =3, 00297 CV_TM_CCOEFF =4, 00298 CV_TM_CCOEFF_NORMED =5 00299 }; 00300 00301 typedef float (CV_CDECL * CvDistanceFunction)( const float* a, const float* b, void* user_param ); 00302 00303 /* Contour retrieval modes */ 00304 enum 00305 { 00306 CV_RETR_EXTERNAL=0, 00307 CV_RETR_LIST=1, 00308 CV_RETR_CCOMP=2, 00309 CV_RETR_TREE=3 00310 }; 00311 00312 /* Contour approximation methods */ 00313 enum 00314 { 00315 CV_CHAIN_CODE=0, 00316 CV_CHAIN_APPROX_NONE=1, 00317 CV_CHAIN_APPROX_SIMPLE=2, 00318 CV_CHAIN_APPROX_TC89_L1=3, 00319 CV_CHAIN_APPROX_TC89_KCOS=4, 00320 CV_LINK_RUNS=5 00321 }; 00322 00323 /* 00324 Internal structure that is used for sequental retrieving contours from the image. 00325 It supports both hierarchical and plane variants of Suzuki algorithm. 00326 */ 00327 typedef struct _CvContourScanner* CvContourScanner; 00328 00329 /* Freeman chain reader state */ 00330 typedef struct CvChainPtReader 00331 { 00332 CV_SEQ_READER_FIELDS() 00333 char code; 00334 CvPoint pt; 00335 schar deltas[8][2]; 00336 } 00337 CvChainPtReader; 00338 00339 /* initializes 8-element array for fast access to 3x3 neighborhood of a pixel */ 00340 #define CV_INIT_3X3_DELTAS( deltas, step, nch ) \ 00341 ((deltas)[0] = (nch), (deltas)[1] = -(step) + (nch), \ 00342 (deltas)[2] = -(step), (deltas)[3] = -(step) - (nch), \ 00343 (deltas)[4] = -(nch), (deltas)[5] = (step) - (nch), \ 00344 (deltas)[6] = (step), (deltas)[7] = (step) + (nch)) 00345 00346 00347 /****************************************************************************************\ 00348 * Planar subdivisions * 00349 \****************************************************************************************/ 00350 00351 typedef size_t CvSubdiv2DEdge; 00352 00353 #define CV_QUADEDGE2D_FIELDS() \ 00354 int flags; \ 00355 struct CvSubdiv2DPoint* pt[4]; \ 00356 CvSubdiv2DEdge next[4]; 00357 00358 #define CV_SUBDIV2D_POINT_FIELDS()\ 00359 int flags; \ 00360 CvSubdiv2DEdge first; \ 00361 CvPoint2D32f pt; \ 00362 int id; 00363 00364 #define CV_SUBDIV2D_VIRTUAL_POINT_FLAG (1 << 30) 00365 00366 typedef struct CvQuadEdge2D 00367 { 00368 CV_QUADEDGE2D_FIELDS() 00369 } 00370 CvQuadEdge2D; 00371 00372 typedef struct CvSubdiv2DPoint 00373 { 00374 CV_SUBDIV2D_POINT_FIELDS() 00375 } 00376 CvSubdiv2DPoint; 00377 00378 #define CV_SUBDIV2D_FIELDS() \ 00379 CV_GRAPH_FIELDS() \ 00380 int quad_edges; \ 00381 int is_geometry_valid; \ 00382 CvSubdiv2DEdge recent_edge; \ 00383 CvPoint2D32f topleft; \ 00384 CvPoint2D32f bottomright; 00385 00386 typedef struct CvSubdiv2D 00387 { 00388 CV_SUBDIV2D_FIELDS() 00389 } 00390 CvSubdiv2D; 00391 00392 00393 typedef enum CvSubdiv2DPointLocation 00394 { 00395 CV_PTLOC_ERROR = -2, 00396 CV_PTLOC_OUTSIDE_RECT = -1, 00397 CV_PTLOC_INSIDE = 0, 00398 CV_PTLOC_VERTEX = 1, 00399 CV_PTLOC_ON_EDGE = 2 00400 } 00401 CvSubdiv2DPointLocation; 00402 00403 typedef enum CvNextEdgeType 00404 { 00405 CV_NEXT_AROUND_ORG = 0x00, 00406 CV_NEXT_AROUND_DST = 0x22, 00407 CV_PREV_AROUND_ORG = 0x11, 00408 CV_PREV_AROUND_DST = 0x33, 00409 CV_NEXT_AROUND_LEFT = 0x13, 00410 CV_NEXT_AROUND_RIGHT = 0x31, 00411 CV_PREV_AROUND_LEFT = 0x20, 00412 CV_PREV_AROUND_RIGHT = 0x02 00413 } 00414 CvNextEdgeType; 00415 00416 /* get the next edge with the same origin point (counterwise) */ 00417 #define CV_SUBDIV2D_NEXT_EDGE( edge ) (((CvQuadEdge2D*)((edge) & ~3))->next[(edge)&3]) 00418 00419 00420 /* Contour approximation algorithms */ 00421 enum 00422 { 00423 CV_POLY_APPROX_DP = 0 00424 }; 00425 00426 /* Shape matching methods */ 00427 enum 00428 { 00429 CV_CONTOURS_MATCH_I1 =1, 00430 CV_CONTOURS_MATCH_I2 =2, 00431 CV_CONTOURS_MATCH_I3 =3 00432 }; 00433 00434 /* Shape orientation */ 00435 enum 00436 { 00437 CV_CLOCKWISE =1, 00438 CV_COUNTER_CLOCKWISE =2 00439 }; 00440 00441 00442 /* Convexity defect */ 00443 typedef struct CvConvexityDefect 00444 { 00445 CvPoint* start; /* point of the contour where the defect begins */ 00446 CvPoint* end; /* point of the contour where the defect ends */ 00447 CvPoint* depth_point; /* the farthest from the convex hull point within the defect */ 00448 float depth; /* distance between the farthest point and the convex hull */ 00449 } CvConvexityDefect; 00450 00451 00452 /* Histogram comparison methods */ 00453 enum 00454 { 00455 CV_COMP_CORREL =0, 00456 CV_COMP_CHISQR =1, 00457 CV_COMP_INTERSECT =2, 00458 CV_COMP_BHATTACHARYYA =3 00459 }; 00460 00461 /* Mask size for distance transform */ 00462 enum 00463 { 00464 CV_DIST_MASK_3 =3, 00465 CV_DIST_MASK_5 =5, 00466 CV_DIST_MASK_PRECISE =0 00467 }; 00468 00469 /* Distance types for Distance Transform and M-estimators */ 00470 enum 00471 { 00472 CV_DIST_USER =-1, /* User defined distance */ 00473 CV_DIST_L1 =1, /* distance = |x1-x2| + |y1-y2| */ 00474 CV_DIST_L2 =2, /* the simple euclidean distance */ 00475 CV_DIST_C =3, /* distance = max(|x1-x2|,|y1-y2|) */ 00476 CV_DIST_L12 =4, /* L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) */ 00477 CV_DIST_FAIR =5, /* distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 */ 00478 CV_DIST_WELSCH =6, /* distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 */ 00479 CV_DIST_HUBER =7 /* distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 */ 00480 }; 00481 00482 00483 /* Threshold types */ 00484 enum 00485 { 00486 CV_THRESH_BINARY =0, /* value = value > threshold ? max_value : 0 */ 00487 CV_THRESH_BINARY_INV =1, /* value = value > threshold ? 0 : max_value */ 00488 CV_THRESH_TRUNC =2, /* value = value > threshold ? threshold : value */ 00489 CV_THRESH_TOZERO =3, /* value = value > threshold ? value : 0 */ 00490 CV_THRESH_TOZERO_INV =4, /* value = value > threshold ? 0 : value */ 00491 CV_THRESH_MASK =7, 00492 CV_THRESH_OTSU =8 /* use Otsu algorithm to choose the optimal threshold value; 00493 combine the flag with one of the above CV_THRESH_* values */ 00494 }; 00495 00496 /* Adaptive threshold methods */ 00497 enum 00498 { 00499 CV_ADAPTIVE_THRESH_MEAN_C =0, 00500 CV_ADAPTIVE_THRESH_GAUSSIAN_C =1 00501 }; 00502 00503 /* FloodFill flags */ 00504 enum 00505 { 00506 CV_FLOODFILL_FIXED_RANGE =(1 << 16), 00507 CV_FLOODFILL_MASK_ONLY =(1 << 17) 00508 }; 00509 00510 00511 /* Canny edge detector flags */ 00512 enum 00513 { 00514 CV_CANNY_L2_GRADIENT =(1 << 31) 00515 }; 00516 00517 /* Variants of a Hough transform */ 00518 enum 00519 { 00520 CV_HOUGH_STANDARD =0, 00521 CV_HOUGH_PROBABILISTIC =1, 00522 CV_HOUGH_MULTI_SCALE =2, 00523 CV_HOUGH_GRADIENT =3 00524 }; 00525 00526 00527 /* Fast search data structures */ 00528 struct CvFeatureTree; 00529 struct CvLSH; 00530 struct CvLSHOperations; 00531 00532 #ifdef __cplusplus 00533 } 00534 #endif 00535 00536 #endif