opencv中的一些结构(Cvsize,)

来源:互联网 发布:米折是淘宝网的吗 编辑:程序博客网 时间:2024/06/05 06:53

二维坐标系下的点,类型为整型

typedef struct CvPoint { int x; int y; } CvPoint;
inline CvPoint cvPoint( int x, int y );
inline CvPoint cvPointFrom32f( CvPoint2D32f point )

ddd

CvPoint2D32f
二维坐标下的点,类型为浮点

typedef struct CvPoint2D32f { float x; float y; } CvPoint2D32f;
inline CvPoint2D32f cvPoint2D32f( double x, double y );
inline CvPoint2D32f cvPointTo32f( CvPoint point );
CvPoint3D32f 三维坐标下的点,类型为浮点
typedef struct CvPoint3D32f { float x; float y; float z; } CvPoint3D32f;
inline CvPoint3D32f cvPoint3D32f( double x, double y, double z );



CvSize

矩形框大小,以像素为精度

typedef struct CvSize { int width; int height; } CvSize;
inline CvSize cvSize( int width, int height );

注意:构造函数的cv是小写!

CvSize2D32f
以亚像素精度标量矩形框大小

typedef struct CvSize2D32f { float width; float height; } CvSize2D32f;
inline CvSize2D32f cvSize2D32f( double width, double height ); { CvSize2D32f s; s.width = (float)width; s.height = (float)height; return s; }

CvRect

矩形框的偏移和大小

typedef struct CvRect { int x; int y; int width; int height; } CvRect;
inline CvRect cvRect( int x, int y, int width, int height ); { CvRect os; os.x = x; os.y = y; os.width = width; os.height = heigth; reture os;}

CvScalar

可存放在1-,2-,3-,4-TUPLE类型的捆绑数据的容器

typedef struct CvScalar { double val[4] } CvScalar;
inline CvScalar cvScalar( double val0, double val1, double val2, double val3); { CvScalar arr; arr.val[4] = {val0,val1,val2,val3}; reture arr;}
inline CvScalar cvScalarAll( double val0123 ); { CvScalar arr; arr.val[4] = {val0123,val0123,val0123,val0123,}; reture arr;}
inline CvScalar cvRealScalar( double val0 ); { CvScalar arr; arr.val[4] = {val0}; reture arr;}

http://doc.blueruby.mydns.jp/opencv/classes/OpenCV/CvScalar.html
CvTermCriteria
迭代算法的终止准则

#define CV_TERMCRIT_ITER 1 #define CV_TERMCRIT_NUMBER CV_TERMCRIT_ITER #define CV_TERMCRIT_EPS 2 typedef struct CvTermCriteria { int type; int max_iter; double epsilon; } CvTermCriteria;
inline CvTermCriteria cvTermCriteria( int type, int max_iter, double epsilon );
CvTermCriteria cvCheckTermCriteria( CvTermCriteria criteria, double default_eps, int default_max_iters ); CvMat 多通道矩阵
typedef struct CvMat { int type; int step; int* refcount; union { uchar* ptr; short* s; int* i; float* fl; double* db; } data; #ifdef __cplusplus union { int rows; int height; }; union { int cols; int width; }; #else int rows; int cols; #endif } CvMat;
CvMatND 多维、多通道密集数组
typedef struct CvMatND { int type; int dims; int* refcount; union { uchar* ptr; short* s; int* i; float* fl; double* db; } data; struct { int size; int step; } dim[CV_MAX_DIM]; } CvMatND; CvSparseMat 多维、多通道稀疏数组
typedef struct CvSparseMat { int type; int dims; int* refcount; struct CvSet* heap; void** hashtable; int hashsize; int total; int valoffset; int idxoffset; int size[CV_MAX_DIM]; } CvSparseMat; 
IplImage IPL 图像头
typedef struct _IplImage { int nSize; int ID; int nChannels; int alphaChannel; int depth; char colorModel[4]; char channelSeq[4]; int dataOrder; int origin; int align; int width; int height; struct _IplROI *roi; struct _IplImage *maskROI; void *imageId; struct _IplTileInfo *tileInfo; int imageSize; char *imageData; int widthStep; int BorderMode[4]; int BorderConst[4]; char *imageDataOrigin; } IplImage;

IplImage结构来自于 Intel Image Processing Library(是其本身所具有的)。OpenCV 只支持其中的一个子集:


alphaChannel 在OpenCV中被忽略。
colorModel 和channelSeq 被OpenCV忽略。OpenCV颜色转换的唯一函数 cvCvtColor把原图像的颜色空间的目标图像的颜色空间作为一个参数。
dataOrder 必须是IPL_DATA_ORDER_PIXEL (颜色通道是交叉存取),然而平面图像的被选择通道可以被处理,就像COI(感兴趣的通道)被设置过一样。
align 是被OpenCV忽略的,而用 widthStep 去访问后继的图像行。
不支持maskROI 。处理MASK的函数把他当作一个分离的参数。MASK在 OpenCV 里是 8-bit,然而在 IPL他是 1-bit。
tileInfo 不支持。
BorderMode和BorderConst是不支持的。每个 OpenCV 函数处理像素的邻近的像素,通常使用单一的固定代码边际模式。

除了上述限制,OpenCV处理ROI有不同的要求。要求原图像和目标图像的尺寸或 ROI的尺寸必须(根据不同的操作,例如cvPyrDown 目标图像的宽(高)必须等于原图像的宽(高)除以2 ±1)精确匹配,而IPL处理交叉区域,如图像的大小或ROI大小可能是完全独立的。

CvArr
不确定数组

typedef void CvArr;

CvArr* 仅仅是被用于作函数的参数,用于指示函数接收的数组类型可以不止一个,如 IplImage*, CvMat* 甚至 CvSeq*. 最终的数组类型是在运行时通过分析数组头的前4 个字节判断。


原创粉丝点击