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;