who can tell me ? I use directshow and wia but don't find the method
Asked
Active
Viewed 496 times
-1
-
No research effort, and it has to be visible. – Roman R. Oct 19 '13 at 13:36
-
I use directshow ISampleGrabberCB , but it can't listen usb camera button message – guoqipan Oct 19 '13 at 13:47
1 Answers
-1
Why don't you use the OpenCV?
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();
}

Yen
- 19
- 1
- 6