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"
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 /** @addtogroup imgproc_c
53   @{
54 */
55 
56 /** Connected component structure */
57 typedef struct CvConnectedComp
58 {
59     double area;    /**<area of the connected component  */
60     CvScalar value; /**<average color of the connected component */
61     CvRect rect;    /**<ROI of the component  */
62     CvSeq* contour; /**<optional component boundary
63                       (the contour might have child contours corresponding to the holes)*/
64 }
65 CvConnectedComp;
66 
67 /** Image smooth methods */
68 enum SmoothMethod_c
69 {
70     /** linear convolution with \f$\texttt{size1}\times\texttt{size2}\f$ box kernel (all 1's). If
71     you want to smooth different pixels with different-size box kernels, you can use the integral
72     image that is computed using integral */
73     CV_BLUR_NO_SCALE =0,
74     /** linear convolution with \f$\texttt{size1}\times\texttt{size2}\f$ box kernel (all
75     1's) with subsequent scaling by \f$1/(\texttt{size1}\cdot\texttt{size2})\f$ */
76     CV_BLUR  =1,
77     /** linear convolution with a \f$\texttt{size1}\times\texttt{size2}\f$ Gaussian kernel */
78     CV_GAUSSIAN  =2,
79     /** median filter with a \f$\texttt{size1}\times\texttt{size1}\f$ square aperture */
80     CV_MEDIAN =3,
81     /** bilateral filter with a \f$\texttt{size1}\times\texttt{size1}\f$ square aperture, color
82     sigma= sigma1 and spatial sigma= sigma2. If size1=0, the aperture square side is set to
83     cvRound(sigma2\*1.5)\*2+1. See cv::bilateralFilter */
84     CV_BILATERAL =4
85 };
86 
87 /** Filters used in pyramid decomposition */
88 enum
89 {
90     CV_GAUSSIAN_5x5 = 7
91 };
92 
93 /** Special filters */
94 enum
95 {
96     CV_SCHARR =-1,
97     CV_MAX_SOBEL_KSIZE =7
98 };
99 
100 /** Constants for color conversion */
101 enum
102 {
103     CV_BGR2BGRA    =0,
104     CV_RGB2RGBA    =CV_BGR2BGRA,
105 
106     CV_BGRA2BGR    =1,
107     CV_RGBA2RGB    =CV_BGRA2BGR,
108 
109     CV_BGR2RGBA    =2,
110     CV_RGB2BGRA    =CV_BGR2RGBA,
111 
112     CV_RGBA2BGR    =3,
113     CV_BGRA2RGB    =CV_RGBA2BGR,
114 
115     CV_BGR2RGB     =4,
116     CV_RGB2BGR     =CV_BGR2RGB,
117 
118     CV_BGRA2RGBA   =5,
119     CV_RGBA2BGRA   =CV_BGRA2RGBA,
120 
121     CV_BGR2GRAY    =6,
122     CV_RGB2GRAY    =7,
123     CV_GRAY2BGR    =8,
124     CV_GRAY2RGB    =CV_GRAY2BGR,
125     CV_GRAY2BGRA   =9,
126     CV_GRAY2RGBA   =CV_GRAY2BGRA,
127     CV_BGRA2GRAY   =10,
128     CV_RGBA2GRAY   =11,
129 
130     CV_BGR2BGR565  =12,
131     CV_RGB2BGR565  =13,
132     CV_BGR5652BGR  =14,
133     CV_BGR5652RGB  =15,
134     CV_BGRA2BGR565 =16,
135     CV_RGBA2BGR565 =17,
136     CV_BGR5652BGRA =18,
137     CV_BGR5652RGBA =19,
138 
139     CV_GRAY2BGR565 =20,
140     CV_BGR5652GRAY =21,
141 
142     CV_BGR2BGR555  =22,
143     CV_RGB2BGR555  =23,
144     CV_BGR5552BGR  =24,
145     CV_BGR5552RGB  =25,
146     CV_BGRA2BGR555 =26,
147     CV_RGBA2BGR555 =27,
148     CV_BGR5552BGRA =28,
149     CV_BGR5552RGBA =29,
150 
151     CV_GRAY2BGR555 =30,
152     CV_BGR5552GRAY =31,
153 
154     CV_BGR2XYZ     =32,
155     CV_RGB2XYZ     =33,
156     CV_XYZ2BGR     =34,
157     CV_XYZ2RGB     =35,
158 
159     CV_BGR2YCrCb   =36,
160     CV_RGB2YCrCb   =37,
161     CV_YCrCb2BGR   =38,
162     CV_YCrCb2RGB   =39,
163 
164     CV_BGR2HSV     =40,
165     CV_RGB2HSV     =41,
166 
167     CV_BGR2Lab     =44,
168     CV_RGB2Lab     =45,
169 
170     CV_BayerBG2BGR =46,
171     CV_BayerGB2BGR =47,
172     CV_BayerRG2BGR =48,
173     CV_BayerGR2BGR =49,
174 
175     CV_BayerBG2RGB =CV_BayerRG2BGR,
176     CV_BayerGB2RGB =CV_BayerGR2BGR,
177     CV_BayerRG2RGB =CV_BayerBG2BGR,
178     CV_BayerGR2RGB =CV_BayerGB2BGR,
179 
180     CV_BGR2Luv     =50,
181     CV_RGB2Luv     =51,
182     CV_BGR2HLS     =52,
183     CV_RGB2HLS     =53,
184 
185     CV_HSV2BGR     =54,
186     CV_HSV2RGB     =55,
187 
188     CV_Lab2BGR     =56,
189     CV_Lab2RGB     =57,
190     CV_Luv2BGR     =58,
191     CV_Luv2RGB     =59,
192     CV_HLS2BGR     =60,
193     CV_HLS2RGB     =61,
194 
195     CV_BayerBG2BGR_VNG =62,
196     CV_BayerGB2BGR_VNG =63,
197     CV_BayerRG2BGR_VNG =64,
198     CV_BayerGR2BGR_VNG =65,
199 
200     CV_BayerBG2RGB_VNG =CV_BayerRG2BGR_VNG,
201     CV_BayerGB2RGB_VNG =CV_BayerGR2BGR_VNG,
202     CV_BayerRG2RGB_VNG =CV_BayerBG2BGR_VNG,
203     CV_BayerGR2RGB_VNG =CV_BayerGB2BGR_VNG,
204 
205     CV_BGR2HSV_FULL = 66,
206     CV_RGB2HSV_FULL = 67,
207     CV_BGR2HLS_FULL = 68,
208     CV_RGB2HLS_FULL = 69,
209 
210     CV_HSV2BGR_FULL = 70,
211     CV_HSV2RGB_FULL = 71,
212     CV_HLS2BGR_FULL = 72,
213     CV_HLS2RGB_FULL = 73,
214 
215     CV_LBGR2Lab     = 74,
216     CV_LRGB2Lab     = 75,
217     CV_LBGR2Luv     = 76,
218     CV_LRGB2Luv     = 77,
219 
220     CV_Lab2LBGR     = 78,
221     CV_Lab2LRGB     = 79,
222     CV_Luv2LBGR     = 80,
223     CV_Luv2LRGB     = 81,
224 
225     CV_BGR2YUV      = 82,
226     CV_RGB2YUV      = 83,
227     CV_YUV2BGR      = 84,
228     CV_YUV2RGB      = 85,
229 
230     CV_BayerBG2GRAY = 86,
231     CV_BayerGB2GRAY = 87,
232     CV_BayerRG2GRAY = 88,
233     CV_BayerGR2GRAY = 89,
234 
235     //YUV 4:2:0 formats family
236     CV_YUV2RGB_NV12 = 90,
237     CV_YUV2BGR_NV12 = 91,
238     CV_YUV2RGB_NV21 = 92,
239     CV_YUV2BGR_NV21 = 93,
240     CV_YUV420sp2RGB = CV_YUV2RGB_NV21,
241     CV_YUV420sp2BGR = CV_YUV2BGR_NV21,
242 
243     CV_YUV2RGBA_NV12 = 94,
244     CV_YUV2BGRA_NV12 = 95,
245     CV_YUV2RGBA_NV21 = 96,
246     CV_YUV2BGRA_NV21 = 97,
247     CV_YUV420sp2RGBA = CV_YUV2RGBA_NV21,
248     CV_YUV420sp2BGRA = CV_YUV2BGRA_NV21,
249 
250     CV_YUV2RGB_YV12 = 98,
251     CV_YUV2BGR_YV12 = 99,
252     CV_YUV2RGB_IYUV = 100,
253     CV_YUV2BGR_IYUV = 101,
254     CV_YUV2RGB_I420 = CV_YUV2RGB_IYUV,
255     CV_YUV2BGR_I420 = CV_YUV2BGR_IYUV,
256     CV_YUV420p2RGB = CV_YUV2RGB_YV12,
257     CV_YUV420p2BGR = CV_YUV2BGR_YV12,
258 
259     CV_YUV2RGBA_YV12 = 102,
260     CV_YUV2BGRA_YV12 = 103,
261     CV_YUV2RGBA_IYUV = 104,
262     CV_YUV2BGRA_IYUV = 105,
263     CV_YUV2RGBA_I420 = CV_YUV2RGBA_IYUV,
264     CV_YUV2BGRA_I420 = CV_YUV2BGRA_IYUV,
265     CV_YUV420p2RGBA = CV_YUV2RGBA_YV12,
266     CV_YUV420p2BGRA = CV_YUV2BGRA_YV12,
267 
268     CV_YUV2GRAY_420 = 106,
269     CV_YUV2GRAY_NV21 = CV_YUV2GRAY_420,
270     CV_YUV2GRAY_NV12 = CV_YUV2GRAY_420,
271     CV_YUV2GRAY_YV12 = CV_YUV2GRAY_420,
272     CV_YUV2GRAY_IYUV = CV_YUV2GRAY_420,
273     CV_YUV2GRAY_I420 = CV_YUV2GRAY_420,
274     CV_YUV420sp2GRAY = CV_YUV2GRAY_420,
275     CV_YUV420p2GRAY = CV_YUV2GRAY_420,
276 
277     //YUV 4:2:2 formats family
278     CV_YUV2RGB_UYVY = 107,
279     CV_YUV2BGR_UYVY = 108,
280     //CV_YUV2RGB_VYUY = 109,
281     //CV_YUV2BGR_VYUY = 110,
282     CV_YUV2RGB_Y422 = CV_YUV2RGB_UYVY,
283     CV_YUV2BGR_Y422 = CV_YUV2BGR_UYVY,
284     CV_YUV2RGB_UYNV = CV_YUV2RGB_UYVY,
285     CV_YUV2BGR_UYNV = CV_YUV2BGR_UYVY,
286 
287     CV_YUV2RGBA_UYVY = 111,
288     CV_YUV2BGRA_UYVY = 112,
289     //CV_YUV2RGBA_VYUY = 113,
290     //CV_YUV2BGRA_VYUY = 114,
291     CV_YUV2RGBA_Y422 = CV_YUV2RGBA_UYVY,
292     CV_YUV2BGRA_Y422 = CV_YUV2BGRA_UYVY,
293     CV_YUV2RGBA_UYNV = CV_YUV2RGBA_UYVY,
294     CV_YUV2BGRA_UYNV = CV_YUV2BGRA_UYVY,
295 
296     CV_YUV2RGB_YUY2 = 115,
297     CV_YUV2BGR_YUY2 = 116,
298     CV_YUV2RGB_YVYU = 117,
299     CV_YUV2BGR_YVYU = 118,
300     CV_YUV2RGB_YUYV = CV_YUV2RGB_YUY2,
301     CV_YUV2BGR_YUYV = CV_YUV2BGR_YUY2,
302     CV_YUV2RGB_YUNV = CV_YUV2RGB_YUY2,
303     CV_YUV2BGR_YUNV = CV_YUV2BGR_YUY2,
304 
305     CV_YUV2RGBA_YUY2 = 119,
306     CV_YUV2BGRA_YUY2 = 120,
307     CV_YUV2RGBA_YVYU = 121,
308     CV_YUV2BGRA_YVYU = 122,
309     CV_YUV2RGBA_YUYV = CV_YUV2RGBA_YUY2,
310     CV_YUV2BGRA_YUYV = CV_YUV2BGRA_YUY2,
311     CV_YUV2RGBA_YUNV = CV_YUV2RGBA_YUY2,
312     CV_YUV2BGRA_YUNV = CV_YUV2BGRA_YUY2,
313 
314     CV_YUV2GRAY_UYVY = 123,
315     CV_YUV2GRAY_YUY2 = 124,
316     //CV_YUV2GRAY_VYUY = CV_YUV2GRAY_UYVY,
317     CV_YUV2GRAY_Y422 = CV_YUV2GRAY_UYVY,
318     CV_YUV2GRAY_UYNV = CV_YUV2GRAY_UYVY,
319     CV_YUV2GRAY_YVYU = CV_YUV2GRAY_YUY2,
320     CV_YUV2GRAY_YUYV = CV_YUV2GRAY_YUY2,
321     CV_YUV2GRAY_YUNV = CV_YUV2GRAY_YUY2,
322 
323     // alpha premultiplication
324     CV_RGBA2mRGBA = 125,
325     CV_mRGBA2RGBA = 126,
326 
327     CV_RGB2YUV_I420 = 127,
328     CV_BGR2YUV_I420 = 128,
329     CV_RGB2YUV_IYUV = CV_RGB2YUV_I420,
330     CV_BGR2YUV_IYUV = CV_BGR2YUV_I420,
331 
332     CV_RGBA2YUV_I420 = 129,
333     CV_BGRA2YUV_I420 = 130,
334     CV_RGBA2YUV_IYUV = CV_RGBA2YUV_I420,
335     CV_BGRA2YUV_IYUV = CV_BGRA2YUV_I420,
336     CV_RGB2YUV_YV12  = 131,
337     CV_BGR2YUV_YV12  = 132,
338     CV_RGBA2YUV_YV12 = 133,
339     CV_BGRA2YUV_YV12 = 134,
340 
341     // Edge-Aware Demosaicing
342     CV_BayerBG2BGR_EA = 135,
343     CV_BayerGB2BGR_EA = 136,
344     CV_BayerRG2BGR_EA = 137,
345     CV_BayerGR2BGR_EA = 138,
346 
347     CV_BayerBG2RGB_EA = CV_BayerRG2BGR_EA,
348     CV_BayerGB2RGB_EA = CV_BayerGR2BGR_EA,
349     CV_BayerRG2RGB_EA = CV_BayerBG2BGR_EA,
350     CV_BayerGR2RGB_EA = CV_BayerGB2BGR_EA,
351 
352     CV_COLORCVT_MAX  = 139
353 };
354 
355 
356 /** Sub-pixel interpolation methods */
357 enum
358 {
359     CV_INTER_NN        =0,
360     CV_INTER_LINEAR    =1,
361     CV_INTER_CUBIC     =2,
362     CV_INTER_AREA      =3,
363     CV_INTER_LANCZOS4  =4
364 };
365 
366 /** ... and other image warping flags */
367 enum
368 {
369     CV_WARP_FILL_OUTLIERS =8,
370     CV_WARP_INVERSE_MAP  =16
371 };
372 
373 /** Shapes of a structuring element for morphological operations
374 @see cv::MorphShapes, cv::getStructuringElement
375 */
376 enum MorphShapes_c
377 {
378     CV_SHAPE_RECT      =0,
379     CV_SHAPE_CROSS     =1,
380     CV_SHAPE_ELLIPSE   =2,
381     CV_SHAPE_CUSTOM    =100 //!< custom structuring element
382 };
383 
384 /** Morphological operations */
385 enum
386 {
387     CV_MOP_ERODE        =0,
388     CV_MOP_DILATE       =1,
389     CV_MOP_OPEN         =2,
390     CV_MOP_CLOSE        =3,
391     CV_MOP_GRADIENT     =4,
392     CV_MOP_TOPHAT       =5,
393     CV_MOP_BLACKHAT     =6
394 };
395 
396 /** Spatial and central moments */
397 typedef struct CvMoments
398 {
399     double  m00, m10, m01, m20, m11, m02, m30, m21, m12, m03; /**< spatial moments */
400     double  mu20, mu11, mu02, mu30, mu21, mu12, mu03; /**< central moments */
401     double  inv_sqrt_m00; /**< m00 != 0 ? 1/sqrt(m00) : 0 */
402 
403 #ifdef __cplusplus
CvMomentsCvMoments404     CvMoments(){}
CvMomentsCvMoments405     CvMoments(const cv::Moments& m)
406     {
407         m00 = m.m00; m10 = m.m10; m01 = m.m01;
408         m20 = m.m20; m11 = m.m11; m02 = m.m02;
409         m30 = m.m30; m21 = m.m21; m12 = m.m12; m03 = m.m03;
410         mu20 = m.mu20; mu11 = m.mu11; mu02 = m.mu02;
411         mu30 = m.mu30; mu21 = m.mu21; mu12 = m.mu12; mu03 = m.mu03;
412         double am00 = std::abs(m.m00);
413         inv_sqrt_m00 = am00 > DBL_EPSILON ? 1./std::sqrt(am00) : 0;
414     }
MomentsCvMoments415     operator cv::Moments() const
416     {
417         return cv::Moments(m00, m10, m01, m20, m11, m02, m30, m21, m12, m03);
418     }
419 #endif
420 }
421 CvMoments;
422 
423 /** Hu invariants */
424 typedef struct CvHuMoments
425 {
426     double hu1, hu2, hu3, hu4, hu5, hu6, hu7; /**< Hu invariants */
427 }
428 CvHuMoments;
429 
430 /** Template matching methods */
431 enum
432 {
433     CV_TM_SQDIFF        =0,
434     CV_TM_SQDIFF_NORMED =1,
435     CV_TM_CCORR         =2,
436     CV_TM_CCORR_NORMED  =3,
437     CV_TM_CCOEFF        =4,
438     CV_TM_CCOEFF_NORMED =5
439 };
440 
441 typedef float (CV_CDECL * CvDistanceFunction)( const float* a, const float* b, void* user_param );
442 
443 /** Contour retrieval modes */
444 enum
445 {
446     CV_RETR_EXTERNAL=0,
447     CV_RETR_LIST=1,
448     CV_RETR_CCOMP=2,
449     CV_RETR_TREE=3,
450     CV_RETR_FLOODFILL=4
451 };
452 
453 /** Contour approximation methods */
454 enum
455 {
456     CV_CHAIN_CODE=0,
457     CV_CHAIN_APPROX_NONE=1,
458     CV_CHAIN_APPROX_SIMPLE=2,
459     CV_CHAIN_APPROX_TC89_L1=3,
460     CV_CHAIN_APPROX_TC89_KCOS=4,
461     CV_LINK_RUNS=5
462 };
463 
464 /*
465 Internal structure that is used for sequential retrieving contours from the image.
466 It supports both hierarchical and plane variants of Suzuki algorithm.
467 */
468 typedef struct _CvContourScanner* CvContourScanner;
469 
470 /** Freeman chain reader state */
471 typedef struct CvChainPtReader
472 {
473     CV_SEQ_READER_FIELDS()
474     char      code;
475     CvPoint   pt;
476     schar     deltas[8][2];
477 }
478 CvChainPtReader;
479 
480 /** initializes 8-element array for fast access to 3x3 neighborhood of a pixel */
481 #define  CV_INIT_3X3_DELTAS( deltas, step, nch )            \
482     ((deltas)[0] =  (nch),  (deltas)[1] = -(step) + (nch),  \
483      (deltas)[2] = -(step), (deltas)[3] = -(step) - (nch),  \
484      (deltas)[4] = -(nch),  (deltas)[5] =  (step) - (nch),  \
485      (deltas)[6] =  (step), (deltas)[7] =  (step) + (nch))
486 
487 
488 /** Contour approximation algorithms */
489 enum
490 {
491     CV_POLY_APPROX_DP = 0
492 };
493 
494 /** @brief Shape matching methods
495 
496 \f$A\f$ denotes object1,\f$B\f$ denotes object2
497 
498 \f$\begin{array}{l} m^A_i =  \mathrm{sign} (h^A_i)  \cdot \log{h^A_i} \\ m^B_i =  \mathrm{sign} (h^B_i)  \cdot \log{h^B_i} \end{array}\f$
499 
500 and \f$h^A_i, h^B_i\f$ are the Hu moments of \f$A\f$ and \f$B\f$ , respectively.
501 */
502 enum ShapeMatchModes
503 {
504     CV_CONTOURS_MATCH_I1  =1, //!< \f[I_1(A,B) =  \sum _{i=1...7}  \left |  \frac{1}{m^A_i} -  \frac{1}{m^B_i} \right |\f]
505     CV_CONTOURS_MATCH_I2  =2, //!< \f[I_2(A,B) =  \sum _{i=1...7}  \left | m^A_i - m^B_i  \right |\f]
506     CV_CONTOURS_MATCH_I3  =3  //!< \f[I_3(A,B) =  \max _{i=1...7}  \frac{ \left| m^A_i - m^B_i \right| }{ \left| m^A_i \right| }\f]
507 };
508 
509 /** Shape orientation */
510 enum
511 {
512     CV_CLOCKWISE         =1,
513     CV_COUNTER_CLOCKWISE =2
514 };
515 
516 
517 /** Convexity defect */
518 typedef struct CvConvexityDefect
519 {
520     CvPoint* start; /**< point of the contour where the defect begins */
521     CvPoint* end; /**< point of the contour where the defect ends */
522     CvPoint* depth_point; /**< the farthest from the convex hull point within the defect */
523     float depth; /**< distance between the farthest point and the convex hull */
524 } CvConvexityDefect;
525 
526 
527 /** Histogram comparison methods */
528 enum
529 {
530     CV_COMP_CORREL        =0,
531     CV_COMP_CHISQR        =1,
532     CV_COMP_INTERSECT     =2,
533     CV_COMP_BHATTACHARYYA =3,
534     CV_COMP_HELLINGER     =CV_COMP_BHATTACHARYYA,
535     CV_COMP_CHISQR_ALT    =4,
536     CV_COMP_KL_DIV        =5
537 };
538 
539 /** Mask size for distance transform */
540 enum
541 {
542     CV_DIST_MASK_3   =3,
543     CV_DIST_MASK_5   =5,
544     CV_DIST_MASK_PRECISE =0
545 };
546 
547 /** Content of output label array: connected components or pixels */
548 enum
549 {
550   CV_DIST_LABEL_CCOMP = 0,
551   CV_DIST_LABEL_PIXEL = 1
552 };
553 
554 /** Distance types for Distance Transform and M-estimators */
555 enum
556 {
557     CV_DIST_USER    =-1,  /**< User defined distance */
558     CV_DIST_L1      =1,   /**< distance = |x1-x2| + |y1-y2| */
559     CV_DIST_L2      =2,   /**< the simple euclidean distance */
560     CV_DIST_C       =3,   /**< distance = max(|x1-x2|,|y1-y2|) */
561     CV_DIST_L12     =4,   /**< L1-L2 metric: distance = 2(sqrt(1+x*x/2) - 1)) */
562     CV_DIST_FAIR    =5,   /**< distance = c^2(|x|/c-log(1+|x|/c)), c = 1.3998 */
563     CV_DIST_WELSCH  =6,   /**< distance = c^2/2(1-exp(-(x/c)^2)), c = 2.9846 */
564     CV_DIST_HUBER   =7    /**< distance = |x|<c ? x^2/2 : c(|x|-c/2), c=1.345 */
565 };
566 
567 
568 /** Threshold types */
569 enum
570 {
571     CV_THRESH_BINARY      =0,  /**< value = value > threshold ? max_value : 0       */
572     CV_THRESH_BINARY_INV  =1,  /**< value = value > threshold ? 0 : max_value       */
573     CV_THRESH_TRUNC       =2,  /**< value = value > threshold ? threshold : value   */
574     CV_THRESH_TOZERO      =3,  /**< value = value > threshold ? value : 0           */
575     CV_THRESH_TOZERO_INV  =4,  /**< value = value > threshold ? 0 : value           */
576     CV_THRESH_MASK        =7,
577     CV_THRESH_OTSU        =8, /**< use Otsu algorithm to choose the optimal threshold value;
578                                  combine the flag with one of the above CV_THRESH_* values */
579     CV_THRESH_TRIANGLE    =16  /**< use Triangle algorithm to choose the optimal threshold value;
580                                  combine the flag with one of the above CV_THRESH_* values, but not
581                                  with CV_THRESH_OTSU */
582 };
583 
584 /** Adaptive threshold methods */
585 enum
586 {
587     CV_ADAPTIVE_THRESH_MEAN_C  =0,
588     CV_ADAPTIVE_THRESH_GAUSSIAN_C  =1
589 };
590 
591 /** FloodFill flags */
592 enum
593 {
594     CV_FLOODFILL_FIXED_RANGE =(1 << 16),
595     CV_FLOODFILL_MASK_ONLY   =(1 << 17)
596 };
597 
598 
599 /** Canny edge detector flags */
600 enum
601 {
602     CV_CANNY_L2_GRADIENT  =(1 << 31)
603 };
604 
605 /** Variants of a Hough transform */
606 enum
607 {
608     CV_HOUGH_STANDARD =0,
609     CV_HOUGH_PROBABILISTIC =1,
610     CV_HOUGH_MULTI_SCALE =2,
611     CV_HOUGH_GRADIENT =3
612 };
613 
614 
615 /* Fast search data structures  */
616 struct CvFeatureTree;
617 struct CvLSH;
618 struct CvLSHOperations;
619 
620 /** @} */
621 
622 #ifdef __cplusplus
623 }
624 #endif
625 
626 #endif
627