参考:http://blog.csdn.net/ljbkiss/article/details/7378392
一开始我用的尝试了c接口下的getTickCount和getTickFrequency两个函数。两次调用getTickCount函数相减除以getTickFrequency函数既得所需要的时间。它是以秒作为单位。
#include "stdafx.h"
#include <opencv2\core\core.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <iostream>
using namespace std;
using namespace cv;
int _tmain(int argc, _TCHAR* argv[])
{
double t=(double)getTickCount();
char *image_name="lena";
namedWindow(image_name,1);
Mat image=imread("D:\\lena.jpg");
cvtColor(image,image,CV_BGR2GRAY);
imshow(image_name,image);
t=double((getTickCount()-t)/getTickFrequency());
cout<<"一共花费时间为"<<t<<endl;
waitKey(0);
//getchar();
return 0;
}
后来我用到了TickMeter这个C++的类。<