openCV ビデオ ストリーミングからいくつかのフレームを保存するコードを作成しようとしています。保存された画像の名前は時間でなければなりません:ここに私のコードがあります:
#include "opencv2/opencv.hpp"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include<conio.h>
#include <time.h>
using namespace cv;
using namespace std;
int main(){
int key = 0;
char dateStr[9];
char timeStr[9];
_strdate(dateStr);
_strtime(timeStr);
char buffer[20];
VideoCapture cap(1); // open the default camera
if(!cap.isOpened()) // check if we succeeded
return -1;
namedWindow("image",1);
while(key!=27)
{
Mat frame;
cap >> frame; // get a new frame from camera
imshow("image", frame);
if(key==13){
sprintf(buffer,"%s%s.tif",dateStr,timeStr);
imwrite(buffer,frame);
}
key = waitKey(1000);
}
destroyAllWindows();
// the camera will be deinitialized automatically in VideoCapture destructor
return 0;
}
これを実行しても何も起こらず、エンターボタンを何度も押しても何も起こらず、ストリーミングが遅すぎます。何か案が!!. ご協力いただきありがとうございます