Vision
c++ 연산시간측정
junl
2021. 7. 16. 11:34
OpenCV 4로 배우는 컴퓨터 비전과 머신 러닝: 4.5.2 연산 시간 측정 - 1 (thebook.io)
/*https://thebook.io/006939/ch04/05/02-01/*/
#include<opencv2/opencv.hpp>
#include<iostream>
#include<sstream>
#include<time.h>
#include <Windows.h>
using namespace std;
using namespace cv;
void main()
{
int64 t1 = getTickCount();
VideoCapture cap(0);
while (1)
{
Mat src;
cap >> src;
if (!cap.isOpened())
{
cerr << "Can't open the cam";
return;
}
int64 t2 = getTickCount();
double ms = (t2 - t1) * 1000 / getTickFrequency();
cout << "연산시간: " << ms << endl;
imshow("src", src);
if (waitKey(1) == 27)
{
break;
}
}
}