opencv 一些函数的耗时计算

Release 模式

--------------------------------------------------
smooth gaussian : 2
cvtColor CV_BGR2Lab : 3
get_psnr : 16
convertTo CV_8U: 6

absdiff: 2
threshold: 0
dilate 20: 3
fill_hole : 3

bitwise_xor : 0
shape : 0
copyTo 3 channels : 0
select_color : 14
smooth median : 1
gen_bgra : 3
cal_color : 4
pic_mix : 22
110ms
--------------------------------------------------

smooth gaussian : 5

smooth median : 5

cvtColor CV_BGR2Lab : 3
accumulateWeighted : 11
convertTo CV_8U: 7
absdiff: 2
threshold: 0
dilate 20: 8
fill_hole : 1
bitwise_xor : 0

shape : 0

copyTo 3 channels : 0
select_color : 129
smooth median : 5
gen_bgra : 0
cal_color : 4
pic_mix : 23

gen_bgra : 3


all : 317ms





float , int , char 的 加、乘、移位运算的耗时整理,   循环周期为 1000*1000*100

Debug模式:

int 加法:194
int 加两次:391
float 加法:1237
float 乘法:551


Release模式

int 加1次:35
int 加2次:37(分1个循环)

int 加2次:67 (2个循环)
float 加法:292
float 乘法:367


int型的加减乘除移位

右移8位 63ms           -----最高效

除以256 97ms

除以256.0 368ms

除以255 144ms

除以255.0 1165ms


32位和8位整形的运算时间大致相等---------所以用32位处理图像数据会更快。

i*7 和(i<<2) + (i<<1) + i 的时间大致相等,所以不需要把整形的乘法改为移位,但是一定要把整形的除法改为移位







  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值