point_
[cpp]view plain
copy
typedef
point_<
int> point2i;
typedef
point2i point;
typedef
point_<
float
> point2f;
typedef
point_<
double
> point2d;
point3_
[cpp]view plain
copy
typedef
point3_<
int> point3i;
typedef
point3_<
float
> point3f;
typedef
point3_<
double
> point3d;
size_
[html]view plain
copy
typedef size_
<
int>
size2i;
typedef size2i size;
typedef size_<
float
>
size2f;
rect_
[cpp]view plain
copy
typedef
rect_<
int> rect;
matx
[cpp]view plain
copy
typedef
matx<
float
,1,2> matx12f;
typedef
matx<
double
,1,2> matx12d;
...
vec[cpp]view plain
copy
typedef
vecvec2b;
typedef
vec<
short
,3> vec3s;
typedef
vec<
int, 4> vec4i;
typddef vec,6> vec6i;
...
scalar_
[cpp]view plain
copy
typedef
scalar_<
double
> scalar;
range
[cpp]view plain
copy
class
range
; ex:取a的全部行,和 1到179列
mat建立複雜的矩陣
[cpp]view plain
copy
// make a 7x7 complex matrix filled with 1+3j.
mat m(7,7,cv_32fc2,scalar(1,3));
// and now turn m to a 100x60 15-channel 8-bit matrix.
// the old content will be deallocated
m.create(100,60,cv_8uc(15));
多維陣列
[cpp]view plain
copy
// create a 100x100x100 8-bit array
intsz = ;
mat bigcube(3, sz, cv_8u, scalar::all(0));
矩陣行操作
[cpp]view plain
copy
// add the 5-th row, multiplied by 3 to the 3rd row
m.row(3) = m.row(3) + m.row(5)*3;
矩陣列操作
[cpp]view plain
copy
// now copy the 7-th column to the 1-st column
// m.col(1) = m.col(7); // this will not work
mat m1 = m.col(1);
m.col(7).copyto(m1);
locateroi使用
[cpp]view plain
copy
mat a = mat::eye(10, 10, cv_32s);
// extracts a columns, 1 (inclusive) to 3 (exclusive).
mat b = a(range::all(), range(1, 3));
// extracts b rows, 5 (inclusive) to 9 (exclusive).
// that is, c ~ a(range(5, 9), range(1, 3))
mat c = b(range(5, 9), range::all());
size size; point ofs;
c.locateroi(size, ofs);
// size will be (width=10,height=10) and the ofs will be (x=1, y=5)
矩陣元素訪問:
指標加[ ]
[cpp]view plain
copy
intsum = 0;
mat m = mat::eye(20, 20, cv_8uc1);
for(
inti=0; i < m.rows; i++)
} 迭代[cpp]view plain
copy
matconstiterator_it = m.begin(), it_end = m.end();
for(; it != it_end; ++it)
sum += *it;
opencv基本資料型別
目錄 1.點的表示 point point3 2.尺寸的表示 size 3.vec類 描述多通道mat的畫素 4.matx 已知尺寸的小mat模板類 5.顏色類scalar 6.rect 矩形表示類 7.range類 8.cv ptr指標模板 opencv中point 的定義 point3 基本相同...
OpenCV學習筆記 基本資料型別
1.彩色影象通常有紅 綠 藍三個構成成分,但opencv以逆序,即藍 綠 紅來儲存著三個分量,還可以使用第四個透明度 alpha 通道。2.使用img.channels 獲取一幅img影象的通道數。3.使用img.depth 獲取衣服img影象深度。4.使用函式convertto講義中影象深度轉換為...
基本資料型別
列舉 定義列舉型別 enum season 定義兩個列舉變數 enum season mylove yourlove 為兩個列舉變數賦值 yourlove fall mylove winter 把列舉值當成無符號整數執行輸出 nslog fall 的值 u fall 3 nslog winter 的...