`
akiraray
  • 浏览: 88218 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

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_32F 32位浮点数单精度
IPL_DEPTH_64F 64位浮点数双精度

ROI与COI

ROI代表感兴趣区域

COI代表感兴趣通道

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics