分塊處理方法耗時對比

2021-07-11 16:39:30 字數 723 閱讀 2359

測試影象2560×1920,blocksize = 10;10張取平均。

將每個方塊賦給乙個新的影象,思路簡單,在十二線掃瞄法中使用。平均耗時240ms

int h2 = imgs.rows/samplescale;     //image height

int w2 = imgs.cols/samplescale; //image width

time_t tic_s,tic,toc;

tic_s = clock();

mat imgsample;

imgsample.create(h2,w2,cv_8uc1);

mat iblock = mat(samplescale,samplescale,cv_8uc1);

for(int i=0;ifor(int j=0;jdouble minval,maxval;

minmaxloc(iblock,&minval,&maxval);

*(imgsample.data+j*w2+i) = maxval-minval;

= maxval-minval;

}

省略掉複製一步,平均耗時211ms

平均耗時145ms

for(int x = 0;x < m2;x++)

}

分析:

方法三將指標計算放到了第二重for迴圈外面,減少了計算量。

java常用效能優化方法及耗時對比

1.string.split seg 的時間是stringutils.split str,seg 的1.5倍.2.string.replaceall regex,replacement 的時間是stringutils.replace text,searchstring,replacement 的1....

DSP中記憶體申請耗時對比

最近在用dm6437做影象處理,裡面用到了鍊錶實現的堆疊操作,這就需要大量的記憶體申請 釋放,感覺這段函式有點耗時,所以就對dsp中片內 片外記憶體申請,不同的記憶體申請函式 malloc,mem alloc,mem calloc 耗時做了一下對比,測試是通過 dspbios提供的clock 函式得...

count 類特徵統計的R方法及耗時對比

count 特徵在kaggle比賽的特徵工程中使用特別常見,其統計主要有如下幾種方法 1.使用add count rename組合 train1 mtcars add count cyl,carb,vs,am,gear rename count1 n 2.使用group by mutate組合 tr...