-1

who can tell me ? I use directshow and wia but don't find the method

1 Answers1

-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