OpenCV:计时函数getTickCount、getTickFrequency

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sss_369/article/details/84797844

1. getTickCount() & getTickFrequency()

getTickCount():返回CPU自某个时间以来走过的时钟周期数。
getTickFrequency():返回CPU一秒中所走的时钟周期数,因此可以以秒为单位对某运算时间计时。

double start = static_cast<double>(getTickCount());
double time = ((double)getTickCount() - start) / getTickFrequency();
cout << "run time: " << time << "s" << endl;

2. cvGetTickCount() & cvGetTickFrequency()

【注】:此时得到的单位是us级的统计时间。

 double start = static_cast<double>(cvGetTickCount());
 double time = ((double)cvGetTickCount() - start) / cvGetTickFrequency();
 cout << "run time: " << time << "us" << endl;

猜你喜欢

转载自blog.csdn.net/sss_369/article/details/84797844
今日推荐