《OpenCV3编程入门》——5.1 访问图像中的像素--计时函数

计时函数:

简便的计时函数:getTickCount()get TickFrequency()

getTickCount()函数:返回CPU自某个事件以来走过的时钟周期数

getTickFrequency()函数:返回CPU一秒钟所走的时钟周期数。这样,就能以秒为单位对某运算计时。

两个函数组合起来使用的实例如下:

double time0 = static_cast<double>(getTickCount());  //记录起始事件
//进行图像处理操作……
time0 = ((double) getTickCount()-time0)/getTickFrequency();
cout << "此方法运行时间为: " << time0 << "秒" << endl; //输出运行时间

猜你喜欢

转载自blog.csdn.net/Sophia_11/article/details/84592935
今日推荐