📄 cv.h
字号:
/* Creates new subdivision */CVAPI(CvSubdiv2D*) cvCreateSubdiv2D( int subdiv_type, int header_size, int vtx_size, int quadedge_size, CvMemStorage* storage );/************************* high-level subdivision functions ***************************//* Simplified Delaunay diagram creation */CV_INLINE CvSubdiv2D* cvCreateSubdivDelaunay2D( CvRect rect, CvMemStorage* storage ){ CvSubdiv2D* subdiv = cvCreateSubdiv2D( CV_SEQ_KIND_SUBDIV2D, sizeof(*subdiv), sizeof(CvSubdiv2DPoint), sizeof(CvQuadEdge2D), storage ); cvInitSubdivDelaunay2D( subdiv, rect ); return subdiv;}/* Inserts new point to the Delaunay triangulation */CVAPI(CvSubdiv2DPoint*) cvSubdivDelaunay2DInsert( CvSubdiv2D* subdiv, CvPoint2D32f pt);/* Locates a point within the Delaunay triangulation (finds the edge the point is left to or belongs to, or the triangulation point the given point coinsides with */CVAPI(CvSubdiv2DPointLocation) cvSubdiv2DLocate( CvSubdiv2D* subdiv, CvPoint2D32f pt, CvSubdiv2DEdge* edge, CvSubdiv2DPoint** vertex CV_DEFAULT(NULL) );/* Calculates Voronoi tesselation (i.e. coordinates of Voronoi points) */CVAPI(void) cvCalcSubdivVoronoi2D( CvSubdiv2D* subdiv );/* Removes all Voronoi points from the tesselation */CVAPI(void) cvClearSubdivVoronoi2D( CvSubdiv2D* subdiv );/* Finds the nearest to the given point vertex in subdivision. */CVAPI(CvSubdiv2DPoint*) cvFindNearestPoint2D( CvSubdiv2D* subdiv, CvPoint2D32f pt );/************ Basic quad-edge navigation and operations ************/CV_INLINE CvSubdiv2DEdge cvSubdiv2DNextEdge( CvSubdiv2DEdge edge ){ return CV_SUBDIV2D_NEXT_EDGE(edge);}CV_INLINE CvSubdiv2DEdge cvSubdiv2DRotateEdge( CvSubdiv2DEdge edge, int rotate ){ return (edge & ~3) + ((edge + rotate) & 3);}CV_INLINE CvSubdiv2DEdge cvSubdiv2DSymEdge( CvSubdiv2DEdge edge ){ return edge ^ 2;}CV_INLINE CvSubdiv2DEdge cvSubdiv2DGetEdge( CvSubdiv2DEdge edge, CvNextEdgeType type ){ CvQuadEdge2D* e = (CvQuadEdge2D*)(edge & ~3); edge = e->next[(edge + (int)type) & 3]; return (edge & ~3) + ((edge + ((int)type >> 4)) & 3);}CV_INLINE CvSubdiv2DPoint* cvSubdiv2DEdgeOrg( CvSubdiv2DEdge edge ){ CvQuadEdge2D* e = (CvQuadEdge2D*)(edge & ~3); return (CvSubdiv2DPoint*)e->pt[edge & 3];}CV_INLINE CvSubdiv2DPoint* cvSubdiv2DEdgeDst( CvSubdiv2DEdge edge ){ CvQuadEdge2D* e = (CvQuadEdge2D*)(edge & ~3); return (CvSubdiv2DPoint*)e->pt[(edge + 2) & 3];}CV_INLINE double cvTriangleArea( CvPoint2D32f a, CvPoint2D32f b, CvPoint2D32f c ){ return (b.x - a.x) * (c.y - a.y) - (b.y - a.y) * (c.x - a.x);}/****************************************************************************************\* Contour Processing and Shape Analysis *\****************************************************************************************/#define CV_POLY_APPROX_DP 0/* Approximates a single polygonal curve (contour) or a tree of polygonal curves (contours) */CVAPI(CvSeq*) cvApproxPoly( const void* src_seq, int header_size, CvMemStorage* storage, int method, double parameter, int parameter2 CV_DEFAULT(0));#define CV_DOMINANT_IPAN 1/* Finds high-curvature points of the contour */CVAPI(CvSeq*) cvFindDominantPoints( CvSeq* contour, CvMemStorage* storage, int method CV_DEFAULT(CV_DOMINANT_IPAN), double parameter1 CV_DEFAULT(0), double parameter2 CV_DEFAULT(0), double parameter3 CV_DEFAULT(0), double parameter4 CV_DEFAULT(0));/* Calculates perimeter of a contour or length of a part of contour */CVAPI(double) cvArcLength( const void* curve, CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ), int is_closed CV_DEFAULT(-1));#define cvContourPerimeter( contour ) cvArcLength( contour, CV_WHOLE_SEQ, 1 )/* Calculates contour boundning rectangle (update=1) or just retrieves pre-calculated rectangle (update=0) */CVAPI(CvRect) cvBoundingRect( CvArr* points, int update CV_DEFAULT(0) );/* Calculates area of a contour or contour segment */CVAPI(double) cvContourArea( const CvArr* contour, CvSlice slice CV_DEFAULT(CV_WHOLE_SEQ));/* Finds minimum area rotated rectangle bounding a set of points */CVAPI(CvBox2D) cvMinAreaRect2( const CvArr* points, CvMemStorage* storage CV_DEFAULT(NULL));/* Finds minimum enclosing circle for a set of points */CVAPI(int) cvMinEnclosingCircle( const CvArr* points, CvPoint2D32f* center, float* radius );#define CV_CONTOURS_MATCH_I1 1#define CV_CONTOURS_MATCH_I2 2#define CV_CONTOURS_MATCH_I3 3/* Compares two contours by matching their moments */CVAPI(double) cvMatchShapes( const void* object1, const void* object2, int method, double parameter CV_DEFAULT(0));/* Builds hierarhical representation of a contour */CVAPI(CvContourTree*) cvCreateContourTree( const CvSeq* contour, CvMemStorage* storage, double threshold );/* Reconstruct (completelly or partially) contour a from contour tree */CVAPI(CvSeq*) cvContourFromContourTree( const CvContourTree* tree, CvMemStorage* storage, CvTermCriteria criteria );/* Compares two contour trees */#define CV_CONTOUR_TREES_MATCH_I1 1CVAPI(double) cvMatchContourTrees( const CvContourTree* tree1, const CvContourTree* tree2, int method, double threshold );/* Calculates histogram of a contour */CVAPI(void) cvCalcPGH( const CvSeq* contour, CvHistogram* hist );#define CV_CLOCKWISE 1#define CV_COUNTER_CLOCKWISE 2/* Calculates exact convex hull of 2d point set */CVAPI(CvSeq*) cvConvexHull2( const CvArr* input, void* hull_storage CV_DEFAULT(NULL), int orientation CV_DEFAULT(CV_CLOCKWISE), int return_points CV_DEFAULT(0));/* Checks whether the contour is convex or not (returns 1 if convex, 0 if not) */CVAPI(int) cvCheckContourConvexity( const CvArr* contour );/* Finds convexity defects for the contour */CVAPI(CvSeq*) cvConvexityDefects( const CvArr* contour, const CvArr* convexhull, CvMemStorage* storage CV_DEFAULT(NULL));/* Fits ellipse into a set of 2d points */CVAPI(CvBox2D) cvFitEllipse2( const CvArr* points );/* Finds minimum rectangle containing two given rectangles */CVAPI(CvRect) cvMaxRect( const CvRect* rect1, const CvRect* rect2 );/* Finds coordinates of the box vertices */CVAPI(void) cvBoxPoints( CvBox2D box, CvPoint2D32f pt[4] );/* Initializes sequence header for a matrix (column or row vector) of points - a wrapper for cvMakeSeqHeaderForArray (it does not initialize bounding rectangle!!!) */CVAPI(CvSeq*) cvPointSeqFromMat( int seq_kind, const CvArr* mat, CvContour* contour_header, CvSeqBlock* block );/* Checks whether the point is inside polygon, outside, on an edge (at a vertex). Returns positive, negative or zero value, correspondingly. Optionally, measures a signed distance between the point and the nearest polygon edge (measure_dist=1) */CVAPI(double) cvPointPolygonTest( const CvArr* contour, CvPoint2D32f pt, int measure_dist );/****************************************************************************************\* Histogram functions *\****************************************************************************************//* Creates new histogram */CVAPI(CvHistogram*) cvCreateHist( int dims, int* sizes, int type, float** ranges CV_DEFAULT(NULL), int uniform CV_DEFAULT(1));/* Assignes histogram bin ranges */CVAPI(void) cvSetHistBinRanges( CvHistogram* hist, float** ranges, int uniform CV_DEFAULT(1));/* Creates histogram header for array */CVAPI(CvHistogram*) cvMakeHistHeaderForArray( int dims, int* sizes, CvHistogram* hist, float* data, float** ranges CV_DEFAULT(NULL), int uniform CV_DEFAULT(1));/* Releases histogram */CVAPI(void) cvReleaseHist( CvHistogram** hist );/* Clears all the histogram bins */CVAPI(void) cvClearHist( CvHistogram* hist );/* Finds indices and values of minimum and maximum histogram bins */CVAPI(void) cvGetMinMaxHistValue( const CvHistogram* hist, float* min_value, float* max_value, int* min_idx CV_DEFAULT(NULL), int* max_idx CV_DEFAULT(NULL));/* Normalizes histogram by dividing all bins by sum of the bins, multiplied by <factor>. After that sum of histogram bins is equal to <factor> */CVAPI(void) cvNormalizeHist( CvHistogram* hist, double factor );/* Clear all histogram bins that are below the threshold */CVAPI(void) cvThreshHist( CvHistogram* hist, double threshold );#define CV_COMP_CORREL 0#define CV_COMP_CHISQR 1#define CV_COMP_INTERSECT 2#define CV_COMP_BHATTACHARYYA 3/* Compares two histogram */CVAPI(double) cvCompareHist( const CvHistogram* hist1, const CvHistogram* hist2, int method);/* Copies one histogram to another. Destination histogram is created if the destination pointer is NULL */CVAPI(void) cvCopyHist( const CvHistogram* src, CvHistogram** dst );/* Calculates bayesian probabilistic histograms (each or src and dst is an array of <number> histograms */CVAPI(void) cvCalcBayesianProb( CvHistogram** src, int number, CvHistogram** dst);/* Calculates array histogram */CVAPI(void) cvCalcArrHist( CvArr** arr, CvHistogram* hist, int accumulate CV_DEFAULT(0), const CvArr* mask CV_DEFAULT(NULL) );CV_INLINE void cvCalcHist( IplImage** image, CvHistogram* hist, int accumulate CV_DEFAULT(0), const CvArr* mask CV_DEFAULT(NULL) ){ cvCalcArrHist( (CvArr**)image, hist, accumulate, mask );}/* Calculates back project */CVAPI(void) cvCalcArrBackProject( CvArr** image, CvArr* dst, const CvHistogram* hist );#define cvCalcBackProject(image, dst, hist) cvCalcArrBackProject((CvArr**)image, dst, hist)/* Does some sort of template matching but compares histograms of template and each window location */CVAPI(void) cvCalcArrBackProjectPatch( CvArr** image, CvArr* dst, CvSize range, CvHistogram* hist, int method, double factor );#define cvCalcBackProjectPatch( image, dst, range, hist, method, factor ) \ cvCalcArrBackProjectPatch( (CvArr**)image, dst, range, hist, method, factor )/* calculates probabilistic density (divides one histogram by another) */CVAPI(void) cvCalcProbDensity( const CvHistogram* hist1, const CvHistogram* hist2, CvHistogram* dst_hist, double scale CV_DEFAULT(255) );/* equalizes histogram of 8-bit single-channel image */CVAPI(void) cvEqualizeHist( const CvArr* src, CvArr* dst );#define CV_VALUE 1#define CV_ARRAY 2/* Updates active contour in order to minimize its cummulative (internal and external) energy. */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -