📄 cv.h
字号:
#define CV_RGB2GRAY 7
#define CV_GRAY2BGR 8
#define CV_GRAY2RGB CV_GRAY2BGR
#define CV_GRAY2BGRA 9
#define CV_GRAY2RGBA CV_GRAY2BGRA
#define CV_BGRA2GRAY 10
#define CV_RGBA2GRAY 11
#define CV_BGR2BGR565 12
#define CV_RGB2BGR565 13
#define CV_BGR5652BGR 14
#define CV_BGR5652RGB 15
#define CV_BGRA2BGR565 16
#define CV_RGBA2BGR565 17
#define CV_BGR5652BGRA 18
#define CV_BGR5652RGBA 19
#define CV_GRAY2BGR565 20
#define CV_BGR5652GRAY 21
#define CV_BGR2XYZ 22
#define CV_RGB2XYZ 23
#define CV_XYZ2BGR 24
#define CV_XYZ2RGB 25
#define CV_BGR2YCrCb 26
#define CV_RGB2YCrCb 27
#define CV_YCrCb2BGR 28
#define CV_YCrCb2RGB 29
#define CV_BGR2HSV 30
#define CV_RGB2HSV 31
#define CV_BGR2Lab 34
#define CV_RGB2Lab 35
#define CV_BayerBG2BGR 40
#define CV_BayerGB2BGR 41
#define CV_BayerRG2BGR 42
#define CV_BayerGR2BGR 43
#define CV_BayerBG2RGB CV_BayerRG2BGR
#define CV_BayerGB2RGB CV_BayerGR2BGR
#define CV_BayerRG2RGB CV_BayerBG2BGR
#define CV_BayerGR2RGB CV_BayerGB2BGR
#define CV_COLORCVT_MAX 48
/* Converts input array from one color space to another.
Only 8-bit images are supported now */
OPENCVAPI void cvCvtColor( const CvArr* src, CvArr* dst, int colorCvtCode );
#define CV_INTER_NN 0
#define CV_INTER_LINEAR 1
/*#define CV_INTER_CUBIC 2 - not implemented yet */
/* Resizes 1D-2D array. Destination size is determined by the size of destination array */
OPENCVAPI void cvResize( const CvArr* src, CvArr* dst,
int method CV_DEFAULT( CV_INTER_LINEAR ));
#define CV_SHAPE_RECT 0
#define CV_SHAPE_CROSS 1
#define CV_SHAPE_ELLIPSE 2
#define CV_SHAPE_CUSTOM 100
/* creates structuring element used for morphological operations */
OPENCVAPI IplConvKernel* cvCreateStructuringElementEx(
int cols, int rows, int anchorX, int anchorY,
int shape, int* values CV_DEFAULT(NULL) );
/* releases structuring element */
OPENCVAPI void cvReleaseStructuringElement( IplConvKernel** element );
/* erodes input image (applies minimum filter) one or more times.
If element pointer is NULL, 3x3 rectangular element is used */
OPENCVAPI void cvErode( const CvArr* src, CvArr* dst,
IplConvKernel* element CV_DEFAULT(NULL),
int iterations CV_DEFAULT(1) );
/* dilates input image (applies maximum filter) one or more times.
If element pointer is NULL, 3x3 rectangular element is used */
OPENCVAPI void cvDilate( const CvArr* src, CvArr* dst,
IplConvKernel* element CV_DEFAULT(NULL),
int iterations CV_DEFAULT(1) );
#define CV_MOP_OPEN 2
#define CV_MOP_CLOSE 3
#define CV_MOP_GRADIENT 4
#define CV_MOP_TOPHAT 5
#define CV_MOP_BLACKHAT 6
/* performs complex morphological transformation */
OPENCVAPI void cvMorphologyEx( const CvArr* src, CvArr* dst,
CvArr* temp, IplConvKernel* element,
int operation, int iterations CV_DEFAULT(1) );
/****************************************************************************************\
* Drawing *
\****************************************************************************************/
/****************************************************************************************\
* Drawing functions work with arbitrary 8-bit images or single-channel images *
* with larger depth: 16s, 32s, 32f, 64f *
* All the functions include parameter color that means rgb value (that may be *
* constructed with CV_RGB macro) for color images and brightness *
* for grayscale images. *
* If a drawn figure is partially or completely outside the image, it is clipped. *
\****************************************************************************************/
#define CV_RGB( r, g, b ) (int)((uchar)(b) + ((uchar)(g) << 8) + ((uchar)(r) << 16))
#define CV_FILLED -1
/* Draws 4-connected or 8-connected line segment connecting two points */
OPENCVAPI void cvLine( CvArr* array, CvPoint pt1, CvPoint pt2,
double color, int thickness CV_DEFAULT(1),
int connectivity CV_DEFAULT(8) );
/* Draws 8-connected line segment connecting two points with antialiazing.
Ending coordinates may be specified with sub-pixel accuracy
(scale is number of fractional bits in the coordinates) */
OPENCVAPI void cvLineAA( CvArr* array, CvPoint pt1, CvPoint pt2,
double color, int scale CV_DEFAULT(0));
/* Draws a rectangle given two opposite corners of the rectangle (pt1 & pt2),
if thickness<0 (e.g. thickness == CV_FILLED), the filled box is drawn */
OPENCVAPI void cvRectangle( CvArr* array, CvPoint pt1, CvPoint pt2,
double color, int thickness CV_DEFAULT(1));
/* Draws a circle with specified center and radius.
Thickness works in the same way as with cvRectangle */
OPENCVAPI void cvCircle( CvArr* array, CvPoint center, int radius,
double color, int thickness CV_DEFAULT(1));
/* Draws antialiazed circle with specified center and radius.
Both the center and radius can be specified with sub-pixel accuracy */
OPENCVAPI void cvCircleAA( CvArr* array, CvPoint center, int radius,
double color, int scale CV_DEFAULT(0) );
/* Draws ellipse outline, filled ellipse, elliptic arc or filled elliptic sector,
depending on <thickness>, <startAngle> and <endAngle> parameters. The resultant figure
is rotated by <angle>. All the angles are in degrees */
OPENCVAPI void cvEllipse( CvArr* array, CvPoint center, CvSize axes,
double angle, double startAngle, double endAngle,
double color, int thickness CV_DEFAULT(1));
CV_INLINE void cvEllipseBox( CvArr* array, CvBox2D box,
double color, int thickness CV_DEFAULT(1));
CV_INLINE void cvEllipseBox( CvArr* array, CvBox2D box,
double color, int thickness )
{
cvEllipse( array, cvPointFrom32f( box.center ),
cvSize( cvRound(box.size.height*0.5),
cvRound(box.size.width*0.5)),
box.angle*180/CV_PI, 0, 360, color, thickness );
}
/* Draws the whole ellipse or elliptic arc with antialiazing */
OPENCVAPI void cvEllipseAA( CvArr* array, CvPoint center, CvSize axes,
double angle, double startAngle,
double endAngle, double color,
int scale CV_DEFAULT(0) );
/* Fills convex or monotonous (every horizontal line intersects the polygon twice at the most,
except, may be, horizontal sides) polygon. Connectivity or monotony is not checked */
OPENCVAPI void cvFillConvexPoly( CvArr* array, CvPoint* pts, int npts, double color );
/* Fills an area bounded by one or more arbitrary polygons (with possible intersections or
self-intersections */
OPENCVAPI void cvFillPoly( CvArr* array, CvPoint** pts,
int* npts, int contours, double color );
/* Draws one or more polygonal curves */
OPENCVAPI void cvPolyLine( CvArr* array, CvPoint** pts, int* npts, int contours,
int closed, double color,
int thickness CV_DEFAULT(1),
int connectivity CV_DEFAULT(8));
/* Draws one or more antialiazed polygonal curves */
OPENCVAPI void cvPolyLineAA( CvArr* array, CvPoint** pts, int* npts, int contours,
int closed, double color, int scale CV_DEFAULT(0) );
/* Font metrics and structure */
#define CV_FONT_VECTOR0 0
typedef struct CvFont
{
const int* data; /* font data and metrics */
CvSize size; /* horizontal and vertical scale factors,
(8:8) fix-point numbers */
int italic_scale; /* slope coefficient: 0 - normal, >0 - italic */
int thickness; /* letters thickness */
int dx; /* horizontal interval between letters */
} CvFont;
/* Initializes font structure used further in cvPutText */
OPENCVAPI void cvInitFont( CvFont* font, int font_face,
double hscale, double vscale,
double italic_scale CV_DEFAULT(0),
int thickness CV_DEFAULT(1) );
/* Renders text stroke with specified font and color at specified location.
CvFont should be initialized with cvInitFont */
OPENCVAPI void cvPutText( CvArr* array, const char* text, CvPoint org,
CvFont* font, double color );
/* Calculates bounding box of text stroke (useful for alignment) */
OPENCVAPI void cvGetTextSize( const char* text_string, CvFont* font,
CvSize* text_size, int* ymin );
/*********************************** data sampling **************************************/
/* Line iterator state */
typedef struct CvLineIterator
{
uchar* ptr;
int err;
int plus_delta;
int minus_delta;
int plus_step;
int minus_step;
} CvLineIterator;
/* Initializes line iterator. Initially ptr will point to pt1 location in the array.
Returns the number of points on the line between the endings. */
OPENCVAPI int cvInitLineIterator( const CvArr* array, CvPoint pt1, CvPoint pt2,
CvLineIterator* lineIterator,
int connectivity CV_DEFAULT(8));
/* Moves iterator to the next line point */
#define CV_NEXT_LINE_POINT( iterator ) \
{ \
int mask = (iterator).err < 0 ? -1 : 0; \
(iterator).err += (iterator).minus_delta + ((iterator).plus_delta & mask); \
(iterator).ptr += (iterator).minus_step + ((iterator).plus_step & mask); \
}
/* Grabs the raster line data into the destination buffer.
Returns the number of retrieved points. */
OPENCVAPI int cvSampleLine( const CvArr* array, CvPoint pt1, CvPoint pt2, void* buffer,
int connectivity CV_DEFAULT(8));
/* Retrieves the rectangular image region with specified center from the input array.
dst(x,y) <- src(x + center.x - dst_width/2, y + center.y - dst_height/2).
Values of pixels with fractional coordinates are retrieved using bilinear interpolation*/
OPENCVAPI void cvGetRectSubPix( const CvArr* src, CvArr* dst, CvPoint2D32f center );
/* Retrieves quadrangle from the input array.
matrixarr = ( a11 a12 | b1 ) dst(x,y) <- src(A[x y]' + b)
( a21 a22 | b2 ) (bilinear interpolation is used to retrieve pixels
with fractional coordinates)
*/
OPENCVAPI void cvGetQuadrangleSubPix( const CvArr* src, CvArr* dstarr,
const CvArr* matrixarr,
int fillOutliers CV_DEFAULT(0),
CvScalar fillvalue CV_DEFAULT(cvScalarAll(0)));
/* Methods for comparing two array */
#define CV_TM_SQDIFF 0
#define CV_TM_SQDIFF_NORMED 1
#define CV_TM_CCORR 2
#define CV_TM_CCORR_NORMED 3
#define CV_TM_CCOEFF 4
#define CV_TM_CCOEFF_NORMED 5
/* Measures similarity between template and overlapped windows in the source image
and fills the resultant image with the measurements */
OPENCVAPI void cvMatchTemplate( const CvArr* array, const CvArr* templ,
CvArr* result, int method );
CV_EXTERN_C_FUNCPTR( float (CV_CDECL * CvDistanceFunction)
( const float* a, const float* b, void* user_param ));
/* Computes earth mover distance between two weigted point sets
(called signatures in image retrieval terminology) */
OPENCVAPI float cvCalcEMD2( const CvArr* signature1,
const CvArr* signature2,
CvDisType dist_type,
CvDistanceFunction dist_func CV_DEFAULT(0),
const CvArr* cost_matrix CV_DEFAULT(0),
CvArr* flow CV_DEFAULT(0),
float* lower_bound CV_DEFAULT(0),
void* user_param CV_DEFAULT(0));
/****************************************************************************************\
* Contours retrieving *
\****************************************************************************************/
/*
Internal structure that is used for sequental retrieving contours from the image.
It supports both hierarchical and plane variants of Suzuki algorithm.
*/
typedef struct _CvContourScanner* CvContourScanner;
typedef enum CvContourRetrievalMode
{
CV_RETR_EXTERNAL = 0,
CV_RETR_LIST = 1,
CV_RETR_CCOMP = 2,
CV_RETR_TREE = 3
}
CvContourRetrievalMode;
typedef enu
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -