opencv常见函数

1.文件输入流

int divideWith;

stringstream s;

s<<argv[2];

s>>divideWitj;

2.衡量时间

double t=(double)getTickCount();//返回cpu刻录数。下一个函数返回每秒钟发出多少刻录

t=((double)getTickCount-t)/getTickFrequency();//计算时间

3.opencv储存的是BGR而不是RGB

4.矩阵I

i.data 返回第一行第一列的指针

unchar *p=i.data;

5.CV_Assert(i.depth== CV_8U);//设置深度

6.扫描图像,查找表

Mat lookupTable (1,256,CV_8U);

uchar *p=lookupTable.ptr();

for(int i=0;i<256:i++)

{p[i]=table[1];// 根据文本表改查找表的内容

}

LUT(I,lookupTable,J);//输入。查找表,输出

6.掩码操作

7.图像操作

点的取值  img<uchar>.at(y,x) 或者img<uchar>.at(point(x,y))

vector<point2f> points;

Mat pointMat =Mat(points);

Point2f point =pointMat.at<point2f>(i,0);//构建出来的都是一列。所以(i,0)取值

8.img =Scalar(0); //使原始img全变成黑的

9.选择感兴趣区域

Rect r(1,1,333,333);

Mat smallImg=img(r);

10.图像类型从8uc1改为32fc1

src.convertTo(dst,cv_32f)

11.变成灰度

cvtColor(img,gray,COLOR_BGR2GRAY)

12。

转载于:https://www.cnblogs.com/shilijunspace/p/11125437.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值