OpenCV学习备忘 Vol .4 IplImage基础知识
?
参考书籍及资料《学习OpenCV》 内容提要介绍IplImage图像类型的基本信息
?
IplImage结构基本结构typedef struct _IplImage { int nSize; /* sizeof(IplImage) */ int ID; /* version (=0)*/ int nChannels; /* Most of OpenCV functions support 1,2,3 or 4 channels */ int alphaChannel; /* Ignored by OpenCV */ int depth; /* Pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S, IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported. */ char colorModel[4]; /* Ignored by OpenCV */ char channelSeq[4]; /* ditto */ int dataOrder; /* 0 - interleaved color channels, 1 - separate color channels. cvCreateImage can only create interleaved images */ int origin; /* 0 - top-left origin, 1 - bottom-left origin (Windows bitmaps style). */ int align; /* Alignment of image rows (4 or 8). OpenCV ignores it and uses widthStep instead. */ int width; /* Image width in pixels. */ int height; /* Image height in pixels. */ struct _IplROI *roi; /* Image ROI. If NULL, the whole image is selected. */ struct _IplImage *maskROI; /* Must be NULL. */ void *imageId; /* " " */ struct _IplTileInfo *tileInfo; /* " " */ int imageSize; /* Image data size in bytes (==image->height*image->widthStep in case of interleaved data)*/ char *imageData; /* Pointer to aligned image data. */ int widthStep; /* Size of aligned image row in bytes. */ int BorderMode[4]; /* Ignored by OpenCV. */ int BorderConst[4]; /* Ditto. */ char *imageDataOrigin; /* Pointer to very origin of image data (not necessarily aligned) - needed for correct deallocation */ } IplImage;?主要变量
width,height为图像的长度和宽度;
depth为深度;
nchannel为通道数,选值范围为1、2、3和4。
origin:表示坐标系的原点位置,可选贼为左上角或右下角:IPL_ORIGIN_TL,IPL_ORIGIN_BL
dataOrder:取值的排列:IPL_DATA_ORDER_PIXEL或IPL_DATA_ORDER_PIXEL。分别是交错排列和通道排列。OpenCV中常使用交错排列。
图像类型,深度宏宏图像像素类型IPL_DEPTH_8U无符号8位整数IPL_DEPTH_8S有符号8位整数IPL_DEPTH_16S有符号16位整数IPL_DEPTH_32S有符号32位整数IPL_DEPTH_32F32位浮点数单精度IPL_DEPTH_64F64位浮点数双精度ROI与COIROI代表感兴趣区域
COI代表感兴趣通道
?