#include "afx.h"
#include <atltime.h>
#include <highgui.h>
int main()
{
int c;
CTime time;
IplImage *img;
CvCapture* capture = cvCaptureFromCAM(0);
cvNamedWindow("mainWin", CV_WINDOW_AUTOSIZE);
cvMoveWindow("mainWin", 50, 50);
while(1)
{
img=cvQueryFrame(capture);
cvShowImage("mainWin", img );
c=cvWaitKey(10);
//按 s 鍵儲存成 jpg 檔
if(c=='s'){
time = CTime::GetCurrentTime();
CStringA filename(time.Format(CString("%Y%m%d%H%M%S"))+".jpg");
cvSaveImage(filename,img);
}
//按 ESC 鍵離開
if(c == 27)
break;
}
cvReleaseImage(&img);
cvDestroyWindow("mainWin");
return 0;
}
#include <atltime.h>
#include <highgui.h>
int main()
{
int c;
CTime time;
IplImage *img;
CvCapture* capture = cvCaptureFromCAM(0);
cvNamedWindow("mainWin", CV_WINDOW_AUTOSIZE);
cvMoveWindow("mainWin", 50, 50);
while(1)
{
img=cvQueryFrame(capture);
cvShowImage("mainWin", img );
c=cvWaitKey(10);
//按 s 鍵儲存成 jpg 檔
if(c=='s'){
time = CTime::GetCurrentTime();
CStringA filename(time.Format(CString("%Y%m%d%H%M%S"))+".jpg");
cvSaveImage(filename,img);
}
//按 ESC 鍵離開
if(c == 27)
break;
}
cvReleaseImage(&img);
cvDestroyWindow("mainWin");
return 0;
}