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
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 的時間大致相等,所以不需要把整形的乘法改為移位,但是一定要把整形的除法改為移位。