opencv 2.2.0
|
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_COLORCVT_MAX =100 00230 }; 00231 00232 00233 /* Sub-pixel interpolation methods */ 00234 enum 00235 { 00236 CV_INTER_NN =0, 00237 CV_INTER_LINEAR =1, 00238 CV_INTER_CUBIC =2, 00239 CV_INTER_AREA =3, 00240 CV_INTER_LANCZOS4 =4 00241 }; 00242 00243 /* ... and other image warping flags */ 00244 enum 00245 { 00246 CV_WARP_FILL_OUTLIERS =8, 00247 CV_WARP_INVERSE_MAP =16 00248 }; 00249 00250 /* Shapes of a structuring element for morphological operations */ 00251 enum 00252 { 00253 CV_SHAPE_RECT =0, 00254 CV_SHAPE_CROSS =1, 00255 CV_SHAPE_ELLIPSE =2, 00256 CV_SHAPE_CUSTOM =100 00257 }; 00258 00259 /* Morphological operations */ 00260 enum 00261 { 00262 CV_MOP_ERODE =0, 00263 CV_MOP_DILATE =1, 00264 CV_MOP_OPEN =2, 00265 CV_MOP_CLOSE =3, 00266 CV_MOP_GRADIENT =4, 00267 CV_MOP_TOPHAT =5, 00268 CV_MOP_BLACKHAT =6 00269 }; 00270 00271 /* Spatial and central moments */ 00272 typedef struct CvMoments 00273 { 00274 double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /* spatial moments */ 00275 double mu20, mu11, mu02, mu30, mu21, mu12, mu03; /* central moments */ 00276 double inv_sqrt_m00; /* m00 != 0 ? 1/sqrt(m00) : 0 */ 00277 } 00278 CvMoments; 00279 00280 /* Hu invariants */ 00281 typedef struct CvHuMoments 00282 { 00283 double hu1, hu2, hu3, hu4, hu5, hu6, hu7; /* Hu invariants */ 00284 } 00285 CvHuMoments; 00286 00287 /* Template matching methods */ 00288 enum 00289 { 00290 CV_TM_SQDIFF =0, 00291 CV_TM_SQDIFF_NORMED =1, 00292 CV_TM_CCORR =2, 00293 CV_TM_CCORR_NORMED =3, 00294 CV_TM_CCOEFF =4, 00295 CV_TM_CCOEFF_NORMED =5 00296 }; 00297 00298 typedef float (CV_CDECL * CvDistanceFunction)( const float* a, const float* b, void* user_param ); 00299 00300 /* Contour retrieval modes */ 00301 enum 00302 { 00303 CV_RETR_EXTERNAL=0, 00304 CV_RETR_LIST=1, 00305 CV_RETR_CCOMP=2, 00306 CV_RETR_TREE=3 00307 }; 00308 00309 /* Contour approximation methods */ 00310 enum 00311 { 00312 CV_CHAIN_CODE=0, 00313 CV_CHAIN_APPROX_NONE=1, 00314 CV_CHAIN_APPROX_SIMPLE=2, 00315 CV_CHAIN_APPROX_TC89_L1=3, 00316 CV_CHAIN_APPROX_TC89_KCOS=4, 00317 CV_LINK_RUNS=5 00318 }; 00319 00320 /* 00321 Internal structure that is used for sequental retrieving contours from the image. 00322 It supports both hierarchical and plane variants of Suzuki algorithm. 00323 */ 00324 typedef struct _CvContourScanner* CvContourScanner; 00325 00326 /* Freeman chain reader state */ 00327 typedef struct CvChainPtReader 00328 { 00329 CV_SEQ_READER_FIELDS() 00330 char code; 00331 CvPoint pt; 00332 schar deltas[8][2]; 00333 } 00334 CvChainPtReader; 00335 00336 /* initializes 8-element array for fast access to 3x3 neighborhood of a pixel */ 00337 #define CV_INIT_3X3_DELTAS( deltas, step, nch ) \ 00338 ((deltas)[0] = (nch), (deltas)[1] = -(step) + (nch), \ 00339 (deltas)[2] = -(step), (deltas)[3] = -(step) - (nch), \ 00340 (deltas)[4] = -(nch), (deltas)[5] = (step) - (nch), \ 00341 (deltas)[6] = (step), (deltas)[7] = (step) + (nch)) 00342 00343 00344 /****************************************************************************************\ 00345 * Planar subdivisions * 00346 \****************************************************************************************/ 00347 00348 typedef size_t CvSubdiv2DEdge; 00349 00350 #define CV_QUADEDGE2D_FIELDS() \ 00351 int flags; \ 00352 struct CvSubdiv2DPoint* pt[4]; \ 00353 CvSubdiv2DEdge next[4]; 00354 00355 #define CV_SUBDIV2D_POINT_FIELDS()\ 00356 int flags; \ 00357 CvSubdiv2DEdge first; \ 00358 CvPoint2D32f pt; \ 00359 int id; 00360 00361 #define CV_SUBDIV2D_VIRTUAL_POINT_FLAG (1 << 30) 00362 00363 typedef struct CvQuadEdge2D 00364 { 00365 CV_QUADEDGE2D_FIELDS() 00366 } 00367 CvQuadEdge2D; 00368 00369 typedef struct CvSubdiv2DPoint 00370 { 00371 CV_SUBDIV2D_POINT_FIELDS() 00372 } 00373 CvSubdiv2DPoint; 00374 00375 #define CV_SUBDIV2D_FIELDS() \ 00376 CV_GRAPH_FIELDS() \ 00377 int quad_edges; \ 00378 int is_geometry_valid; \ 00379 CvSubdiv2DEdge recent_edge; \ 00380 CvPoint2D32f topleft; \ 00381 CvPoint2D32f bottomright; 00382 00383 typedef struct CvSubdiv2D 00384 { 00385 CV_SUBDIV2D_FIELDS() 00386 } 00387 CvSubdiv2D; 00388 00389 00390 typedef enum CvSubdiv2DPointLocation 00391 { 00392 CV_PTLOC_ERROR = -2, 00393 CV_PTLOC_OUTSIDE_RECT = -1, 00394 CV_PTLOC_INSIDE = 0, 00395 CV_PTLOC_VERTEX = 1, 00396 CV_PTLOC_ON_EDGE = 2 00397 } 00398 CvSubdiv2DPointLocation; 00399 00400 typedef enum CvNextEdgeType 00401 { 00402 CV_NEXT_AROUND_ORG = 0x00, 00403 CV_NEXT_AROUND_DST = 0x22, 00404 CV_PREV_AROUND_ORG = 0x11, 00405 CV_PREV_AROUND_DST = 0x33, 00406 CV_NEXT_AROUND_LEFT = 0x13, 00407 CV_NEXT_AROUND_RIGHT = 0x31, 00408 CV_PREV_AROUND_LEFT = 0x20, 00409 CV_PREV_AROUND_RIGHT = 0x02 00410 } 00411 CvNextEdgeType; 00412 00413 /* get the next edge with the same origin point (counterwise) */ 00414 #define CV_SUBDIV2D_NEXT_EDGE( edge ) (((CvQuadEdge2D*)((edge) & ~3))->next[(edge)&3]) 00415 00416 00417 /* Contour approximation algorithms */ 00418 enum 00419 { 00420 CV_POLY_APPROX_DP = 0 00421 }; 00422 00423 /* Shape matching methods */ 00424 enum 00425 { 00426 CV_CONTOURS_MATCH_I1 =1, 00427 CV_CONTOURS_MATCH_I2 =2, 00428 CV_CONTOURS_MATCH_I3 =3 00429 }; 00430 00431 /* Shape orientation */ 00432 enum 00433 { 00434 CV_CLOCKWISE =1, 00435 CV_COUNTER_CLOCKWISE =2 00436 }; 00437 00438 00439 /* Convexity defect */ 00440 typedef struct CvConvexityDefect 00441 { 00442 CvPoint* start; /* point of the contour where the defect begins */ 00443 CvPoint* end; /* point of the contour where the defect ends */ 00444 CvPoint* depth_point; /* the farthest from the convex hull point within the defect */ 00445 float depth; /* distance between the farthest point and the convex hull */ 00446 } CvConvexityDefect; 00447 00448 00449 /* Histogram comparison methods */ 00450 enum 00451 { 00452 CV_COMP_CORREL =0, 00453 CV_COMP_CHISQR =1, 00454 CV_COMP_INTERSECT =2, 00455 CV_COMP_BHATTACHARYYA =3 00456 }; 00457 00458 /* Mask size for distance transform */ 00459 enum 00460 { 00461 CV_DIST_MASK_3 =3, 00462 CV_DIST_MASK_5 =5, 00463 CV_DIST_MASK_PRECISE =0 00464 }; 00465 00466 /* Distance types for Distance Transform and M-estimators */ 00467 enum 00468 { 00469 CV_DIST_USER =-1, /* User defined distance */ 00470 CV_DIST_L1 =1, /* distance = |x1-x2| + |y1-y2| */ 00471 CV_DIST_L2 =2, /* the simple euclidean distance */ 00472 CV_DIST_C =3, /* distance = max(|x1-x2|,|y1-y2|) */ 00473 CV_DIST_L12 =4, /* L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) */ 00474 CV_DIST_FAIR =5, /* distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 */ 00475 CV_DIST_WELSCH =6, /* distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 */ 00476 CV_DIST_HUBER =7 /* distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 */ 00477 }; 00478 00479 00480 /* Threshold types */ 00481 enum 00482 { 00483 CV_THRESH_BINARY =0, /* value = value > threshold ? max_value : 0 */ 00484 CV_THRESH_BINARY_INV =1, /* value = value > threshold ? 0 : max_value */ 00485 CV_THRESH_TRUNC =2, /* value = value > threshold ? threshold : value */ 00486 CV_THRESH_TOZERO =3, /* value = value > threshold ? value : 0 */ 00487 CV_THRESH_TOZERO_INV =4, /* value = value > threshold ? 0 : value */ 00488 CV_THRESH_MASK =7, 00489 CV_THRESH_OTSU =8 /* use Otsu algorithm to choose the optimal threshold value; 00490 combine the flag with one of the above CV_THRESH_* values */ 00491 }; 00492 00493 /* Adaptive threshold methods */ 00494 enum 00495 { 00496 CV_ADAPTIVE_THRESH_MEAN_C =0, 00497 CV_ADAPTIVE_THRESH_GAUSSIAN_C =1 00498 }; 00499 00500 /* FloodFill flags */ 00501 enum 00502 { 00503 CV_FLOODFILL_FIXED_RANGE =(1 << 16), 00504 CV_FLOODFILL_MASK_ONLY =(1 << 17) 00505 }; 00506 00507 00508 /* Canny edge detector flags */ 00509 enum 00510 { 00511 CV_CANNY_L2_GRADIENT =(1 << 31) 00512 }; 00513 00514 /* Variants of a Hough transform */ 00515 enum 00516 { 00517 CV_HOUGH_STANDARD =0, 00518 CV_HOUGH_PROBABILISTIC =1, 00519 CV_HOUGH_MULTI_SCALE =2, 00520 CV_HOUGH_GRADIENT =3 00521 }; 00522 00523 00524 /* Fast search data structures */ 00525 struct CvFeatureTree; 00526 struct CvLSH; 00527 struct CvLSHOperations; 00528 00529 #ifdef __cplusplus 00530 } 00531 #endif 00532 00533 #endif