1
使用最佳庫從ccam網絡攝像頭快速捕捉單張圖像的最佳方式是什麼? 編輯:
雖然常見問題示例顯示如何捕獲幀流,我演變了一點,做我所需要的。謝謝。從網絡攝像頭捕捉單張圖片
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
int main() {
CvCapture* capture = cvCaptureFromCAM(CV_CAP_ANY);
if(!capture){
fprintf(stderr, "ERROR: capture is NULL \n");
getchar();
return -1;
}
cvNamedWindow("mywindow", CV_WINDOW_AUTOSIZE);
IplImage* frame = cvQueryFrame(capture);
if(!frame) {
fprintf(stderr,"ERROR: frame is null.. \n");
getchar();
}
while(1) {
cvShowImage("mywindow", frame);
if((cvWaitKey(10) & 255) == 27) break;
}
cvReleaseCapture(&capture);
cvDestroyWindow("mywindow");
return 0;
}
你能給一個頁碼嗎?我有這本書,我似乎無法找到這些例子。 – 2010-11-27 00:59:35