OpenCV 计算运行时间(us,ms,s)

1. cvGetTickCount()和cvGetTickFrequency()计时,得到的单位是us级的统计时间:

double start = static_cast<double>(cvGetTickCount());

double time = ((double)cvGetTickCount() - start) / cvGetTickFrequency();

cout << "所用时间:" << time << "us" << endl;

cout << "所用时间为:" << time/1000 << "ms" << endl;

2. getTickCount()和getTickFrequency(),得到的单位是s级的统计时间:

double start = static_cast<double>(getTickCount());

double time = ((double)getTickCount() - start) / getTickFrequency();

cout << "所用时间为:" << time << "秒" << endl;
 

猜你喜欢

转载自blog.csdn.net/zfjBIT/article/details/83089736