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与COI

ROI代表感兴趣区域

COI代表感兴趣通道

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值