よく使用するファンクション等について,マニュアルの和訳です.
typedef struct _IplImage { int nSize; /* IplImageのサイズ */ int ID; /* version (=0)*/ int nChannels; /* OpenCVのほとんどの関数では1,2,3,4のいずれかを使用することになる */ int alphaChannel; /* OpenCVでは無視される */ int depth; /* 画素の深さをビットで表す: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16U,IPL_DEPTH_16S, IPL_DEPTH_32S, IPL_DEPTH_32F,IPL_DEPTH_64F がサポートされている */ char colorModel[4]; /* OpenCVでは無視される */ char channelSeq[4]; /* OpenCVでは無視される */ int dataOrder; /* 0 - interleaved color channels, 1 - separate color channels. cvCreateImage can only create interleaved images */ int origin; /* 0だと画像の左上が基準点 1だと画像の左下が基準点 (Windows bitmaps style) */ int align; /* Alignment of image rows (4 or 8). OpenCV ignores it and uses widthStep instead */ int width; /* 画像の幅(pixel) */ int height; /* 画像の高さ(pixel) */ struct _IplROI *roi;/* image ROI. when it is not NULL, this specifies image region to process */ struct _IplImage *maskROI; /* OpenCVではNULLとする */ void *imageId; /* OpenCVではNULLとする */ struct _IplTileInfo *tileInfo; /* OpenCVではNULLとする */ 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]; /* OpenCVでは無視される */ int BorderConst[4]; /* OpenCVでは無視される */ char *imageDataOrigin; /* pointer to a very origin of image data (not necessarily aligned) - it is needed for correct image deallocation */ }
#define CV_SEQUENCE_FIELDS() \ int flags; /* micsellaneous flags */ \ int header_size; /* size of sequence header */ \ struct CvSeq* h_prev; /* previous sequence */ \ struct CvSeq* h_next; /* next sequence */ \ struct CvSeq* v_prev; /* 2nd previous sequence */ \ struct CvSeq* v_next; /* 2nd next sequence */ \ int total; /* 要素の総数 */ \ int elem_size;/* size of sequence element in bytes */ \ char* block_max;/* maximal bound of the last block */ \ char* ptr; /* current write pointer */ \ int delta_elems; /* how many elements allocated when the sequence grows sequence granularity) */ \ CvMemStorage* storage; /* where the seq is stored */ \ CvSeqBlock* free_blocks; /* free blocks list */ \ CvSeqBlock* first; /* pointer to the first sequence block */
typedef struct CvSeq { CV_SEQUENCE_FIELDS() } CvSeq;
画素を単位とした長方形のサイズ
typedef struct CvSize { int width; int height; } CvSize;
width : 長方形の幅 height : 長方形の高さ
整数の座標を持つ2次元の点を示す
typedef struct CvPoint { int x; int y; } CvPoint;
x : x座標
y : y座標
浮動小数点の座標を持つ2次元の点の示す
typedef struct CvPoint2D32f { float x; float y; } CvPoint2D32f;
x : x座標
y : y座標
cvPoint2D32f( double x, double y );
浮動小数点の座標を持つ3次元の点の示す
typedef struct CvPoint3D32f { float x; /* x-coordinate, usually zero-based */ float y; /* y-coordinate, usually zero-based */ float z; /* z-coordinate, usually zero-based */ } CvPoint3D32f;
x : x座標
y : y座標
z : z座標
cvCreateImage( CvSize size, int depth, int channels );
size : 画像サイズ
depth : 画像の深さ(IPL_DEPTH_8U)
channels : 1なら白黒.3ならフルカラー.
ヘッダ,ROI,画像データを完全に複製する.
IplImage* cvCloneImage( const IplImage* image );
image : 元画像
ヘッダと画像データを解放.
void cvReleaseImage( IplImage** image );
配列を初期化する.
void cvSetZero( CvArr* arr );
arr : 初期化する配列.
二つの配列の和を求める.
void cvAdd( const CvArr* src1, const CvArr* src2, CvArr* dst, const CvArr* mask=NULL );
src1 : 加算する配列
src2 : 加算する配列
dst : 加算結果を格納する配列
mask : Operation mask, 8-bit single channel array; specifies elements of destination array to be changed.
mask以外の配列は同じ型,同じ要素数を持つ配列でなければならない.
二つの配列の差を求める.
void cvSub( const CvArr* src1, const CvArr* src2, CvArr* dst, const CvArr* mask=NULL );
src1 : 減算する配列
src2 : 減算する配列
dst : 減算結果を格納する配列
mask : Operation mask, 8-bit single channel array; specifies elements of destination array to be changed.
mask以外の配列は同じ型,同じ要素数を持つ配列でなければならない.
二つの配列の積を求める.
void cvMul( const CvArr* src1, const CvArr* src2, CvArr* dst, double scale=1 );
src1 : 乗算する配列
src2 : 乗算する配列
dst : 乗算結果を格納する配列
scale : Optional scale factor
以下のような演算が行われる.
dst(I)=scale•src1(I)•src2(I)
mask以外の配列は同じ型,同じ要素数を持つ配列でなければならない.
二つの配列の論理積を求める.
void cvAnd( const CvArr* src1, const CvArr* src2, CvArr* dst, const CvArr* mask=NULL );
src1 : 論理積する配列
src2 : 論理積する配列
dst : 論理積結果を格納する配列
mask以外の配列は同じ型,同じ要素数を持つ配列でなければならない.
二つの配列の論理和を求める.
void cvAnd( const CvArr* src1, const CvArr* src2, CvArr* dst, const CvArr* mask=NULL );
src1 : 論理和する配列
src2 : 論理和する配列
dst : 論理和結果を格納する配列
mask以外の配列は同じ型,同じ要素数を持つ配列でなければならない.
二つの配列の排他的論理和を求める.
void cvAnd( const CvArr* src1, const CvArr* src2, CvArr* dst, const CvArr* mask=NULL );
src1 : 排他的論理和する配列
src2 : 排他的論理和する配列
dst : 排他的論理和結果を格納する配列
mask以外の配列は同じ型,同じ要素数を持つ配列でなければならない.
配列の否定を求める.
void cvNot( const CvArr* src, CvArr* dst );
src : 元配列
dst : 求めた配列の否定を格納する配列.
The function cvSobel calculates the image derivative by convolving the image with the appropriate kernel
void cvSobel( const CvArr* src, CvArr* dst, int xorder, int yorder, int aperture_size=3 );
src 元画像.
dst 結果を格納する配列.~
xorder Order of the derivative x .~
yorder Order of the derivative y .
配列を複製する.
void cvCopy( const CvArr* src, CvArr* dst, const CvArr* mask=NULL );
src : コピー元配列
dst : コピー先配列
配列を反転させる.反転方法は3種類.
void cvFlip( const CvArr* src, CvArr* dst=NULL, int flip_mode=0);
src : 反転させる配列.
dst : 反転済み配列を格納する配列.もしNULLならsrcに上書き格納される.
flip_mode : 0ならx軸で反転.0より大ならy軸で反転.0より小なら両軸で反転.
直線を描画する.
void cvLine( CvArr* img, CvPoint pt1, CvPoint pt2, CvScalar color, int thickness=1, int line_type=8, int shift=0 );
img : 直線を書き込む画像.
pt1 : 直線の始点座標.~
pt2 : 直線の終点座標.
color : 直線の色.
thickness : 直線の太さ.
line_type : Type of the line:
8 (or 0) - 8-connected line.
4 - 4-connected line.
CV_AA - antialiased line.
shift : Number of fractional bits in the point coordinates.
typedef struct CvMemStorage { struct CvMemBlock* bottom;/* first allocated block */ struct CvMemBlock* top; /* the current memory block - top of the stack */ struct CvMemStorage* parent; /* borrows new blocks from */ int block_size; /* block size */ int free_space; /* free space in the top block (in bytes) */ } CvMemStorage;