opencv  2.2.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
types_c.h
Go to the documentation of this file.
1 /*M///////////////////////////////////////////////////////////////////////////////////////
2 //
3 // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
4 //
5 // By downloading, copying, installing or using the software you agree to this license.
6 // If you do not agree to this license, do not download, install,
7 // copy or use the software.
8 //
9 //
10 // License Agreement
11 // For Open Source Computer Vision Library
12 //
13 // Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
14 // Copyright (C) 2009, Willow Garage Inc., all rights reserved.
15 // Third party copyrights are property of their respective owners.
16 //
17 // Redistribution and use in source and binary forms, with or without modification,
18 // are permitted provided that the following conditions are met:
19 //
20 // * Redistribution's of source code must retain the above copyright notice,
21 // this list of conditions and the following disclaimer.
22 //
23 // * Redistribution's in binary form must reproduce the above copyright notice,
24 // this list of conditions and the following disclaimer in the documentation
25 // and/or other materials provided with the distribution.
26 //
27 // * The name of the copyright holders may not be used to endorse or promote products
28 // derived from this software without specific prior written permission.
29 //
30 // This software is provided by the copyright holders and contributors "as is" and
31 // any express or implied warranties, including, but not limited to, the implied
32 // warranties of merchantability and fitness for a particular purpose are disclaimed.
33 // In no event shall the Intel Corporation or contributors be liable for any direct,
34 // indirect, incidental, special, exemplary, or consequential damages
35 // (including, but not limited to, procurement of substitute goods or services;
36 // loss of use, data, or profits; or business interruption) however caused
37 // and on any theory of liability, whether in contract, strict liability,
38 // or tort (including negligence or otherwise) arising in any way out of
39 // the use of this software, even if advised of the possibility of such damage.
40 //
41 //M*/
42 
43 #ifndef __OPENCV_IMGPROC_TYPES_C_H__
44 #define __OPENCV_IMGPROC_TYPES_C_H__
45 
46 #include "opencv2/core/core_c.h"
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 /* Connected component structure */
54 typedef struct CvConnectedComp
55 {
56  double area; /* area of the connected component */
57  CvScalar value; /* average color of the connected component */
58  CvRect rect; /* ROI of the component */
59  CvSeq* contour; /* optional component boundary
60  (the contour might have child contours corresponding to the holes)*/
61 }
63 
64 /* Image smooth methods */
65 enum
66 {
68  CV_BLUR =1,
72 };
73 
74 /* Filters used in pyramid decomposition */
75 enum
76 {
78 };
79 
80 /* Inpainting algorithms */
81 enum
82 {
85 };
86 
87 /* Special filters */
88 enum
89 {
90  CV_SCHARR =-1,
92 };
93 
94 /* Constants for color conversion */
95 enum
96 {
99 
102 
105 
108 
111 
114 
123 
132 
135 
144 
147 
152 
157 
160 
163 
168 
173 
178 
181 
188 
193 
198 
203 
208 
213 
218 
223 
225 };
226 
227 
228 /* Sub-pixel interpolation methods */
229 enum
230 {
236 };
237 
238 /* ... and other image warping flags */
239 enum
240 {
243 };
244 
245 /* Shapes of a structuring element for morphological operations */
246 enum
247 {
252 };
253 
254 /* Morphological operations */
255 enum
256 {
264 };
265 
266 /* Spatial and central moments */
267 typedef struct CvMoments
268 {
269  double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /* spatial moments */
270  double mu20, mu11, mu02, mu30, mu21, mu12, mu03; /* central moments */
271  double inv_sqrt_m00; /* m00 != 0 ? 1/sqrt(m00) : 0 */
272 }
273 CvMoments;
274 
275 /* Hu invariants */
276 typedef struct CvHuMoments
277 {
278  double hu1, hu2, hu3, hu4, hu5, hu6, hu7; /* Hu invariants */
279 }
281 
282 /* Template matching methods */
283 enum
284 {
291 };
292 
293 typedef float (CV_CDECL * CvDistanceFunction)( const float* a, const float* b, void* user_param );
294 
295 /* Contour retrieval modes */
296 enum
297 {
302 };
303 
304 /* Contour approximation methods */
305 enum
306 {
313 };
314 
315 /*
316 Internal structure that is used for sequental retrieving contours from the image.
317 It supports both hierarchical and plane variants of Suzuki algorithm.
318 */
319 typedef struct _CvContourScanner* CvContourScanner;
320 
321 /* Freeman chain reader state */
322 typedef struct CvChainPtReader
323 {
325  char code;
327  schar deltas[8][2];
328 }
330 
331 /* initializes 8-element array for fast access to 3x3 neighborhood of a pixel */
332 #define CV_INIT_3X3_DELTAS( deltas, step, nch ) \
333  ((deltas)[0] = (nch), (deltas)[1] = -(step) + (nch), \
334  (deltas)[2] = -(step), (deltas)[3] = -(step) - (nch), \
335  (deltas)[4] = -(nch), (deltas)[5] = (step) - (nch), \
336  (deltas)[6] = (step), (deltas)[7] = (step) + (nch))
337 
338 
339 /****************************************************************************************\
340 * Planar subdivisions *
341 \****************************************************************************************/
342 
343 typedef size_t CvSubdiv2DEdge;
344 
345 #define CV_QUADEDGE2D_FIELDS() \
346  int flags; \
347  struct CvSubdiv2DPoint* pt[4]; \
348  CvSubdiv2DEdge next[4];
349 
350 #define CV_SUBDIV2D_POINT_FIELDS()\
351  int flags; \
352  CvSubdiv2DEdge first; \
353  CvPoint2D32f pt; \
354  int id;
355 
356 #define CV_SUBDIV2D_VIRTUAL_POINT_FLAG (1 << 30)
357 
358 typedef struct CvQuadEdge2D
359 {
361 }
363 
364 typedef struct CvSubdiv2DPoint
365 {
367 }
369 
370 #define CV_SUBDIV2D_FIELDS() \
371  CV_GRAPH_FIELDS() \
372  int quad_edges; \
373  int is_geometry_valid; \
374  CvSubdiv2DEdge recent_edge; \
375  CvPoint2D32f topleft; \
376  CvPoint2D32f bottomright;
377 
378 typedef struct CvSubdiv2D
379 {
381 }
382 CvSubdiv2D;
383 
384 
386 {
392 }
394 
395 typedef enum CvNextEdgeType
396 {
405 }
407 
408 /* get the next edge with the same origin point (counterwise) */
409 #define CV_SUBDIV2D_NEXT_EDGE( edge ) (((CvQuadEdge2D*)((edge) & ~3))->next[(edge)&3])
410 
411 
412 /* Contour approximation algorithms */
413 enum
414 {
416 };
417 
418 /* Shape matching methods */
419 enum
420 {
424 };
425 
426 /* Shape orientation */
427 enum
428 {
431 };
432 
433 
434 /* Convexity defect */
435 typedef struct CvConvexityDefect
436 {
437  CvPoint* start; /* point of the contour where the defect begins */
438  CvPoint* end; /* point of the contour where the defect ends */
439  CvPoint* depth_point; /* the farthest from the convex hull point within the defect */
440  float depth; /* distance between the farthest point and the convex hull */
442 
443 
444 /* Histogram comparison methods */
445 enum
446 {
451 };
452 
453 /* Mask size for distance transform */
454 enum
455 {
459 };
460 
461 /* Distance types for Distance Transform and M-estimators */
462 enum
463 {
464  CV_DIST_USER =-1, /* User defined distance */
465  CV_DIST_L1 =1, /* distance = |x1-x2| + |y1-y2| */
466  CV_DIST_L2 =2, /* the simple euclidean distance */
467  CV_DIST_C =3, /* distance = max(|x1-x2|,|y1-y2|) */
468  CV_DIST_L12 =4, /* L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) */
469  CV_DIST_FAIR =5, /* distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 */
470  CV_DIST_WELSCH =6, /* distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 */
471  CV_DIST_HUBER =7 /* distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 */
472 };
473 
474 
475 /* Threshold types */
476 enum
477 {
478  CV_THRESH_BINARY =0, /* value = value > threshold ? max_value : 0 */
479  CV_THRESH_BINARY_INV =1, /* value = value > threshold ? 0 : max_value */
480  CV_THRESH_TRUNC =2, /* value = value > threshold ? threshold : value */
481  CV_THRESH_TOZERO =3, /* value = value > threshold ? value : 0 */
482  CV_THRESH_TOZERO_INV =4, /* value = value > threshold ? 0 : value */
484  CV_THRESH_OTSU =8 /* use Otsu algorithm to choose the optimal threshold value;
485  combine the flag with one of the above CV_THRESH_* values */
486 };
487 
488 /* Adaptive threshold methods */
489 enum
490 {
493 };
494 
495 /* FloodFill flags */
496 enum
497 {
500 };
501 
502 
503 /* Canny edge detector flags */
504 enum
505 {
507 };
508 
509 /* Variants of a Hough transform */
510 enum
511 {
516 };
517 
518 
519 /* Fast search data structures */
520 struct CvFeatureTree;
521 struct CvLSH;
522 struct CvLSHOperations;
523 
524 #ifdef __cplusplus
525 }
526 #endif
527 
528 #endif