📄 cxcore.h
字号:
#define CV_AA 16
/* Draws 4-connected, 8-connected or antialiased line segment connecting two points */
CVAPI(void) cvLine( CvArr* img, CvPoint pt1, CvPoint pt2,
CvScalar color, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8), int shift 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 */
CVAPI(void) cvRectangle( CvArr* img, CvPoint pt1, CvPoint pt2,
CvScalar color, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8),
int shift CV_DEFAULT(0));
/* Draws a circle with specified center and radius.
Thickness works in the same way as with cvRectangle */
CVAPI(void) cvCircle( CvArr* img, CvPoint center, int radius,
CvScalar color, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
/* Draws ellipse outline, filled ellipse, elliptic arc or filled elliptic sector,
depending on <thickness>, <start_angle> and <end_angle> parameters. The resultant figure
is rotated by <angle>. All the angles are in degrees */
CVAPI(void) cvEllipse( CvArr* img, CvPoint center, CvSize axes,
double angle, double start_angle, double end_angle,
CvScalar color, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
CV_INLINE void cvEllipseBox( CvArr* img, CvBox2D box, CvScalar color,
int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
CV_INLINE void cvEllipseBox( CvArr* img, CvBox2D box, CvScalar color,
int thickness, int line_type, int shift )
{
CvSize axes;
axes.width = cvRound(box.size.height*0.5);
axes.height = cvRound(box.size.width*0.5);
cvEllipse( img, cvPointFrom32f( box.center ), axes, box.angle*180/CV_PI,
0, 360, color, thickness, line_type, shift );
}
/* Fills convex or monotonous polygon. */
CVAPI(void) cvFillConvexPoly( CvArr* img, CvPoint* pts, int npts, CvScalar color,
int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0));
/* Fills an area bounded by one or more arbitrary polygons */
CVAPI(void) cvFillPoly( CvArr* img, CvPoint** pts, int* npts, int contours, CvScalar color,
int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
/* Draws one or more polygonal curves */
CVAPI(void) cvPolyLine( CvArr* img, CvPoint** pts, int* npts, int contours,
int is_closed, CvScalar color, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8), int shift CV_DEFAULT(0) );
/* basic font types */
#define CV_FONT_HERSHEY_SIMPLEX 0
#define CV_FONT_HERSHEY_PLAIN 1
#define CV_FONT_HERSHEY_DUPLEX 2
#define CV_FONT_HERSHEY_COMPLEX 3
#define CV_FONT_HERSHEY_TRIPLEX 4
#define CV_FONT_HERSHEY_COMPLEX_SMALL 5
#define CV_FONT_HERSHEY_SCRIPT_SIMPLEX 6
#define CV_FONT_HERSHEY_SCRIPT_COMPLEX 7
/* font flags */
#define CV_FONT_ITALIC 16
#define CV_FONT_VECTOR0 CV_FONT_HERSHEY_SIMPLEX
/* Font structure */
typedef struct CvFont
{
int font_face; /* =CV_FONT_* */
const int* ascii; /* font data and metrics */
const int* greek;
const int* cyrillic;
float hscale, vscale;
float shear; /* slope coefficient: 0 - normal, >0 - italic */
int thickness; /* letters thickness */
float dx; /* horizontal interval between letters */
int line_type;
}
CvFont;
/* Initializes font structure used further in cvPutText */
CVAPI(void) cvInitFont( CvFont* font, int font_face,
double hscale, double vscale,
double shear CV_DEFAULT(0),
int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8));
/* Renders text stroke with specified font and color at specified location.
CvFont should be initialized with cvInitFont */
CVAPI(void) cvPutText( CvArr* img, const char* text, CvPoint org,
const CvFont* font, CvScalar color );
/* Calculates bounding box of text stroke (useful for alignment) */
CVAPI(void) cvGetTextSize( const char* text_string, const CvFont* font,
CvSize* text_size, int* baseline );
/* Unpacks color value, if arrtype is CV_8UC?, <color> is treated as
packed color value, otherwise the first channels (depending on arrtype)
of destination scalar are set to the same value = <color> */
CVAPI(CvScalar) cvColorToScalar( double packed_color, int arrtype );
/* Draws contour outlines or filled interiors on the image */
CVAPI(void) cvDrawContours( CvArr *img, CvSeq* contour,
CvScalar external_color, CvScalar hole_color,
int max_level, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8));
/* Does look-up transformation. Elements of the source array
(that should be 8uC1 or 8sC1) are used as indexes in lutarr 256-element table */
CVAPI(void) cvLUT( const CvArr* src, CvArr* dst, const CvArr* lut );
/******************* Iteration through the sequence tree *****************/
typedef struct CvTreeNodeIterator
{
const void* node;
int level;
int max_level;
}
CvTreeNodeIterator;
CVAPI(void) cvInitTreeNodeIterator( CvTreeNodeIterator* tree_iterator,
const void* first, int max_level );
CVAPI(void*) cvNextTreeNode( CvTreeNodeIterator* tree_iterator );
CVAPI(void*) cvPrevTreeNode( CvTreeNodeIterator* tree_iterator );
/* Inserts sequence into tree with specified "parent" sequence.
If parent is equal to frame (e.g. the most external contour),
then added contour will have null pointer to parent. */
CVAPI(void) cvInsertNodeIntoTree( void* node, void* parent, void* frame );
/* Removes contour from tree (together with the contour children). */
CVAPI(void) cvRemoveNodeFromTree( void* node, void* frame );
/* Gathers pointers to all the sequences,
accessible from the <first>, to the single sequence */
CVAPI(CvSeq*) cvTreeToNodeSeq( const void* first, int header_size,
CvMemStorage* storage );
/* The function implements the K-means algorithm for clustering an array of sample
vectors in a specified number of classes */
CVAPI(void) cvKMeans2( const CvArr* samples, int cluster_count,
CvArr* labels, CvTermCriteria termcrit );
/****************************************************************************************\
* System functions *
\****************************************************************************************/
/* Add the function pointers table with associated information to the IPP primitives list */
CVAPI(int) cvRegisterModule( const CvModuleInfo* module_info );
/* Loads optimized functions from IPP, MKL etc. or switches back to pure C code */
CVAPI(int) cvUseOptimized( int on_off );
/* Retrieves information about the registered modules and loaded optimized plugins */
CVAPI(void) cvGetModuleInfo( const char* module_name,
const char** version,
const char** loaded_addon_plugins );
/* Get current OpenCV error status */
CVAPI(int) cvGetErrStatus( void );
/* Sets error status silently */
CVAPI(void) cvSetErrStatus( int status );
#define CV_ErrModeLeaf 0 /* Print error and exit program */
#define CV_ErrModeParent 1 /* Print error and continue */
#define CV_ErrModeSilent 2 /* Don't print and continue */
/* Retrives current error processing mode */
CVAPI(int) cvGetErrMode( void );
/* Sets error processing mode, returns previously used mode */
CVAPI(int) cvSetErrMode( int mode );
/* Sets error status and performs some additonal actions (displaying message box,
writing message to stderr, terminating application etc.)
depending on the current error mode */
CVAPI(void) cvError( int status, const char* func_name,
const char* err_msg, const char* file_name, int line );
/* Retrieves textual description of the error given its code */
CVAPI(const char*) cvErrorStr( int status );
/* Retrieves detailed information about the last error occured */
CVAPI(int) cvGetErrInfo( const char** errcode_desc, const char** description,
const char** filename, int* line );
/* Maps IPP error codes to the counterparts from OpenCV */
CVAPI(int) cvErrorFromIppStatus( int ipp_status );
typedef int (CV_CDECL *CvErrorCallback)( int status, const char* func_name,
const char* err_msg, const char* file_name, int line, void* userdata );
/* Assigns a new error-handling function */
CVAPI(CvErrorCallback) cvRedirectError( CvErrorCallback error_handler,
void* userdata CV_DEFAULT(NULL),
void** prev_userdata CV_DEFAULT(NULL) );
/*
Output to:
cvNulDevReport - nothing
cvStdErrReport - console(fprintf(stderr,...))
cvGuiBoxReport - MessageBox(WIN32)
*/
CVAPI(int) cvNulDevReport( int status, const char* func_name, const char* err_msg,
const char* file_name, int line, void* userdata );
CVAPI(int) cvStdErrReport( int status, const char* func_name, const char* err_msg,
const char* file_name, int line, void* userdata );
CVAPI(int) cvGuiBoxReport( int status, const char* func_name, const char* err_msg,
const char* file_name, int line, void* userdata );
typedef void* (CV_CDECL *CvAllocFunc)(size_t size, void* userdata);
typedef int (CV_CDECL *CvFreeFunc)(void* pptr, void* userdata);
/* Set user-defined memory managment functions (substitutors for malloc and free) that
will be called by cvAlloc, cvFree and higher-level functions (e.g. cvCreateImage) */
CVAPI(void) cvSetMemoryManager( CvAllocFunc alloc_func CV_DEFAULT(NULL),
CvFreeFunc free_func CV_DEFAULT(NULL),
void* userdata CV_DEFAULT(NULL));
typedef IplImage* (CV_STDCALL* Cv_iplCreateImageHeader)
(int,int,int,char*,char*,int,int,int,int,int,
IplROI*,IplImage*,void*,IplTileInfo*);
typedef void (CV_STDCALL* Cv_iplAllocateImageData)(IplImage*,int,int);
typedef void (CV_STDCALL* Cv_iplDeallocate)(IplImage*,int);
typedef IplROI* (CV_STDCALL* Cv_iplCreateROI)(int,int,int,int,int);
typedef IplImage* (CV_STDCALL* Cv_iplCloneImage)(const IplImage*);
/* Makes OpenCV use IPL functions for IplImage allocation/deallocation */
CVAPI(void) cvSetIPLAllocators( Cv_iplCreateImageHeader create_header,
Cv_iplAllocateImageData allocate_data,
Cv_iplDeallocate deallocate,
Cv_iplCreateROI create_roi,
Cv_iplCloneImage clone_image );
#define CV_TURN_ON_IPL_COMPATIBILITY() \
cvSetIPLAllocators( iplCreateImageHeader, iplAllocateImage, \
iplDeallocate, iplCreateROI, iplCloneImage )
/****************************************************************************************\
* Data Persistence *
\****************************************************************************************/
/********************************** High-level functions ********************************/
/* opens existing or creates new file storage */
CVAPI(CvFileStorage*) cvOpenFileStorage( const char* filename,
CvMemStorage* memstorage,
int flags );
/* closes file storage and deallocates buffers */
CVAPI(void) cvReleaseFileStorage( CvFileStorage** fs );
/* returns attribute value or 0 (NULL) if there is no such attribute */
CVAPI(const char*) cvAttrValue( const CvAttrList* attr, const char* attr_name );
/* starts writing compound structure (map or sequence) */
CVAPI(void) cvStartWriteStruct( CvFileStorage* fs, const char* name,
int struct_flags, const char* type_name CV_DEFAULT(NULL),
CvAttrList attributes CV_DEFAULT(cvAttrList()));
/* finishes writing compound structure */
CVAPI(void) cvEndWriteStruct( CvFileStorage* fs );
/* writes an integer */
CVAPI(void) cvWriteInt( CvFileStorage* fs, const char* name, int value );
/* writes a floating-point number */
CVAPI(void) cvWriteReal( CvFileStorage* fs, const char* name, double value );
/* writes a string */
CVAPI(void) cvWriteString( CvFileStorage* fs, const char* name,
const char* str, int quote CV_DEFAULT(0) );
/* writes a comment */
CVAPI(void) cvWriteComment( CvFileStorage* fs, const char* comment,
int eol_comment );
/* writes instance of a standard type (matrix, image, sequence, graph etc.)
or user-defined type */
CVAPI(void) cvWrite( CvFileStorage* fs, const char* name, const void* ptr,
CvAttrList attributes CV_DEFAULT(cvAttrList()));
/* starts the next stream */
CVAPI(void) cvStartNextStream( CvFileStorage* fs );
/* helper function: writes multiple integer or floating-point numbers */
CVAPI(void) cvWriteRawData( CvFileStorage* fs, const void* src,
int len, const char* dt );
/* returns the hash entry corresponding to the specified literal key string or 0
if there is no such a key in the storage */
CVAPI(CvStringHashNode*) cvGetHashedKey( CvFileStorage* fs, const char* name,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -