00001
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #ifndef __OPENCV_IMGPROC_HPP__
00048 #define __OPENCV_IMGPROC_HPP__
00049
00050 #include "opencv2/core/core.hpp"
00051 #include "opencv2/imgproc/types_c.h"
00052
00053 #ifdef __cplusplus
00054
00058 namespace cv
00059 {
00060
00062 enum { BORDER_REPLICATE=IPL_BORDER_REPLICATE, BORDER_CONSTANT=IPL_BORDER_CONSTANT,
00063 BORDER_REFLECT=IPL_BORDER_REFLECT, BORDER_WRAP=IPL_BORDER_WRAP,
00064 BORDER_REFLECT_101=IPL_BORDER_REFLECT_101, BORDER_REFLECT101=BORDER_REFLECT_101,
00065 BORDER_TRANSPARENT=IPL_BORDER_TRANSPARENT,
00066 BORDER_DEFAULT=BORDER_REFLECT_101, BORDER_ISOLATED=16 };
00067
00069 CV_EXPORTS_W int borderInterpolate( int p, int len, int borderType );
00070
00080 class CV_EXPORTS BaseRowFilter
00081 {
00082 public:
00084 BaseRowFilter();
00086 virtual ~BaseRowFilter();
00088 virtual void operator()(const uchar* src, uchar* dst,
00089 int width, int cn) = 0;
00090 int ksize, anchor;
00091 };
00092
00093
00107 class CV_EXPORTS BaseColumnFilter
00108 {
00109 public:
00111 BaseColumnFilter();
00113 virtual ~BaseColumnFilter();
00115 virtual void operator()(const uchar** src, uchar* dst, int dststep,
00116 int dstcount, int width) = 0;
00118 virtual void reset();
00119 int ksize, anchor;
00120 };
00121
00133 class CV_EXPORTS BaseFilter
00134 {
00135 public:
00137 BaseFilter();
00139 virtual ~BaseFilter();
00141 virtual void operator()(const uchar** src, uchar* dst, int dststep,
00142 int dstcount, int width, int cn) = 0;
00144 virtual void reset();
00145 Size ksize;
00146 Point anchor;
00147 };
00148
00222 class CV_EXPORTS FilterEngine
00223 {
00224 public:
00226 FilterEngine();
00228 FilterEngine(const Ptr<BaseFilter>& _filter2D,
00229 const Ptr<BaseRowFilter>& _rowFilter,
00230 const Ptr<BaseColumnFilter>& _columnFilter,
00231 int srcType, int dstType, int bufType,
00232 int _rowBorderType=BORDER_REPLICATE,
00233 int _columnBorderType=-1,
00234 const Scalar& _borderValue=Scalar());
00236 virtual ~FilterEngine();
00238 void init(const Ptr<BaseFilter>& _filter2D,
00239 const Ptr<BaseRowFilter>& _rowFilter,
00240 const Ptr<BaseColumnFilter>& _columnFilter,
00241 int srcType, int dstType, int bufType,
00242 int _rowBorderType=BORDER_REPLICATE, int _columnBorderType=-1,
00243 const Scalar& _borderValue=Scalar());
00245 virtual int start(Size wholeSize, Rect roi, int maxBufRows=-1);
00247 virtual int start(const Mat& src, const Rect& srcRoi=Rect(0,0,-1,-1),
00248 bool isolated=false, int maxBufRows=-1);
00250 virtual int proceed(const uchar* src, int srcStep, int srcCount,
00251 uchar* dst, int dstStep);
00253 virtual void apply( const Mat& src, Mat& dst,
00254 const Rect& srcRoi=Rect(0,0,-1,-1),
00255 Point dstOfs=Point(0,0),
00256 bool isolated=false);
00258 bool isSeparable() const { return (const BaseFilter*)filter2D == 0; }
00260 int remainingInputRows() const;
00261 int remainingOutputRows() const;
00262
00263 int srcType, dstType, bufType;
00264 Size ksize;
00265 Point anchor;
00266 int maxWidth;
00267 Size wholeSize;
00268 Rect roi;
00269 int dx1, dx2;
00270 int rowBorderType, columnBorderType;
00271 vector<int> borderTab;
00272 int borderElemSize;
00273 vector<uchar> ringBuf;
00274 vector<uchar> srcRow;
00275 vector<uchar> constBorderValue;
00276 vector<uchar> constBorderRow;
00277 int bufStep, startY, startY0, endY, rowCount, dstY;
00278 vector<uchar*> rows;
00279
00280 Ptr<BaseFilter> filter2D;
00281 Ptr<BaseRowFilter> rowFilter;
00282 Ptr<BaseColumnFilter> columnFilter;
00283 };
00284
00286 enum { KERNEL_GENERAL=0, KERNEL_SYMMETRICAL=1, KERNEL_ASYMMETRICAL=2,
00287 KERNEL_SMOOTH=4, KERNEL_INTEGER=8 };
00288
00290 CV_EXPORTS int getKernelType(const Mat& kernel, Point anchor);
00291
00293 CV_EXPORTS Ptr<BaseRowFilter> getLinearRowFilter(int srcType, int bufType,
00294 const Mat& kernel, int anchor,
00295 int symmetryType);
00296
00298 CV_EXPORTS Ptr<BaseColumnFilter> getLinearColumnFilter(int bufType, int dstType,
00299 const Mat& kernel, int anchor,
00300 int symmetryType, double delta=0,
00301 int bits=0);
00302
00304 CV_EXPORTS Ptr<BaseFilter> getLinearFilter(int srcType, int dstType,
00305 const Mat& kernel,
00306 Point anchor=Point(-1,-1),
00307 double delta=0, int bits=0);
00308
00310 CV_EXPORTS Ptr<FilterEngine> createSeparableLinearFilter(int srcType, int dstType,
00311 const Mat& rowKernel, const Mat& columnKernel,
00312 Point _anchor=Point(-1,-1), double delta=0,
00313 int _rowBorderType=BORDER_DEFAULT,
00314 int _columnBorderType=-1,
00315 const Scalar& _borderValue=Scalar());
00316
00318 CV_EXPORTS Ptr<FilterEngine> createLinearFilter(int srcType, int dstType,
00319 const Mat& kernel, Point _anchor=Point(-1,-1),
00320 double delta=0, int _rowBorderType=BORDER_DEFAULT,
00321 int _columnBorderType=-1, const Scalar& _borderValue=Scalar());
00322
00324 CV_EXPORTS_W Mat getGaussianKernel( int ksize, double sigma, int ktype=CV_64F );
00325
00327 CV_EXPORTS Ptr<FilterEngine> createGaussianFilter( int type, Size ksize,
00328 double sigma1, double sigma2=0,
00329 int borderType=BORDER_DEFAULT);
00331 CV_EXPORTS_W void getDerivKernels( CV_OUT Mat& kx, CV_OUT Mat& ky,
00332 int dx, int dy, int ksize,
00333 bool normalize=false, int ktype=CV_32F );
00335 CV_EXPORTS Ptr<FilterEngine> createDerivFilter( int srcType, int dstType,
00336 int dx, int dy, int ksize,
00337 int borderType=BORDER_DEFAULT );
00339 CV_EXPORTS Ptr<BaseRowFilter> getRowSumFilter(int srcType, int sumType,
00340 int ksize, int anchor=-1);
00342 CV_EXPORTS Ptr<BaseColumnFilter> getColumnSumFilter( int sumType, int dstType,
00343 int ksize, int anchor=-1,
00344 double scale=1);
00346 CV_EXPORTS Ptr<FilterEngine> createBoxFilter( int srcType, int dstType, Size ksize,
00347 Point anchor=Point(-1,-1),
00348 bool normalize=true,
00349 int borderType=BORDER_DEFAULT);
00351 enum { MORPH_ERODE=0, MORPH_DILATE=1, MORPH_OPEN=2, MORPH_CLOSE=3,
00352 MORPH_GRADIENT=4, MORPH_TOPHAT=5, MORPH_BLACKHAT=6 };
00353
00355 CV_EXPORTS Ptr<BaseRowFilter> getMorphologyRowFilter(int op, int type, int ksize, int anchor=-1);
00357 CV_EXPORTS Ptr<BaseColumnFilter> getMorphologyColumnFilter(int op, int type, int ksize, int anchor=-1);
00359 CV_EXPORTS Ptr<BaseFilter> getMorphologyFilter(int op, int type, const Mat& kernel,
00360 Point anchor=Point(-1,-1));
00361
00363 static inline Scalar morphologyDefaultBorderValue() { return Scalar::all(DBL_MAX); }
00364
00366 CV_EXPORTS Ptr<FilterEngine> createMorphologyFilter(int op, int type, const Mat& kernel,
00367 Point anchor=Point(-1,-1), int _rowBorderType=BORDER_CONSTANT,
00368 int _columnBorderType=-1,
00369 const Scalar& _borderValue=morphologyDefaultBorderValue());
00370
00372 enum { MORPH_RECT=0, MORPH_CROSS=1, MORPH_ELLIPSE=2 };
00374 CV_EXPORTS_W Mat getStructuringElement(int shape, Size ksize, Point anchor=Point(-1,-1));
00375
00376 template<> CV_EXPORTS void Ptr<IplConvKernel>::delete_obj();
00377
00379 CV_EXPORTS_W void copyMakeBorder( const Mat& src, CV_OUT Mat& dst,
00380 int top, int bottom, int left, int right,
00381 int borderType, const Scalar& value=Scalar() );
00382
00384 CV_EXPORTS_W void medianBlur( const Mat& src, CV_OUT Mat& dst, int ksize );
00386 CV_EXPORTS_AS(gaussianBlur) void GaussianBlur( const Mat& src, CV_OUT Mat& dst, Size ksize,
00387 double sigma1, double sigma2=0,
00388 int borderType=BORDER_DEFAULT );
00390 CV_EXPORTS_W void bilateralFilter( const Mat& src, CV_OUT Mat& dst, int d,
00391 double sigmaColor, double sigmaSpace,
00392 int borderType=BORDER_DEFAULT );
00394 CV_EXPORTS_W void boxFilter( const Mat& src, CV_OUT Mat& dst, int ddepth,
00395 Size ksize, Point anchor=Point(-1,-1),
00396 bool normalize=true,
00397 int borderType=BORDER_DEFAULT );
00399 CV_EXPORTS_W void blur( const Mat& src, CV_OUT Mat& dst,
00400 Size ksize, Point anchor=Point(-1,-1),
00401 int borderType=BORDER_DEFAULT );
00402
00404 CV_EXPORTS_W void filter2D( const Mat& src, CV_OUT Mat& dst, int ddepth,
00405 const Mat& kernel, Point anchor=Point(-1,-1),
00406 double delta=0, int borderType=BORDER_DEFAULT );
00407
00409 CV_EXPORTS_W void sepFilter2D( const Mat& src, CV_OUT Mat& dst, int ddepth,
00410 const Mat& kernelX, const Mat& kernelY,
00411 Point anchor=Point(-1,-1),
00412 double delta=0, int borderType=BORDER_DEFAULT );
00413
00415 CV_EXPORTS_AS(sobel) void Sobel( const Mat& src, CV_OUT Mat& dst, int ddepth,
00416 int dx, int dy, int ksize=3,
00417 double scale=1, double delta=0,
00418 int borderType=BORDER_DEFAULT );
00419
00421 CV_EXPORTS_AS(scharr) void Scharr( const Mat& src, CV_OUT Mat& dst, int ddepth,
00422 int dx, int dy, double scale=1, double delta=0,
00423 int borderType=BORDER_DEFAULT );
00424
00426 CV_EXPORTS_AS(laplacian) void Laplacian( const Mat& src, CV_OUT Mat& dst, int ddepth,
00427 int ksize=1, double scale=1, double delta=0,
00428 int borderType=BORDER_DEFAULT );
00429
00431 CV_EXPORTS_AS(canny) void Canny( const Mat& image, CV_OUT Mat& edges,
00432 double threshold1, double threshold2,
00433 int apertureSize=3, bool L2gradient=false );
00434
00436 CV_EXPORTS_W void cornerMinEigenVal( const Mat& src, CV_OUT Mat& dst,
00437 int blockSize, int ksize=3,
00438 int borderType=BORDER_DEFAULT );
00439
00441 CV_EXPORTS_W void cornerHarris( const Mat& src, CV_OUT Mat& dst, int blockSize,
00442 int ksize, double k,
00443 int borderType=BORDER_DEFAULT );
00444
00446 CV_EXPORTS_W void cornerEigenValsAndVecs( const Mat& src, CV_OUT Mat& dst,
00447 int blockSize, int ksize,
00448 int borderType=BORDER_DEFAULT );
00449
00451 CV_EXPORTS_W void preCornerDetect( const Mat& src, CV_OUT Mat& dst, int ksize,
00452 int borderType=BORDER_DEFAULT );
00453
00455 CV_EXPORTS void cornerSubPix( const Mat& image, vector<Point2f>& corners,
00456 Size winSize, Size zeroZone,
00457 TermCriteria criteria );
00458
00460 CV_EXPORTS_W void goodFeaturesToTrack( const Mat& image, CV_OUT vector<Point2f>& corners,
00461 int maxCorners, double qualityLevel, double minDistance,
00462 const Mat& mask=Mat(), int blockSize=3,
00463 bool useHarrisDetector=false, double k=0.04 );
00464
00466 CV_EXPORTS_AS(houghLines) void HoughLines( const Mat& image, CV_OUT vector<Vec2f>& lines,
00467 double rho, double theta, int threshold,
00468 double srn=0, double stn=0 );
00469
00471 CV_EXPORTS_AS(houghLinesP) void HoughLinesP( Mat& image, CV_OUT vector<Vec4i>& lines,
00472 double rho, double theta, int threshold,
00473 double minLineLength=0, double maxLineGap=0 );
00474
00476 CV_EXPORTS_AS(houghCircles) void HoughCircles( const Mat& image, CV_OUT vector<Vec3f>& circles,
00477 int method, double dp, double minDist,
00478 double param1=100, double param2=100,
00479 int minRadius=0, int maxRadius=0 );
00480
00482 CV_EXPORTS_W void erode( const Mat& src, CV_OUT Mat& dst, const Mat& kernel,
00483 Point anchor=Point(-1,-1), int iterations=1,
00484 int borderType=BORDER_CONSTANT,
00485 const Scalar& borderValue=morphologyDefaultBorderValue() );
00486
00488 CV_EXPORTS_W void dilate( const Mat& src, CV_OUT Mat& dst, const Mat& kernel,
00489 Point anchor=Point(-1,-1), int iterations=1,
00490 int borderType=BORDER_CONSTANT,
00491 const Scalar& borderValue=morphologyDefaultBorderValue() );
00492
00494 CV_EXPORTS_W void morphologyEx( const Mat& src, CV_OUT Mat& dst,
00495 int op, const Mat& kernel,
00496 Point anchor=Point(-1,-1), int iterations=1,
00497 int borderType=BORDER_CONSTANT,
00498 const Scalar& borderValue=morphologyDefaultBorderValue() );
00499
00501 enum
00502 {
00503 INTER_NEAREST=0,
00504 INTER_LINEAR=1,
00505 INTER_CUBIC=2,
00506 INTER_AREA=3,
00507 INTER_LANCZOS4=4,
00508 INTER_MAX=7,
00509 WARP_INVERSE_MAP=16
00510 };
00511
00513 CV_EXPORTS_W void resize( const Mat& src, CV_OUT Mat& dst,
00514 Size dsize, double fx=0, double fy=0,
00515 int interpolation=INTER_LINEAR );
00516
00518 CV_EXPORTS_W void warpAffine( const Mat& src, CV_OUT Mat& dst,
00519 const Mat& M, Size dsize,
00520 int flags=INTER_LINEAR,
00521 int borderMode=BORDER_CONSTANT,
00522 const Scalar& borderValue=Scalar());
00523
00525 CV_EXPORTS_W void warpPerspective( const Mat& src, CV_OUT Mat& dst,
00526 const Mat& M, Size dsize,
00527 int flags=INTER_LINEAR,
00528 int borderMode=BORDER_CONSTANT,
00529 const Scalar& borderValue=Scalar());
00530
00531 enum { INTER_BITS=5, INTER_BITS2=INTER_BITS*2,
00532 INTER_TAB_SIZE=(1<<INTER_BITS),
00533 INTER_TAB_SIZE2=INTER_TAB_SIZE*INTER_TAB_SIZE };
00534
00536 CV_EXPORTS_W void remap( const Mat& src, CV_OUT Mat& dst, const Mat& map1, const Mat& map2,
00537 int interpolation, int borderMode=BORDER_CONSTANT,
00538 const Scalar& borderValue=Scalar());
00539
00541 CV_EXPORTS_W void convertMaps( const Mat& map1, const Mat& map2,
00542 CV_OUT Mat& dstmap1, CV_OUT Mat& dstmap2,
00543 int dstmap1type, bool nninterpolation=false );
00544
00546 CV_EXPORTS_W Mat getRotationMatrix2D( Point2f center, double angle, double scale );
00548 CV_EXPORTS Mat getPerspectiveTransform( const Point2f src[], const Point2f dst[] );
00550 CV_EXPORTS Mat getAffineTransform( const Point2f src[], const Point2f dst[] );
00552 CV_EXPORTS_W void invertAffineTransform( const Mat& M, CV_OUT Mat& iM );
00553
00555 CV_EXPORTS_W void getRectSubPix( const Mat& image, Size patchSize,
00556 Point2f center, CV_OUT Mat& patch, int patchType=-1 );
00557
00559 CV_EXPORTS_W void integral( const Mat& src, CV_OUT Mat& sum, int sdepth=-1 );
00561 CV_EXPORTS_AS(integral2) void integral( const Mat& src, CV_OUT Mat& sum, CV_OUT Mat& sqsum, int sdepth=-1 );
00563 CV_EXPORTS_AS(integral3) void integral( const Mat& src, CV_OUT Mat& sum, CV_OUT Mat& sqsum, CV_OUT Mat& tilted, int sdepth=-1 );
00564
00566 CV_EXPORTS_W void accumulate( const Mat& src, CV_IN_OUT Mat& dst, const Mat& mask=Mat() );
00568 CV_EXPORTS_W void accumulateSquare( const Mat& src, CV_IN_OUT Mat& dst, const Mat& mask=Mat() );
00570 CV_EXPORTS_W void accumulateProduct( const Mat& src1, const Mat& src2,
00571 CV_IN_OUT Mat& dst, const Mat& mask=Mat() );
00573 CV_EXPORTS_W void accumulateWeighted( const Mat& src, CV_IN_OUT Mat& dst,
00574 double alpha, const Mat& mask=Mat() );
00575
00577 enum { THRESH_BINARY=0, THRESH_BINARY_INV=1, THRESH_TRUNC=2, THRESH_TOZERO=3,
00578 THRESH_TOZERO_INV=4, THRESH_MASK=7, THRESH_OTSU=8 };
00579
00581 CV_EXPORTS_W double threshold( const Mat& src, CV_OUT Mat& dst, double thresh, double maxval, int type );
00582
00584 enum { ADAPTIVE_THRESH_MEAN_C=0, ADAPTIVE_THRESH_GAUSSIAN_C=1 };
00585
00587 CV_EXPORTS_W void adaptiveThreshold( const Mat& src, CV_OUT Mat& dst, double maxValue,
00588 int adaptiveMethod, int thresholdType,
00589 int blockSize, double C );
00590
00592 CV_EXPORTS_W void pyrDown( const Mat& src, CV_OUT Mat& dst, const Size& dstsize=Size());
00594 CV_EXPORTS_W void pyrUp( const Mat& src, CV_OUT Mat& dst, const Size& dstsize=Size());
00596 CV_EXPORTS void buildPyramid( const Mat& src, CV_OUT vector<Mat>& dst, int maxlevel );
00597
00599 CV_EXPORTS_W void undistort( const Mat& src, CV_OUT Mat& dst, const Mat& cameraMatrix,
00600 const Mat& distCoeffs, const Mat& newCameraMatrix=Mat() );
00602 CV_EXPORTS_W void initUndistortRectifyMap( const Mat& cameraMatrix, const Mat& distCoeffs,
00603 const Mat& R, const Mat& newCameraMatrix,
00604 Size size, int m1type, CV_OUT Mat& map1, CV_OUT Mat& map2 );
00605
00606 enum
00607 {
00608 PROJ_SPHERICAL_ORTHO = 0,
00609 PROJ_SPHERICAL_EQRECT = 1
00610 };
00611
00613 CV_EXPORTS_W float initWideAngleProjMap( const Mat& cameraMatrix, const Mat& distCoeffs,
00614 Size imageSize, int destImageWidth,
00615 int m1type, CV_OUT Mat& map1, CV_OUT Mat& map2,
00616 int projType=PROJ_SPHERICAL_EQRECT, double alpha=0);
00617
00619 CV_EXPORTS_W Mat getDefaultNewCameraMatrix( const Mat& cameraMatrix, Size imgsize=Size(),
00620 bool centerPrincipalPoint=false );
00622 CV_EXPORTS void undistortPoints( const Mat& src, CV_OUT vector<Point2f>& dst,
00623 const Mat& cameraMatrix, const Mat& distCoeffs,
00624 const Mat& R=Mat(), const Mat& P=Mat());
00626 CV_EXPORTS_W void undistortPoints( const Mat& src, CV_OUT Mat& dst,
00627 const Mat& cameraMatrix, const Mat& distCoeffs,
00628 const Mat& R=Mat(), const Mat& P=Mat());
00629
00630 template<> CV_EXPORTS void Ptr<CvHistogram>::delete_obj();
00631
00633 CV_EXPORTS void calcHist( const Mat* images, int nimages,
00634 const int* channels, const Mat& mask,
00635 Mat& hist, int dims, const int* histSize,
00636 const float** ranges, bool uniform=true, bool accumulate=false );
00637
00639 CV_EXPORTS void calcHist( const Mat* images, int nimages,
00640 const int* channels, const Mat& mask,
00641 SparseMat& hist, int dims,
00642 const int* histSize, const float** ranges,
00643 bool uniform=true, bool accumulate=false );
00644
00646 CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
00647 const int* channels, const Mat& hist,
00648 Mat& backProject, const float** ranges,
00649 double scale=1, bool uniform=true );
00650
00652 CV_EXPORTS void calcBackProject( const Mat* images, int nimages,
00653 const int* channels, const SparseMat& hist,
00654 Mat& backProject, const float** ranges,
00655 double scale=1, bool uniform=true );
00656
00658 CV_EXPORTS_W double compareHist( const Mat& H1, const Mat& H2, int method );
00659
00661 CV_EXPORTS double compareHist( const SparseMat& H1, const SparseMat& H2, int method );
00662
00664 CV_EXPORTS_W void equalizeHist( const Mat& src, CV_OUT Mat& dst );
00665
00667 CV_EXPORTS_W void watershed( const Mat& image, Mat& markers );
00668
00670 CV_EXPORTS_W void pyrMeanShiftFiltering( const Mat& src, CV_OUT Mat& dst,
00671 double sp, double sr, int maxLevel=1,
00672 TermCriteria termcrit=TermCriteria(TermCriteria::MAX_ITER+TermCriteria::EPS,5,1) );
00673
00675 enum { GC_BGD = 0,
00676 GC_FGD = 1,
00677 GC_PR_BGD = 2,
00678 GC_PR_FGD = 3
00679 };
00680
00682 enum { GC_INIT_WITH_RECT = 0,
00683 GC_INIT_WITH_MASK = 1,
00684 GC_EVAL = 2
00685 };
00686
00688 CV_EXPORTS_W void grabCut( const Mat& img, Mat& mask, Rect rect,
00689 Mat& bgdModel, Mat& fgdModel,
00690 int iterCount, int mode = GC_EVAL );
00691
00693 enum
00694 {
00695 INPAINT_NS=0,
00696 INPAINT_TELEA=1
00697 };
00698
00700 CV_EXPORTS_W void inpaint( const Mat& src, const Mat& inpaintMask,
00701 CV_OUT Mat& dst, double inpaintRange, int flags );
00702
00704 CV_EXPORTS_AS(distanceTransformWithLabels)
00705 void distanceTransform( const Mat& src, CV_OUT Mat& dst, Mat& labels,
00706 int distanceType, int maskSize );
00707
00709 CV_EXPORTS_W void distanceTransform( const Mat& src, CV_OUT Mat& dst,
00710 int distanceType, int maskSize );
00711
00712 enum { FLOODFILL_FIXED_RANGE = 1 << 16,
00713 FLOODFILL_MASK_ONLY = 1 << 17 };
00714
00716 CV_EXPORTS_W int floodFill( Mat& image,
00717 Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0,
00718 Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),
00719 int flags=4 );
00720
00722 CV_EXPORTS_AS(floodFillMask) int floodFill( Mat& image, Mat& mask,
00723 Point seedPoint, Scalar newVal, CV_OUT Rect* rect=0,
00724 Scalar loDiff=Scalar(), Scalar upDiff=Scalar(),
00725 int flags=4 );
00726
00728 CV_EXPORTS_W void cvtColor( const Mat& src, CV_OUT Mat& dst, int code, int dstCn=0 );
00729
00731 class CV_EXPORTS_W_MAP Moments
00732 {
00733 public:
00735 Moments();
00737 Moments(double m00, double m10, double m01, double m20, double m11,
00738 double m02, double m30, double m21, double m12, double m03 );
00740 Moments( const CvMoments& moments );
00742 operator CvMoments() const;
00743
00745 CV_PROP_RW double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03;
00747 CV_PROP_RW double mu20, mu11, mu02, mu30, mu21, mu12, mu03;
00749 CV_PROP_RW double nu20, nu11, nu02, nu30, nu21, nu12, nu03;
00750 };
00751
00753 CV_EXPORTS_W Moments moments( const Mat& array, bool binaryImage=false );
00754
00756 CV_EXPORTS void HuMoments( const Moments& moments, double hu[7] );
00757
00759 enum { TM_SQDIFF=0, TM_SQDIFF_NORMED=1, TM_CCORR=2, TM_CCORR_NORMED=3, TM_CCOEFF=4, TM_CCOEFF_NORMED=5 };
00760
00762 CV_EXPORTS_W void matchTemplate( const Mat& image, const Mat& templ, CV_OUT Mat& result, int method );
00763
00765 enum
00766 {
00767 RETR_EXTERNAL=0,
00768 RETR_LIST=1,
00769 RETR_CCOMP=2,
00770 RETR_TREE=3
00771 };
00772
00774 enum
00775 {
00776 CHAIN_APPROX_NONE=0,
00777 CHAIN_APPROX_SIMPLE=1,
00778 CHAIN_APPROX_TC89_L1=2,
00779 CHAIN_APPROX_TC89_KCOS=3
00780 };
00781
00783 CV_EXPORTS void findContours( Mat& image, CV_OUT vector<vector<Point> >& contours,
00784 vector<Vec4i>& hierarchy, int mode,
00785 int method, Point offset=Point());
00786
00788 CV_EXPORTS void findContours( Mat& image, CV_OUT vector<vector<Point> >& contours,
00789 int mode, int method, Point offset=Point());
00790
00792 CV_EXPORTS void drawContours( Mat& image, const vector<vector<Point> >& contours,
00793 int contourIdx, const Scalar& color,
00794 int thickness=1, int lineType=8,
00795 const vector<Vec4i>& hierarchy=vector<Vec4i>(),
00796 int maxLevel=INT_MAX, Point offset=Point() );
00797
00799 CV_EXPORTS void approxPolyDP( const Mat& curve,
00800 CV_OUT vector<Point>& approxCurve,
00801 double epsilon, bool closed );
00803 CV_EXPORTS void approxPolyDP( const Mat& curve,
00804 CV_OUT vector<Point2f>& approxCurve,
00805 double epsilon, bool closed );
00807 CV_EXPORTS_W double arcLength( const Mat& curve, bool closed );
00809 CV_EXPORTS_W Rect boundingRect( const Mat& points );
00811 CV_EXPORTS_W double contourArea( const Mat& contour, bool oriented=false );
00813 CV_EXPORTS_W RotatedRect minAreaRect( const Mat& points );
00815 CV_EXPORTS_W void minEnclosingCircle( const Mat& points,
00816 Point2f& center, float& radius );
00818 CV_EXPORTS_W double matchShapes( const Mat& contour1,
00819 const Mat& contour2,
00820 int method, double parameter );
00822 CV_EXPORTS void convexHull( const Mat& points, CV_OUT vector<int>& hull, bool clockwise=false );
00824 CV_EXPORTS void convexHull( const Mat& points, CV_OUT vector<Point>& hull, bool clockwise=false );
00826 CV_EXPORTS void convexHull( const Mat& points, CV_OUT vector<Point2f>& hull, bool clockwise=false );
00827
00829 CV_EXPORTS_W bool isContourConvex( const Mat& contour );
00830
00832 CV_EXPORTS_W RotatedRect fitEllipse( const Mat& points );
00833
00835 CV_EXPORTS void fitLine( const Mat& points, CV_OUT Vec4f& line, int distType,
00836 double param, double reps, double aeps );
00838 CV_EXPORTS void fitLine( const Mat& points, CV_OUT Vec6f& line, int distType,
00839 double param, double reps, double aeps );
00841 CV_EXPORTS_W double pointPolygonTest( const Mat& contour,
00842 Point2f pt, bool measureDist );
00843
00845 CV_EXPORTS_W Mat estimateRigidTransform( const Mat& A, const Mat& B,
00846 bool fullAffine );
00847
00848 }
00849
00850
00851
00852
00853 struct lsh_hash {
00854 int h1, h2;
00855 };
00856
00857 struct CvLSHOperations
00858 {
00859 virtual ~CvLSHOperations() {}
00860
00861 virtual int vector_add(const void* data) = 0;
00862 virtual void vector_remove(int i) = 0;
00863 virtual const void* vector_lookup(int i) = 0;
00864 virtual void vector_reserve(int n) = 0;
00865 virtual unsigned int vector_count() = 0;
00866
00867 virtual void hash_insert(lsh_hash h, int l, int i) = 0;
00868 virtual void hash_remove(lsh_hash h, int l, int i) = 0;
00869 virtual int hash_lookup(lsh_hash h, int l, int* ret_i, int ret_i_max) = 0;
00870 };
00871
00872 #endif
00873
00874 #endif
00875
00876