#include<iostream>
#include<chrono>
#include<ctime>
#include<opencv2/opencv.hpp>
using namespace std;
int main()
{
//三种测量代码运行时间的方法
/* 一 */
chrono::steady_clock::time_point t1 = chrono::steady_clock::now();
/*代码段*/
chrono::steady_clock::time_point t2 = chrono::steady_clock::now();
chrono::duration<double> time_used = chrono::duration_cast<chrono::duration<double>>(t2-t1);
std::cout << "time used :" << time_used.count() << "seconds." << std::endl;
/* 二 */
clock_t start_time = clock();
/*代码段*/
clock_t end_time = clock();
std::cout << "time used : " << (double)(end_time - start_time) / CLOCKS_PER_SEC <<
"seconds" << std::endl;
/* 三 */
double t1 = (double)getTickCount();
/*代码段*/
double t2 = (double)getTickCount();
cout << "time:" << (t2 - t1) * 1000 / (getTickFrequency()) << endl;
system("pause");
return 0;
}