-1
誰能告訴我?我使用directshow和wia但未找到方法如何從C#或C++中的usbcamera按鈕捕捉圖像
誰能告訴我?我使用directshow和wia但未找到方法如何從C#或C++中的usbcamera按鈕捕捉圖像
爲什麼不使用?
的main.cpp
int main(int argc, char** argv) {
CvCapture* capture = cvCaptureFromCAM(0);
int index = 0;
while(cvGrabFrame(capture)) {
/*Get webcam image!*/
IplImage *camImg = cvRetrieveFrame(capture);
/*Save the image to the disk!*/
string fileName = "tmp/" + int2str(index) + ".jpg";
cvSaveImage(fileName.c_str(), screenShotImg);
index++;
int key = cvWaitKey(10);
if(key == 27) {
break;
}
}
cvReleaseCapture(&capture);
return 0;
}
TypeConvert.cpp
#include "TypeConvert.h"
#include <iostream>
#include <sstream>
string int2str(int &num) {
string emptyStr;
stringstream ss(emptyStr);
ss << num;
return ss.str();
}
沒有研究工作,並且它必須是可見的。 –
我使用directshow ISampleGrabberCB,但它無法聽取usb相機按鈕消息 – guoqipan