基本構造体 =============== .. highlight:: c .. index:: CvPoint .. _CvPoint: CvPoint ------- `id=0.984923547755 Comments from the Wiki `__ .. ctype:: CvPoint 整数型で表現される 2 次元座標上の点(通常は, 0 が原点). .. code-block:: c typedef struct CvPoint { int x; int y; } CvPoint; .. .. attribute:: x x 座標. .. attribute:: y y 座標. .. code-block:: c /* コンストラクタ */ inline CvPoint cvPoint( int x, int y ); /* CvPoint2D32f からの変換 */ inline CvPoint cvPointFrom32f( CvPoint2D32f point ); .. .. index:: CvPoint2D32f .. _CvPoint2D32f: CvPoint2D32f ------------ `id=0.516187175589 Comments from the Wiki `__ .. ctype:: CvPoint2D32f 浮動小数点型で表現される 2 次元座標上の点(通常は, 0 が原点). .. code-block:: c typedef struct CvPoint2D32f { float x; float y; } CvPoint2D32f; .. .. attribute:: x x 座標. .. attribute:: y y 座標. .. code-block:: c /* コンストラクタ */ inline CvPoint2D32f cvPoint2D32f( double x, double y ); /* CvPoint からの変換 */ inline CvPoint2D32f cvPointTo32f( CvPoint point ); .. .. index:: CvPoint3D32f .. _CvPoint3D32f: CvPoint3D32f ------------ `id=0.253458483011 Comments from the Wiki `__ .. ctype:: CvPoint3D32f 浮動小数点型で表現される 3 次元座標上の点(通常は, 0 が原点). .. code-block:: c typedef struct CvPoint3D32f { float x; float y; float z; } CvPoint3D32f; .. .. attribute:: x x 座標. .. attribute:: y y 座標. .. attribute:: z z 座標. .. code-block:: c /* コンストラクタ */ inline CvPoint3D32f cvPoint3D32f( double x, double y, double z ); .. .. index:: CvPoint2D64f .. _CvPoint2D64f: CvPoint2D64f ------------ `id=0.913554594982 Comments from the Wiki `__ .. ctype:: CvPoint2D64f 倍精度浮動小数点型で表現される 2 次元座標上の点(通常は, 0 が原点). .. code-block:: c typedef struct CvPoint2D64f { double x; double y; } CvPoint2D64f; .. .. attribute:: x x 座標. .. attribute:: y y 座標. .. code-block:: c /* コンストラクタ */ inline CvPoint2D64f cvPoint2D64f( double x, double y ); /* CvPoint からの変換 */ inline CvPoint2D64f cvPointTo64f( CvPoint point ); .. .. index:: CvPoint3D64f .. _CvPoint3D64f: CvPoint3D64f ------------ `id=0.287255229792 Comments from the Wiki `__ .. ctype:: CvPoint3D64f 倍精度浮動小数点型で表現される 3 次元座標上の点(通常は, 0 が原点). .. code-block:: c typedef struct CvPoint3D64f { double x; double y; double z; } CvPoint3D64f; .. .. attribute:: x x 座標. .. attribute:: y y 座標. .. attribute:: z z 座標. .. code-block:: c /* コンストラクタ */ inline CvPoint3D64f cvPoint3D64f( double x, double y, double z ); .. .. index:: CvSize .. _CvSize: CvSize ------ `id=0.318806277026 Comments from the Wiki `__ .. ctype:: CvSize ピクセル精度で表現された矩形のサイズ. .. code-block:: c typedef struct CvSize { int width; int height; } CvSize; .. .. attribute:: width 矩形の幅. .. attribute:: height 矩形の高さ. .. code-block:: c /* コンストラクタ */ inline CvSize cvSize( int width, int height ); .. .. index:: CvSize2D32f .. _CvSize2D32f: CvSize2D32f ----------- `id=0.13575805052 Comments from the Wiki `__ .. ctype:: CvSize2D32f サブピクセル精度で表現された矩形のサイズ. .. code-block:: c typedef struct CvSize2D32f { float width; float height; } CvSize2D32f; .. .. attribute:: width 矩形の幅. .. attribute:: height 矩形の高さ. .. code-block:: c /* コンストラクタ */ inline CvSize2D32f cvSize2D32f( double width, double height ); .. .. index:: CvRect .. _CvRect: CvRect ------ `id=0.75779885336 Comments from the Wiki `__ .. ctype:: CvRect 矩形のオフセット(通常,左上の角)座標,およびサイズ. .. code-block:: c typedef struct CvRect { int x; int y; int width; int height; } CvRect; .. .. attribute:: x 左上の x 座標. .. attribute:: y 左上の y 座標(Windowsビットマップの場合は,左下). .. attribute:: width 矩形の幅. .. attribute:: height 矩形の高さ. .. code-block:: c /* コンストラクタ */ inline CvRect cvRect( int x, int y, int width, int height ); .. .. index:: CvScalar .. _CvScalar: CvScalar -------- `id=0.598816386038 Comments from the Wiki `__ .. ctype:: CvScalar double 型の値を 4 個まで格納できるコンテナ. .. code-block:: c typedef struct CvScalar { double val[4]; } CvScalar; .. .. code-block:: c /* コンストラクタ: val[0] を val0 で初期化,val[1] を val1で初期化,と続きます */ inline CvScalar cvScalar( double val0, double val1=0, double val2=0, double val3=0 ); /* コンストラクタ: val[0]...val[3] 全てを,val0123 で初期化します */ inline CvScalar cvScalarAll( double val0123 ); /* コンストラクタ: val[0] を val0 で初期化し,残りの val[1]...val[3] を 0 で初期化します */ inline CvScalar cvRealScalar( double val0 ); .. .. index:: CvTermCriteria .. _CvTermCriteria: CvTermCriteria -------------- `id=0.470238283849 Comments from the Wiki `__ .. ctype:: CvTermCriteria 反復アルゴリズムのための停止基準. .. code-block:: c #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; .. .. attribute:: type ``CV_TERMCRIT_ITER`` と ``CV_TERMCRIT_EPS`` の組み合わせ. .. attribute:: max_iter 反復数の最大値. .. attribute:: epsilon 要求精度. .. code-block:: c /* コンストラクタ */ inline CvTermCriteria cvTermCriteria( int type, int max_iter, double epsilon ); /* 与えられた cvTermCriteria をチェックして, type を CV_TERMCRIT_ITER+CV_TERMCRIT_EPS に変更し, max_iter と eprilon の両方を有効にします.*/ CvTermCriteria cvCheckTermCriteria( CvTermCriteria criteria, double default_eps, int default_max_iters ); .. .. index:: CvMat .. _CvMat: CvMat ----- `id=0.927076496291 Comments from the Wiki `__ .. ctype:: CvMat マルチチャンネル行列. .. code-block:: c 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; .. .. attribute:: type 行列の要素の型とフラグを含む,CvMat のシグネチャ(CV _ MAT _ MAGIC _ VAL). .. attribute:: step バイト単位で表される行の長さ. .. attribute:: refcount 内部的に利用されるデータ参照カウンタ. .. attribute:: data 実際の行列データへのポインタ. .. attribute:: rows 行数. .. attribute:: cols 列数. 行列は,各列ごとに保存されます.すべての列は,4 バイト境界にアラインメントが調整されます. .. index:: CvMatND .. _CvMatND: CvMatND ------- `id=0.388617308155 Comments from the Wiki `__ .. ctype:: CvMatND 多次元,マルチチャンネルの密な配列. .. code-block:: c 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; .. .. attribute:: type 行列要素の型とフラグを含む,CvMatND のシグネチャ(CV _ MATND _ MAGIC _ VAL). .. attribute:: dims 配列の次元数. .. attribute:: refcount 内部的に利用されるデータ参照カウンタ. .. attribute:: data 実際の行列データへのポインタ. .. attribute:: dim 各次元における(要素数,要素間のバイト数)の組. .. index:: CvSparseMat .. _CvSparseMat: CvSparseMat ----------- `id=0.012374343434 Comments from the Wiki `__ .. ctype:: CvSparseMat 多次元,マルチチャンネルの疎な配列. .. code-block:: c 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; .. .. attribute:: type 行列の要素の型とフラグを含む,CvSparseMat のシグネチャ(CV _ SPARSE _ MAT _ MAGIC _ VAL). .. attribute:: dims 次元数. .. attribute:: refcount 参照カウンタ.利用されません. .. attribute:: heap ハッシュテーブルのノードの保存領域. .. attribute:: hashtable ハッシュテーブル.各エントリはノードのリストです. .. attribute:: hashsize ハッシュテーブルのサイズ. .. attribute:: total 疎な配列のノード総数. .. attribute:: valoffset 配列ノードの値のオフセット.バイト単位. .. attribute:: idxoffset 配列ノードのインデックスのオフセット.バイト単位. .. attribute:: size 各次元のサイズを表す配列. .. index:: IplImage .. _IplImage: IplImage -------- `id=0.723707591549 Comments from the Wiki `__ .. ctype:: IplImage IPL 画像ヘッダ. .. code-block:: c 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; .. .. attribute:: nSize ``sizeof(IplImage)`` .. attribute:: ID バージョン,常に 0 です. .. attribute:: nChannels チャンネル数.OpenCV のほとんどの関数が,1-4 チャンネルをサポートします. .. attribute:: alphaChannel OpenCV では無視されます. .. attribute:: depth ピクセル毎のビット数(ビット深度,色深度)+オプションの符号ビット( ``IPL_DEPTH_SIGN`` ).サポートされるビット深度は: .. attribute:: IPL_DEPTH_8U 8ビット符号なし整数. .. attribute:: IPL_DEPTH_8S 8ビット符号あり整数. .. attribute:: IPL_DEPTH_16U 16ビット符号なし整数. .. attribute:: IPL_DEPTH_16S 16ビット符号あり整数. .. attribute:: IPL_DEPTH_32S 32ビット符号あり整数. .. attribute:: IPL_DEPTH_32F 単精度浮動小数点数. .. attribute:: IPL_DEPTH_64F 倍精度浮動小数点数. .. attribute:: colorModel OpenCV では無視されます.OpenCVの関数 :ref:`CvtColor` は,パラメータとして変換元と変換後の色空間を利用します. .. attribute:: channelSeq OpenCV では無視されます. .. attribute:: dataOrder 0 = ``IPL_DATA_ORDER_PIXEL`` - インタリーブカラーチャンネル,1 - 分離カラーチャンネル. :ref:`CreateImage` が作成できるのは,インタリーブチャンネルの画像のみです.例えば,一般的なカラー画像のレイアウトは, :math:`b_{00} g_{00} r_{00} b_{10} g_{10} r_{10} ...` のようになります. .. attribute:: origin 0 - 左上原点,1 - 左下原点(Windows ビットマップ形式). .. attribute:: align 画像の行のアラインメント(4 あるいは 8).OpenCV ではこれを無視して,代わりに widthStep を使用します. .. attribute:: width ピクセル単位で表された画像の幅. .. attribute:: height ピクセル単位で表された画像の高さ. .. attribute:: roi 注目領域(ROI).NULL でない場合,この領域が処理の対象となります. .. attribute:: maskROI OpenCVでは,必ず NULL です. .. attribute:: imageId OpenCVでは,必ず NULL です. .. attribute:: imageId OpenCVでは,必ず NULL です. .. attribute:: imageSize バイト単位で表された画像のデータサイズ.インタリーブデータの場合,これは, :math:`\texttt{image->height} \cdot \texttt{image->widthStep}` と等しくなります. .. attribute:: imageData アラインメントが調整された画像データへのポインタ. .. attribute:: widthStep アラインメントが調整された画像の行のサイズ.バイト単位で表されます. .. attribute:: BorderMode 画像境界モード.OpenCVでは無視されます. .. attribute:: BorderConst 画像境界値.OpenCVでは無視されます. .. attribute:: imageDataOrigin オリジナル画像データへのポインタ(アラインメントが調整されているとは限りません).画像を解放するために利用されます. :ref:`IplImage` 構造体は元々,Intel Image Processing Library(IPL) 固有の形式として利用されていました.OpenCV では,上述のパラメータリストにあるように, :ref:`IplImage` フォーマットの一部のみをサポートします. この制限に加えて,OpenCV と IPL とでは ROI の扱いが異なります.OpenCV ではすべての入出力画像のサイズ,またはその ROI サイズが正確に一致する必要があります.一方 IPL では,重複する領域が処理の対象となります.つまり画像のサイズ,または ROI のサイズがバラバラでも構いません. .. index:: CvArr .. _CvArr: CvArr ----- `id=0.615129042171 Comments from the Wiki `__ .. ctype:: CvArr 任意の配列. .. code-block:: c typedef void CvArr; .. メタ型 ``CvArr`` は, 1 種類以上の配列(例えば IplImage*,CvMat*, CvSeq* など)を引数にとる関数を記述するための仮引数としてのみ利用されます.個々の配列型は,実行時にヘッダの最初の 4 バイトを解析することで決定されます.