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

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

double start = static_cast(cvGetTickCount());

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

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

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

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

double start = static_cast(getTickCount());

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

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

你可能感兴趣的:(C++,Opencv)