imgproc_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_IMGPROC_C_H__
44 #define __OPENCV_IMGPROC_IMGPROC_C_H__
45 
46 #include "opencv2/core/core_c.h"
48 
49 #ifdef __cplusplus
50 extern "C" {
51 #endif
52 
53 /*********************** Background statistics accumulation *****************************/
54 
55 /* Adds image to accumulator */
56 CVAPI(void) cvAcc( const CvArr* image, CvArr* sum,
57  const CvArr* mask CV_DEFAULT(NULL) );
58 
59 /* Adds squared image to accumulator */
60 CVAPI(void) cvSquareAcc( const CvArr* image, CvArr* sqsum,
61  const CvArr* mask CV_DEFAULT(NULL) );
62 
63 /* Adds a product of two images to accumulator */
64 CVAPI(void) cvMultiplyAcc( const CvArr* image1, const CvArr* image2, CvArr* acc,
65  const CvArr* mask CV_DEFAULT(NULL) );
66 
67 /* Adds image to accumulator with weights: acc = acc*(1-alpha) + image*alpha */
68 CVAPI(void) cvRunningAvg( const CvArr* image, CvArr* acc, double alpha,
69  const CvArr* mask CV_DEFAULT(NULL) );
70 
71 /****************************************************************************************\
72 * Image Processing *
73 \****************************************************************************************/
74 
75 /* Copies source 2D array inside of the larger destination array and
76  makes a border of the specified type (IPL_BORDER_*) around the copied area. */
77 CVAPI(void) cvCopyMakeBorder( const CvArr* src, CvArr* dst, CvPoint offset,
79 
80 /* Smoothes array (removes noise) */
81 CVAPI(void) cvSmooth( const CvArr* src, CvArr* dst,
82  int smoothtype CV_DEFAULT(CV_GAUSSIAN),
83  int size1 CV_DEFAULT(3),
84  int size2 CV_DEFAULT(0),
85  double sigma1 CV_DEFAULT(0),
86  double sigma2 CV_DEFAULT(0));
87 
88 /* Convolves the image with the kernel */
89 CVAPI(void) cvFilter2D( const CvArr* src, CvArr* dst, const CvMat* kernel,
90  CvPoint anchor CV_DEFAULT(cvPoint(-1,-1)));
91 
92 /* Finds integral image: SUM(X,Y) = sum(x<X,y<Y)I(x,y) */
93 CVAPI(void) cvIntegral( const CvArr* image, CvArr* sum,
94  CvArr* sqsum CV_DEFAULT(NULL),
95  CvArr* tilted_sum CV_DEFAULT(NULL));
96 
97 /*
98  Smoothes the input image with gaussian kernel and then down-samples it.
99  dst_width = floor(src_width/2)[+1],
100  dst_height = floor(src_height/2)[+1]
101 */
102 CVAPI(void) cvPyrDown( const CvArr* src, CvArr* dst,
103  int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
104 
105 /*
106  Up-samples image and smoothes the result with gaussian kernel.
107  dst_width = src_width*2,
108  dst_height = src_height*2
109 */
110 CVAPI(void) cvPyrUp( const CvArr* src, CvArr* dst,
111  int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
112 
113 /* Builds pyramid for an image */
114 CVAPI(CvMat**) cvCreatePyramid( const CvArr* img, int extra_layers, double rate,
115  const CvSize* layer_sizes CV_DEFAULT(0),
116  CvArr* bufarr CV_DEFAULT(0),
117  int calc CV_DEFAULT(1),
118  int filter CV_DEFAULT(CV_GAUSSIAN_5x5) );
119 
120 /* Releases pyramid */
121 CVAPI(void) cvReleasePyramid( CvMat*** pyramid, int extra_layers );
122 
123 
124 /* Filters image using meanshift algorithm */
125 CVAPI(void) cvPyrMeanShiftFiltering( const CvArr* src, CvArr* dst,
126  double sp, double sr, int max_level CV_DEFAULT(1),
127  CvTermCriteria termcrit CV_DEFAULT(cvTermCriteria(CV_TERMCRIT_ITER+CV_TERMCRIT_EPS,5,1)));
128 
129 /* Segments image using seed "markers" */
130 CVAPI(void) cvWatershed( const CvArr* image, CvArr* markers );
131 
132 /* Calculates an image derivative using generalized Sobel
133  (aperture_size = 1,3,5,7) or Scharr (aperture_size = -1) operator.
134  Scharr can be used only for the first dx or dy derivative */
135 CVAPI(void) cvSobel( const CvArr* src, CvArr* dst,
136  int xorder, int yorder,
137  int aperture_size CV_DEFAULT(3));
138 
139 /* Calculates the image Laplacian: (d2/dx + d2/dy)I */
140 CVAPI(void) cvLaplace( const CvArr* src, CvArr* dst,
141  int aperture_size CV_DEFAULT(3) );
142 
143 /* Converts input array pixels from one color space to another */
144 CVAPI(void) cvCvtColor( const CvArr* src, CvArr* dst, int code );
145 
146 
147 /* Resizes image (input array is resized to fit the destination array) */
148 CVAPI(void) cvResize( const CvArr* src, CvArr* dst,
149  int interpolation CV_DEFAULT( CV_INTER_LINEAR ));
150 
151 /* Warps image with affine transform */
152 CVAPI(void) cvWarpAffine( const CvArr* src, CvArr* dst, const CvMat* map_matrix,
153  int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
154  CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
155 
156 /* Computes affine transform matrix for mapping src[i] to dst[i] (i=0,1,2) */
157 CVAPI(CvMat*) cvGetAffineTransform( const CvPoint2D32f * src,
158  const CvPoint2D32f * dst,
159  CvMat * map_matrix );
160 
161 /* Computes rotation_matrix matrix */
162 CVAPI(CvMat*) cv2DRotationMatrix( CvPoint2D32f center, double angle,
163  double scale, CvMat* map_matrix );
164 
165 /* Warps image with perspective (projective) transform */
166 CVAPI(void) cvWarpPerspective( const CvArr* src, CvArr* dst, const CvMat* map_matrix,
167  int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
168  CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
169 
170 /* Computes perspective transform matrix for mapping src[i] to dst[i] (i=0,1,2,3) */
171 CVAPI(CvMat*) cvGetPerspectiveTransform( const CvPoint2D32f* src,
172  const CvPoint2D32f* dst,
173  CvMat* map_matrix );
174 
175 /* Performs generic geometric transformation using the specified coordinate maps */
176 CVAPI(void) cvRemap( const CvArr* src, CvArr* dst,
177  const CvArr* mapx, const CvArr* mapy,
178  int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS),
179  CvScalar fillval CV_DEFAULT(cvScalarAll(0)) );
180 
181 /* Converts mapx & mapy from floating-point to integer formats for cvRemap */
182 CVAPI(void) cvConvertMaps( const CvArr* mapx, const CvArr* mapy,
183  CvArr* mapxy, CvArr* mapalpha );
184 
185 /* Performs forward or inverse log-polar image transform */
186 CVAPI(void) cvLogPolar( const CvArr* src, CvArr* dst,
187  CvPoint2D32f center, double M,
188  int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS));
189 
190 /* Performs forward or inverse linear-polar image transform */
191 CVAPI(void) cvLinearPolar( const CvArr* src, CvArr* dst,
192  CvPoint2D32f center, double maxRadius,
193  int flags CV_DEFAULT(CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS));
194 
195 /* Transforms the input image to compensate lens distortion */
196 CVAPI(void) cvUndistort2( const CvArr* src, CvArr* dst,
197  const CvMat* camera_matrix,
198  const CvMat* distortion_coeffs,
199  const CvMat* new_camera_matrix CV_DEFAULT(0) );
200 
201 /* Computes transformation map from intrinsic camera parameters
202  that can used by cvRemap */
203 CVAPI(void) cvInitUndistortMap( const CvMat* camera_matrix,
204  const CvMat* distortion_coeffs,
205  CvArr* mapx, CvArr* mapy );
206 
207 /* Computes undistortion+rectification map for a head of stereo camera */
208 CVAPI(void) cvInitUndistortRectifyMap( const CvMat* camera_matrix,
210  const CvMat *R, const CvMat* new_camera_matrix,
211  CvArr* mapx, CvArr* mapy );
212 
213 /* Computes the original (undistorted) feature coordinates
214  from the observed (distorted) coordinates */
215 CVAPI(void) cvUndistortPoints( const CvMat* src, CvMat* dst,
216  const CvMat* camera_matrix,
217  const CvMat* dist_coeffs,
218  const CvMat* R CV_DEFAULT(0),
219  const CvMat* P CV_DEFAULT(0));
220 
221 /* creates structuring element used for morphological operations */
222 CVAPI(IplConvKernel*) cvCreateStructuringElementEx(
223  int cols, int rows, int anchor_x, int anchor_y,
224  int shape, int* values CV_DEFAULT(NULL) );
225 
226 /* releases structuring element */
227 CVAPI(void) cvReleaseStructuringElement( IplConvKernel** element );
228 
229 /* erodes input image (applies minimum filter) one or more times.
230  If element pointer is NULL, 3x3 rectangular element is used */
231 CVAPI(void) cvErode( const CvArr* src, CvArr* dst,
232  IplConvKernel* element CV_DEFAULT(NULL),
233  int iterations CV_DEFAULT(1) );
234 
235 /* dilates input image (applies maximum filter) one or more times.
236  If element pointer is NULL, 3x3 rectangular element is used */
237 CVAPI(void) cvDilate( const CvArr* src, CvArr* dst,
238  IplConvKernel* element CV_DEFAULT(NULL),
239  int iterations CV_DEFAULT(1) );
240 
241 /* Performs complex morphological transformation */
242 CVAPI(void) cvMorphologyEx( const CvArr* src, CvArr* dst,
243  CvArr* temp, IplConvKernel* element,
244  int operation, int iterations CV_DEFAULT(1) );
245 
246 /* Calculates all spatial and central moments up to the 3rd order */
247 CVAPI(void) cvMoments( const CvArr* arr, CvMoments* moments, int binary CV_DEFAULT(0));
248 
249 /* Retrieve particular spatial, central or normalized central moments */
250 CVAPI(double) cvGetSpatialMoment( CvMoments* moments, int x_order, int y_order );
251 CVAPI(double) cvGetCentralMoment( CvMoments* moments, int x_order, int y_order );
252 CVAPI(double) cvGetNormalizedCentralMoment( CvMoments* moments,
253  int x_order, int y_order );
254 
255 /* Calculates 7 Hu's invariants from precalculated spatial and central moments */
256 CVAPI(void) cvGetHuMoments( CvMoments* moments, CvHuMoments* hu_moments );
257 
258 /*********************************** data sampling **************************************/
259 
260 /* Fetches pixels that belong to the specified line segment and stores them to the buffer.
261  Returns the number of retrieved points. */
262 CVAPI(int) cvSampleLine( const CvArr* image, CvPoint pt1, CvPoint pt2, void* buffer,
263  int connectivity CV_DEFAULT(8));
264 
265 /* Retrieves the rectangular image region with specified center from the input array.
266  dst(x,y) <- src(x + center.x - dst_width/2, y + center.y - dst_height/2).
267  Values of pixels with fractional coordinates are retrieved using bilinear interpolation*/
268 CVAPI(void) cvGetRectSubPix( const CvArr* src, CvArr* dst, CvPoint2D32f center );
269 
270 
271 /* Retrieves quadrangle from the input array.
272  matrixarr = ( a11 a12 | b1 ) dst(x,y) <- src(A[x y]' + b)
273  ( a21 a22 | b2 ) (bilinear interpolation is used to retrieve pixels
274  with fractional coordinates)
275 */
276 CVAPI(void) cvGetQuadrangleSubPix( const CvArr* src, CvArr* dst,
277  const CvMat* map_matrix );
278 
279 /* Measures similarity between template and overlapped windows in the source image
280  and fills the resultant image with the measurements */
281 CVAPI(void) cvMatchTemplate( const CvArr* image, const CvArr* templ,
282  CvArr* result, int method );
283 
284 /* Computes earth mover distance between
285  two weighted point sets (called signatures) */
286 CVAPI(float) cvCalcEMD2( const CvArr* signature1,
288  int distance_type,
289  CvDistanceFunction distance_func CV_DEFAULT(NULL),
290  const CvArr* cost_matrix CV_DEFAULT(NULL),
291  CvArr* flow CV_DEFAULT(NULL),
292  float* lower_bound CV_DEFAULT(NULL),
293  void* userdata CV_DEFAULT(NULL));
294 
295 /****************************************************************************************\
296 * Contours retrieving *
297 \****************************************************************************************/
298 
299 /* Retrieves outer and optionally inner boundaries of white (non-zero) connected
300  components in the black (zero) background */
301 CVAPI(int) cvFindContours( CvArr* image, CvMemStorage* storage, CvSeq** first_contour,
302  int header_size CV_DEFAULT(sizeof(CvContour)),
303  int mode CV_DEFAULT(CV_RETR_LIST),
304  int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
305  CvPoint offset CV_DEFAULT(cvPoint(0,0)));
306 
307 /* Initializes contour retrieving process.
308  Calls cvStartFindContours.
309  Calls cvFindNextContour until null pointer is returned
310  or some other condition becomes true.
311  Calls cvEndFindContours at the end. */
312 CVAPI(CvContourScanner) cvStartFindContours( CvArr* image, CvMemStorage* storage,
313  int header_size CV_DEFAULT(sizeof(CvContour)),
314  int mode CV_DEFAULT(CV_RETR_LIST),
315  int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
316  CvPoint offset CV_DEFAULT(cvPoint(0,0)));
317 
318 /* Retrieves next contour */
319 CVAPI(CvSeq*) cvFindNextContour( CvContourScanner scanner );
320 
321 
322 /* Substitutes the last retrieved contour with the new one
323  (if the substitutor is null, the last retrieved contour is removed from the tree) */
324 CVAPI(void) cvSubstituteContour( CvContourScanner scanner, CvSeq* new_contour );
325 
326 
327 /* Releases contour scanner and returns pointer to the first outer contour */
328 CVAPI(CvSeq*) cvEndFindContours( CvContourScanner* scanner );
329 
330 /* Approximates a single Freeman chain or a tree of chains to polygonal curves */
331 CVAPI(CvSeq*) cvApproxChains( CvSeq* src_seq, CvMemStorage* storage,
332  int method CV_DEFAULT(CV_CHAIN_APPROX_SIMPLE),
333  double parameter CV_DEFAULT(0),
334  int minimal_perimeter CV_DEFAULT(0),
335  int recursive CV_DEFAULT(0));
336 
337 /* Initializes Freeman chain reader.
338  The reader is used to iteratively get coordinates of all the chain points.
339  If the Freeman codes should be read as is, a simple sequence reader should be used */
340 CVAPI(void) cvStartReadChainPoints( CvChain* chain, CvChainPtReader* reader );
341 
342 /* Retrieves the next chain point */
343 CVAPI(CvPoint) cvReadChainPoint( CvChainPtReader* reader );
344 
345 
346 /****************************************************************************************\
347 * Contour Processing and Shape Analysis *
348 \****************************************************************************************/
349 
350 /* Approximates a single polygonal curve (contour) or
351  a tree of polygonal curves (contours) */
352 CVAPI(CvSeq*) cvApproxPoly( const void* src_seq,
353  int header_size, CvMemStorage* storage,
354  int method, double eps,
355  int recursive CV_DEFAULT(0));
356 
357 /* Calculates perimeter of a contour or length of a part of contour */
358 CVAPI(double) cvArcLength( const void* curve,
359  CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ),
360  int is_closed CV_DEFAULT(-1));
361 
362 CV_INLINE double cvContourPerimeter( const void* contour )
363 {
364  return cvArcLength( contour, CV_WHOLE_SEQ, 1 );
365 }
366 
367 
368 /* Calculates contour bounding rectangle (update=1) or
369  just retrieves pre-calculated rectangle (update=0) */
370 CVAPI(CvRect) cvBoundingRect( CvArr* points, int update CV_DEFAULT(0) );
371 
372 /* Calculates area of a contour or contour segment */
373 CVAPI(double) cvContourArea( const CvArr* contour,
374  CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ),
375  int oriented CV_DEFAULT(0));
376 
377 /* Finds minimum area rotated rectangle bounding a set of points */
378 CVAPI(CvBox2D) cvMinAreaRect2( const CvArr* points,
379  CvMemStorage* storage CV_DEFAULT(NULL));
380 
381 /* Finds minimum enclosing circle for a set of points */
382 CVAPI(int) cvMinEnclosingCircle( const CvArr* points,
384 
385 /* Compares two contours by matching their moments */
386 CVAPI(double) cvMatchShapes( const void* object1, const void* object2,
387  int method, double parameter CV_DEFAULT(0));
388 
389 /* Calculates exact convex hull of 2d point set */
390 CVAPI(CvSeq*) cvConvexHull2( const CvArr* input,
391  void* hull_storage CV_DEFAULT(NULL),
392  int orientation CV_DEFAULT(CV_CLOCKWISE),
393  int return_points CV_DEFAULT(0));
394 
395 /* Checks whether the contour is convex or not (returns 1 if convex, 0 if not) */
396 CVAPI(int) cvCheckContourConvexity( const CvArr* contour );
397 
398 
399 /* Finds convexity defects for the contour */
400 CVAPI(CvSeq*) cvConvexityDefects( const CvArr* contour, const CvArr* convexhull,
401  CvMemStorage* storage CV_DEFAULT(NULL));
402 
403 /* Fits ellipse into a set of 2d points */
404 CVAPI(CvBox2D) cvFitEllipse2( const CvArr* points );
405 
406 /* Finds minimum rectangle containing two given rectangles */
407 CVAPI(CvRect) cvMaxRect( const CvRect* rect1, const CvRect* rect2 );
408 
409 /* Finds coordinates of the box vertices */
410 CVAPI(void) cvBoxPoints( CvBox2D box, CvPoint2D32f pt[4] );
411 
412 /* Initializes sequence header for a matrix (column or row vector) of points -
413  a wrapper for cvMakeSeqHeaderForArray (it does not initialize bounding rectangle!!!) */
414 CVAPI(CvSeq*) cvPointSeqFromMat( int seq_kind, const CvArr* mat,
416  CvSeqBlock* block );
417 
418 /* Checks whether the point is inside polygon, outside, on an edge (at a vertex).
419  Returns positive, negative or zero value, correspondingly.
420  Optionally, measures a signed distance between
421  the point and the nearest polygon edge (measure_dist=1) */
422 CVAPI(double) cvPointPolygonTest( const CvArr* contour,
424 
425 /****************************************************************************************\
426 * Histogram functions *
427 \****************************************************************************************/
428 
429 /* Creates new histogram */
430 CVAPI(CvHistogram*) cvCreateHist( int dims, int* sizes, int type,
431  float** ranges CV_DEFAULT(NULL),
432  int uniform CV_DEFAULT(1));
433 
434 /* Assignes histogram bin ranges */
435 CVAPI(void) cvSetHistBinRanges( CvHistogram* hist, float** ranges,
436  int uniform CV_DEFAULT(1));
437 
438 /* Creates histogram header for array */
439 CVAPI(CvHistogram*) cvMakeHistHeaderForArray(
440  int dims, int* sizes, CvHistogram* hist,
441  float* data, float** ranges CV_DEFAULT(NULL),
442  int uniform CV_DEFAULT(1));
443 
444 /* Releases histogram */
445 CVAPI(void) cvReleaseHist( CvHistogram** hist );
446 
447 /* Clears all the histogram bins */
448 CVAPI(void) cvClearHist( CvHistogram* hist );
449 
450 /* Finds indices and values of minimum and maximum histogram bins */
451 CVAPI(void) cvGetMinMaxHistValue( const CvHistogram* hist,
452  float* min_value, float* max_value,
453  int* min_idx CV_DEFAULT(NULL),
454  int* max_idx CV_DEFAULT(NULL));
455 
456 
457 /* Normalizes histogram by dividing all bins by sum of the bins, multiplied by <factor>.
458  After that sum of histogram bins is equal to <factor> */
459 CVAPI(void) cvNormalizeHist( CvHistogram* hist, double factor );
460 
461 
462 /* Clear all histogram bins that are below the threshold */
463 CVAPI(void) cvThreshHist( CvHistogram* hist, double threshold );
464 
465 
466 /* Compares two histogram */
467 CVAPI(double) cvCompareHist( const CvHistogram* hist1,
469  int method);
470 
471 /* Copies one histogram to another. Destination histogram is created if
472  the destination pointer is NULL */
473 CVAPI(void) cvCopyHist( const CvHistogram* src, CvHistogram** dst );
474 
475 
476 /* Calculates bayesian probabilistic histograms
477  (each or src and dst is an array of <number> histograms */
478 CVAPI(void) cvCalcBayesianProb( CvHistogram** src, int number,
479  CvHistogram** dst);
480 
481 /* Calculates array histogram */
482 CVAPI(void) cvCalcArrHist( CvArr** arr, CvHistogram* hist,
483  int accumulate CV_DEFAULT(0),
484  const CvArr* mask CV_DEFAULT(NULL) );
485 
486 CV_INLINE void cvCalcHist( IplImage** image, CvHistogram* hist,
487  int accumulate CV_DEFAULT(0),
488  const CvArr* mask CV_DEFAULT(NULL) )
489 {
490  cvCalcArrHist( (CvArr**)image, hist, accumulate, mask );
491 }
492 
493 /* Calculates back project */
494 CVAPI(void) cvCalcArrBackProject( CvArr** image, CvArr* dst,
495  const CvHistogram* hist );
496 #define cvCalcBackProject(image, dst, hist) cvCalcArrBackProject((CvArr**)image, dst, hist)
497 
498 
499 /* Does some sort of template matching but compares histograms of
500  template and each window location */
501 CVAPI(void) cvCalcArrBackProjectPatch( CvArr** image, CvArr* dst, CvSize range,
502  CvHistogram* hist, int method,
503  double factor );
504 #define cvCalcBackProjectPatch( image, dst, range, hist, method, factor ) \
505  cvCalcArrBackProjectPatch( (CvArr**)image, dst, range, hist, method, factor )
506 
507 
508 /* calculates probabilistic density (divides one histogram by another) */
509 CVAPI(void) cvCalcProbDensity( const CvHistogram* hist1, const CvHistogram* hist2,
510  CvHistogram* dst_hist, double scale CV_DEFAULT(255) );
511 
512 /* equalizes histogram of 8-bit single-channel image */
513 CVAPI(void) cvEqualizeHist( const CvArr* src, CvArr* dst );
514 
515 
516 /* Applies distance transform to binary image */
517 CVAPI(void) cvDistTransform( const CvArr* src, CvArr* dst,
518  int distance_type CV_DEFAULT(CV_DIST_L2),
519  int mask_size CV_DEFAULT(3),
520  const float* mask CV_DEFAULT(NULL),
521  CvArr* labels CV_DEFAULT(NULL),
522  int labelType CV_DEFAULT(CV_DIST_LABEL_CCOMP));
523 
524 
525 /* Applies fixed-level threshold to grayscale image.
526  This is a basic operation applied before retrieving contours */
527 CVAPI(double) cvThreshold( const CvArr* src, CvArr* dst,
528  double threshold, double max_value,
529  int threshold_type );
530 
531 /* Applies adaptive threshold to grayscale image.
532  The two parameters for methods CV_ADAPTIVE_THRESH_MEAN_C and
533  CV_ADAPTIVE_THRESH_GAUSSIAN_C are:
534  neighborhood size (3, 5, 7 etc.),
535  and a constant subtracted from mean (...,-3,-2,-1,0,1,2,3,...) */
536 CVAPI(void) cvAdaptiveThreshold( const CvArr* src, CvArr* dst, double max_value,
537  int adaptive_method CV_DEFAULT(CV_ADAPTIVE_THRESH_MEAN_C),
538  int threshold_type CV_DEFAULT(CV_THRESH_BINARY),
539  int block_size CV_DEFAULT(3),
540  double param1 CV_DEFAULT(5));
541 
542 /* Fills the connected component until the color difference gets large enough */
543 CVAPI(void) cvFloodFill( CvArr* image, CvPoint seed_point,
544  CvScalar new_val, CvScalar lo_diff CV_DEFAULT(cvScalarAll(0)),
545  CvScalar up_diff CV_DEFAULT(cvScalarAll(0)),
546  CvConnectedComp* comp CV_DEFAULT(NULL),
547  int flags CV_DEFAULT(4),
548  CvArr* mask CV_DEFAULT(NULL));
549 
550 /****************************************************************************************\
551 * Feature detection *
552 \****************************************************************************************/
553 
554 /* Runs canny edge detector */
555 CVAPI(void) cvCanny( const CvArr* image, CvArr* edges, double threshold1,
556  double threshold2, int aperture_size CV_DEFAULT(3) );
557 
558 /* Calculates constraint image for corner detection
559  Dx^2 * Dyy + Dxx * Dy^2 - 2 * Dx * Dy * Dxy.
560  Applying threshold to the result gives coordinates of corners */
561 CVAPI(void) cvPreCornerDetect( const CvArr* image, CvArr* corners,
562  int aperture_size CV_DEFAULT(3) );
563 
564 /* Calculates eigen values and vectors of 2x2
565  gradient covariation matrix at every image pixel */
566 CVAPI(void) cvCornerEigenValsAndVecs( const CvArr* image, CvArr* eigenvv,
567  int block_size, int aperture_size CV_DEFAULT(3) );
568 
569 /* Calculates minimal eigenvalue for 2x2 gradient covariation matrix at
570  every image pixel */
571 CVAPI(void) cvCornerMinEigenVal( const CvArr* image, CvArr* eigenval,
572  int block_size, int aperture_size CV_DEFAULT(3) );
573 
574 /* Harris corner detector:
575  Calculates det(M) - k*(trace(M)^2), where M is 2x2 gradient covariation matrix for each pixel */
576 CVAPI(void) cvCornerHarris( const CvArr* image, CvArr* harris_response,
577  int block_size, int aperture_size CV_DEFAULT(3),
578  double k CV_DEFAULT(0.04) );
579 
580 /* Adjust corner position using some sort of gradient search */
581 CVAPI(void) cvFindCornerSubPix( const CvArr* image, CvPoint2D32f* corners,
584 
585 /* Finds a sparse set of points within the selected region
586  that seem to be easy to track */
587 CVAPI(void) cvGoodFeaturesToTrack( const CvArr* image, CvArr* eig_image,
588  CvArr* temp_image, CvPoint2D32f* corners,
589  int* corner_count, double quality_level,
590  double min_distance,
591  const CvArr* mask CV_DEFAULT(NULL),
592  int block_size CV_DEFAULT(3),
593  int use_harris CV_DEFAULT(0),
594  double k CV_DEFAULT(0.04) );
595 
596 /* Finds lines on binary image using one of several methods.
597  line_storage is either memory storage or 1 x <max number of lines> CvMat, its
598  number of columns is changed by the function.
599  method is one of CV_HOUGH_*;
600  rho, theta and threshold are used for each of those methods;
601  param1 ~ line length, param2 ~ line gap - for probabilistic,
602  param1 ~ srn, param2 ~ stn - for multi-scale */
603 CVAPI(CvSeq*) cvHoughLines2( CvArr* image, void* line_storage, int method,
604  double rho, double theta, int threshold,
605  double param1 CV_DEFAULT(0), double param2 CV_DEFAULT(0));
606 
607 /* Finds circles in the image */
608 CVAPI(CvSeq*) cvHoughCircles( CvArr* image, void* circle_storage,
609  int method, double dp, double min_dist,
610  double param1 CV_DEFAULT(100),
611  double param2 CV_DEFAULT(100),
612  int min_radius CV_DEFAULT(0),
613  int max_radius CV_DEFAULT(0));
614 
615 /* Fits a line into set of 2d or 3d points in a robust way (M-estimator technique) */
616 CVAPI(void) cvFitLine( const CvArr* points, int dist_type, double param,
617  double reps, double aeps, float* line );
618 
619 #ifdef __cplusplus
620 }
621 #endif
622 
623 #endif
int dims
Definition: core_c.h:218
CvArr CvPoint2D32f double M
Definition: imgproc_c.h:186
CvPoint2D32f float * radius
Definition: imgproc_c.h:383
CvPoint2D32f pt[4]
Definition: imgproc_c.h:410
CvArr * edges
Definition: imgproc_c.h:555
const CvArr int distance_type
Definition: imgproc_c.h:287
CvHuMoments * hu_moments
Definition: imgproc_c.h:256
GLenum mode
GLenum GLenum GLenum input
Definition: legacy.hpp:84
Definition: types_c.h:1021
int rows
Definition: imgproc_c.h:223
Definition: types_c.h:603
int double double double float * line
Definition: imgproc_c.h:616
CvArr CvArr * orientation
Definition: tracking.hpp:125
CVAPI(void) cvAcc(const CvArr *image
CvArr CvArr IplConvKernel int operation
Definition: imgproc_c.h:242
CvPoint2D32f int CvSize CvSize CvTermCriteria criteria
Definition: imgproc_c.h:581
Definition: types_c.h:578
const CvArr * convexhull
Definition: imgproc_c.h:400
Definition: types_c.h:921
void int double dp
Definition: imgproc_c.h:608
CV_EXPORTS_W void accumulate(InputArray src, InputOutputArray dst, InputArray mask=noArray())
adds image to the accumulator (dst += src). Unlike cv::add, dst and src can have different types...
Definition: types_c.h:951
Definition: types_c.h:1459
Definition: types_c.h:1138
CvSeq * contour
Definition: core_c.h:1431
int * sizes
Definition: imgproc_c.h:430
int dist_type
Definition: imgproc_c.h:616
CvArr const CvMat * camera_matrix
Definition: imgproc_c.h:196
CvArr * markers
Definition: imgproc_c.h:130
CvArr double threshold1
Definition: imgproc_c.h:555
Definition: types_c.h:53
const CvArr * signature2
Definition: imgproc_c.h:287
GLuint src
Definition: core_c.h:1650
void int double rho
Definition: imgproc_c.h:603
int int int flags
Definition: highgui_c.h:186
CV_INLINE CvPoint cvPoint(int x, int y)
Definition: types_c.h:1029
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: core_c.h:403
int double double reps
Definition: imgproc_c.h:616
Definition: types_c.h:533
GLfloat angle
Definition: core_c.h:1297
CvArr * eigenval
Definition: imgproc_c.h:571
GLXFBConfig Window win
int int int int shape
Definition: imgproc_c.h:223
CvArr const CvMat * kernel
Definition: imgproc_c.h:89
CV_INLINE double cvContourPerimeter(const void *contour)
Definition: imgproc_c.h:362
Definition: types_c.h:1446
int CvMemStorage int double eps
Definition: imgproc_c.h:353
int int anchor_x
Definition: imgproc_c.h:223
GLenum GLsizei GLenum GLenum const GLvoid * image
Definition: highgui_c.h:230
CvPoint CvScalar new_val
Definition: imgproc_c.h:543
const CvArr CvArr int method
Definition: imgproc_c.h:281
CvChainPtReader * reader
Definition: imgproc_c.h:340
Definition: types_c.h:1298
Definition: types_c.h:1202
CvArr int xorder
Definition: imgproc_c.h:135
CvArr * harris_response
Definition: imgproc_c.h:576
int double double double aeps
Definition: imgproc_c.h:616
int int y_order
Definition: imgproc_c.h:250
const CvHistogram CvHistogram * dst_hist
Definition: imgproc_c.h:509
CV_INLINE CvTermCriteria cvTermCriteria(int type, int max_iter, double epsilon)
Definition: types_c.h:1007
CvArr const CvArr const CvArr * mapy
Definition: imgproc_c.h:176
OutputArray OutputArray int int int labelType
Definition: imgproc.hpp:825
CvPoint pt1
Definition: imgproc_c.h:262
GLint GLvoid * img
Definition: legacy.hpp:1150
CvArr CvArr CvPoint2D32f int double double min_distance
Definition: imgproc_c.h:587
Definition: types_c.h:590
CvArr const CvArr * mapx
Definition: imgproc_c.h:176
Definition: types_c.h:344
IplImage CvMemStorage CvSeq ** comp
Definition: legacy.hpp:2917
const CvHistogram * hist2
Definition: imgproc_c.h:468
void * circle_storage
Definition: imgproc_c.h:608
CvPoint seed_point
Definition: imgproc_c.h:543
const CvArr * image2
Definition: imgproc_c.h:64
GLclampf GLclampf GLclampf alpha
Definition: core_c.h:687
int CvHistogram * hist
Definition: imgproc_c.h:440
CvArr CvPoint int bordertype
Definition: imgproc_c.h:77
Definition: types_c.h:379
Definition: types_c.h:1272
Definition: types_c.h:569
CvSeq * new_contour
Definition: imgproc_c.h:324
GLuint buffer
const CvArr CvContour CvSeqBlock * block
Definition: imgproc_c.h:414
CvArr CvArr * temp_image
Definition: imgproc_c.h:587
const CvArr CvArr * acc
Definition: imgproc_c.h:64
CvMoments * moments
Definition: imgproc_c.h:247
Definition: types_c.h:370
CvArr * eigenvv
Definition: imgproc_c.h:566
CvArr int CvScalar param1
Definition: core_c.h:649
CvArr CvArr CvPoint2D32f int double quality_level
Definition: imgproc_c.h:587
const CvArr const CvArr const CvArr * tilted_sum
Definition: objdetect.hpp:147
CvArr int block_size
Definition: imgproc_c.h:566
const CvMat CvMat CvMat int k
Definition: legacy.hpp:3052
GLsizei range
GLintptr offset
void CvArr
Definition: types_c.h:196
void int double double min_dist
Definition: imgproc_c.h:608
GLuint GLuint GLsizei count
Definition: core_c.h:973
CvArr double double sr
Definition: imgproc_c.h:125
CvArr * sum
Definition: imgproc_c.h:56
CvSlice slice
Definition: core_c.h:1053
CvArr * sqsum
Definition: imgproc_c.h:60
const CvRect * rect2
Definition: imgproc_c.h:407
const CvArr CvArr * flow
Definition: tracking.hpp:102
float * min_value
Definition: imgproc_c.h:452
struct _CvContourScanner * CvContourScanner
Definition: types_c.h:423
Definition: types_c.h:402
CvArr * corners
Definition: imgproc_c.h:561
CvArr const CvArr *mask CV_DEFAULT(NULL))
CvPoint2D32f int CvSize CvSize zero_zone
Definition: imgproc_c.h:581
void int double double theta
Definition: imgproc_c.h:603
CvArr * eig_image
Definition: imgproc_c.h:587
CvArr const CvMat const CvMat * distortion_coeffs
Definition: imgproc_c.h:196
Definition: types_c.h:645
const CvArr CvArr double int int int iterations
Definition: tracking.hpp:102
CvSeq CvScalar CvScalar int max_level
Definition: core_c.h:1431
CvArr double double threshold2
Definition: imgproc_c.h:555
CV_INLINE CvScalar cvScalarAll(double val0123)
Definition: types_c.h:1247
CvPoint const int int int is_closed
Definition: core_c.h:1324
Definition: types_c.h:465
Definition: types_c.h:997
const CvArr CvArr * mapxy
Definition: imgproc_c.h:182
CvArr CvPoint2D32f double maxRadius
Definition: imgproc_c.h:191
GLsizei const GLfloat * value
Definition: core_c.h:341
int header_size
Definition: imgproc_c.h:353
CvPoint2D32f int measure_dist
Definition: imgproc_c.h:423
int cols
Definition: core_c.h:109
CvArr double double int threshold_type
Definition: imgproc_c.h:527
GLuint GLuint GLsizei GLenum type
Definition: core_c.h:114
int extra_layers
Definition: imgproc_c.h:114
float ** ranges
Definition: imgproc_c.h:435
Definition: types_c.h:1173
int CvArr CvTermCriteria termcrit
Definition: core_c.h:1472
float(CV_CDECL * CvDistanceFunction)(const float *a, const float *b, void *user_param)
Definition: types_c.h:396
double threshold
Definition: imgproc_c.h:463
CvArr double sp
Definition: imgproc_c.h:125
Definition: types_c.h:1223
CvArr int code
Definition: imgproc_c.h:144
float float * max_value
Definition: imgproc_c.h:452
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
double factor
Definition: imgproc_c.h:459
CvArr int CvScalar CvScalar param2
Definition: core_c.h:649
CvArr * arr
Definition: core_c.h:649
Definition: types_c.h:68
Definition: types_c.h:1333
GLuint dst
Definition: calib3d.hpp:134
CvArr CvPoint2D32f center
Definition: imgproc_c.h:186
GLsizei const GLfloat * points
const CvArr * templ
Definition: imgproc_c.h:281
CvPoint CvPoint pt2
Definition: imgproc_c.h:262
GLboolean GLenum GLenum GLvoid * values
CvMemStorage * storage
Definition: imgproc_c.h:301
CvMemStorage CvSeq ** first_contour
Definition: imgproc_c.h:301
CvMat * lower_bound
Definition: legacy.hpp:1187
int double rate
Definition: imgproc_c.h:114
const CvMat const CvMat const CvMat * new_camera_matrix
Definition: imgproc_c.h:209
CvMemStorage CvSeq CvCmpFunc void * userdata
Definition: core_c.h:1083
CvArr CvArr * temp
Definition: imgproc_c.h:242
Definition: types_c.h:1040
int number
Definition: imgproc_c.h:478
CV_INLINE void cvCalcHist(IplImage **image, CvHistogram *hist, int accumulate CV_DEFAULT(0), const CvArr *mask CV_DEFAULT(NULL))
Definition: imgproc_c.h:486
GLenum GLenum GLenum GLenum GLenum scale
const void * object2
Definition: imgproc_c.h:386
Definition: types_c.h:426
GLenum GLint GLuint mask
Definition: tracking.hpp:132
const CvMat * dist_coeffs
Definition: imgproc_c.h:209
const CvArr * mat
Definition: imgproc_c.h:414
const CvArr CvArr CvArr * mapalpha
Definition: imgproc_c.h:182
int x_order
Definition: imgproc_c.h:250
Definition: types_c.h:335
CvArr CvArr IplConvKernel * element
Definition: imgproc_c.h:242
int int int anchor_y
Definition: imgproc_c.h:223
CvArr const CvMat * map_matrix
Definition: imgproc_c.h:152
const CvArr CvArr * result
Definition: imgproc_c.h:281
CvArr int int yorder
Definition: imgproc_c.h:135
GLfloat param
Definition: types_c.h:76
Definition: types_c.h:413
const CvArr CvContour * contour_header
Definition: imgproc_c.h:414
CvMemStorage CvSeq ** labels
Definition: core_c.h:1083
void * line_storage
Definition: imgproc_c.h:603
const CvMat const CvMat * R
Definition: imgproc_c.h:209
Definition: types_c.h:512
CvArr CvArr CvPoint2D32f int * corner_count
Definition: imgproc_c.h:587