转自:http://pengjuchen.blog.sohu.com/67270697.html
函数:
cvCreateImageHeader 只创建图像信息头,不分配数据单元 cvCreateImageData创建分配数据单元,合起来就是:cvCreateImage
cvInitImageHeader可以重新初始化图像头
IplImage* cvCreateImage( CvSize size, int depth, int channels );
void cvReleaseImage( IplImage** image );
IplImage* cvCloneImage( const IplImage* image );
void cvSetImageROI( IplImage* image, CvRect rect );
void cvResetImageROI( IplImage* image ); 等效于:
cvSetImageROI( image, cvRect( 0, 0, image->width, image->height ));cvSetImageCOI( image, 0 );
CvRect cvGetImageROI( const IplImage* image );
void cvCopyImage (IplImage* src, IplImage* dst);//如果目标较小,可自动重新分配单元
void cvRunningAvg( IplImage* imgY, IplImage* imgU, double alpha,IplImage* mask=0 );
//下面的函数可以在8U、32F之间进行转换
void cvConvertScale( const CvArr* src, CvArr* dst, double scale=1, double shift=0 );
//矩阵与图像之间互相赋值转换
void cvSetImageData (IplImage* image, void* data, int step);
void cvSetData( CvArr* arr, void* data, int step );//之前Header should be initialized before using cvCreateImageHeader, cvInit*Header or cvMat (in case of matrix) function
///////////////////////////////
//高速的!:
void cvGetImageRawData (const IplImage* image, uchar** data, int* step,CvSize* roiSize);
CvMat* cvGetMat( const CvArr* arr, CvMat* header, int* coi=NULL, int allowND=0 );
IplImage* cvGetImage( const CvArr* arr, IplImage* image_header );
void cvSplit( const CvArr* src, CvArr* dst0, CvArr* dst1,CvArr* dst2, CvArr* dst3 );
//以下两句联合使用,可以相当于:CvMat* cvCreateMat( int rows, int cols, int type );
CvMat* cvCreateMatHeader( int rows, int cols, int type );
void cvCreateData( CvArr* arr );
//以下这句可以重新初始化矩阵
void cvInitMatHeader (CvMat* mat, int rows, int cols, int type, void* data = 0,int step = CV_AUTOSTEP);
CvMat* cvCreateMat( int rows, int cols, int type );
void cvReleaseMat( CvMat** mat );
CvMat* cvCloneMat( const CvMat* mat );
CvSize cvGetSize( const CvArr* arr );
//读取、设置矩阵元素
double cvmGet( const CvMat* mat, int row, int col );
void cvmSet( CvMat* mat, int row, int col, double value );
//得到图像或矩阵块中的子矩阵
CvMat* cvGetSubArr (const CvArr* arr, CvMat* subarr, CvRect rect);
//或者得到某元素的字符指针:uchar* cvGetAtPtr (const CvArr* arr, int row, int col = 0);
//得到行、列、对角线子矩阵:cvGetRow cvGetCol cvGetDiag
//给矩阵赋值,一般是先创建一个矩阵头,然后把一个数据块的指针用SetData或InitMatHeader给它。另外注意,二者的数据类型必须一致!
void cvAdd (const CvArr* A, const CvArr* B, CvArr* C, const CvArr* mask=0);
void cvSub (const CvArr* A, const CvArr* B, CvArr* C, const CvArr* mask=0);
CvScalar cvDet (const CvArr* A);
CvScalar cvTrace (const CvArr* A);
void cvInvert (const CvArr* A, CvArr* B);
void cvMulTransposed (const CvArr* A, CvArr* C, int order);
void cvFlip (const CvArr* A, CvArr* B, int flipMode);
double cvDotProduct( const CvArr* src1, const CvArr* src2 );
void cvCrossProduct( const CvArr* src1, const CvArr* src2, CvArr* dst );
void cvTranspose( const CvArr* src, CvArr* dst );
void cvFlip (const CvArr* A, CvArr* B, int flipMode);
double cvDet( const CvArr* mat );
int cvSolve( const CvArr* src1, const CvArr* src2, CvArr* dst, int method=CV_LU );
void cvEigenVV( CvArr* mat, CvArr* evects, CvArr* evals, double eps=0 );
void cvSet( CvArr* arr, CvScalar value, const CvArr* mask=NULL );
//重新调整矩阵元素(只是指针调整,好像)
CvMat* cvReshape (const CvArr* A, CvMat* header, int newNumChannels, int newRows = 0);
//一般形式的矩阵运算
void cvScaleAdd (const CvArr* A, CvScalar S, const CvArr* B, CvArr* C);
void cvMatMulAdd (const CvArr* A, const CvArr* B, const CvArr* C, CvArr* D);
void cvMatMulAddS (const CvArr* A, CvArr* C, const CvArr* M, const CvArr* V =0);
void cvGEMM( const CvArr* src1, const CvArr* src2, double alpha,const CvArr* src3, double beta, CvArr* dst, int tABC=0 );
void cvMinMaxLoc( const CvArr* arr, double* min_val, double* max_val,
CvPoint* min_loc=NULL, CvPoint* max_loc=NULL, const CvArr* mask=NULL );
int cvSolve( const CvArr* src1, const CvArr* src2, CvArr* dst, int method=CV_LU ); least-squares
数据类型:
CvScalar cvRealScalar
CvPoint
CvPoint2D32f
CvPoint3D32f
CvSize 强制类型转换的时候用 cvSize
CvRect
CvMat *
CV_RGB(255,255,255)
IplConvKernel* 是不是模板核专用的呢??
IplImage *
int nSize; /* sizeof(IplImage) */
int nChannels; /* Most of OpenCV functions support 1,2,3 or 4 channels */
int depth; /* pixel depth in bits:
int origin; /* 0 - top-left origin,1 - bottom-left origin (Windows bitmaps style) */
int width; /* image width in pixels */
int height; /* image height in pixels */
struct _IplROI *roi;/* image ROI. when it is not NULL, this specifies image region to process */
void *imageId; /* ditto */
int imageSize; /* image data size in bytes=image->height*image->widthStep
char *imageData; /* pointer to aligned image data */
int widthStep; /* size of aligned image row in bytes */
IlpImage和CvMat的傻瓜统一形式即是:CvArr