OpenCV计时
所用函数为getTickCount()和getTickFrequency()。
getTickCount():返回CPU自某个时间(如启动电脑)以来走过的时钟周期数。
getTickFrequency():返回CPU一秒中所走的时钟周期数。所以可以以秒为单位对某运算时间计时。
使用方法:
double start = static_cast<double>(getTickCount());
double time = ((double)getTickCount() - start) / getTickFrequency();
cout << "所用时间为:" << time << "秒" << endl;
也可用函数cvGetTickCount()和cvGetTickFrequency()。但注意,此时得到的单位是us级的统计时间。
double start = static_cast<double>(cvGetTickCount());
double time = ((double)cvGetTickCount() - start) / cvGetTickFrequency();
cout << "所花费时间为:" << time << "us" << endl;
所用函数为getTickCount()和getTickFrequency()。
getTickCount():返回CPU自某个时间(如启动电脑)以来走过的时钟周期数。
getTickFrequency():返回CPU一秒中所走的时钟周期数。所以可以以秒为单位对某运算时间计时。
使用方法:
double start = static_cast<double>(getTickCount());
double time = ((double)getTickCount() - start) / getTickFrequency();
cout << "所用时间为:" << time << "秒" << endl;
也可用函数cvGetTickCount()和cvGetTickFrequency()。但注意,此时得到的单位是us级的统计时间。
double start = static_cast<double>(cvGetTickCount());
double time = ((double)cvGetTickCount() - start) / cvGetTickFrequency();
cout << "所花费时间为:" << time << "us" << endl;