How to hook webcam capture?

I'm working on a software that the current version has a custom made device driver of a webcam, and we use this driver with our software, that changes the captures image before displaying it, very similar to YouCam.

Basically, when any application that uses the webcam starts, our driver runs a processing in the frame before showing it.

The problem is that there is always "2" webcams installed, the real one, and our custom driver.

I noticed that YouCam does what we need, which is, to hook some method in any installed webcam that will process each frame before showing it.

Does anyone knows how to do this?

We use VC++.

Thanks


As bkritzer said, OpenCV easily does what you want.

IplImage  *image = 0;   // OpenCV type
CvCapture *capture = 0; // OpenCV type

// Create capture
capture = cvCaptureFromCAM (0);
assert (capture, "Can't connect webcam");

// Capture images
while (stilCapturing)
{
    // Grab image
    cvGrabFrame (capture);
    // Retrieve image
    image = cvRetrieveFrame (capture);
    // You can configure refresh time
    if (image) cvWaitKey (refreshTime);
    // Process your image here
    //...
}

You can encapsulate these OpenCV calls into a C++ class and dedicate a specific thread for it -- these will be your driver.


I think that YouCam uses DirectShow transform filter. Is that what you need?


Check out the OpenCV libraries. It has a bunch of tutorial examples and libraries that do exactly what you're asking for. It's a bit tough to install, but I've gotten it to work before.

链接地址: http://www.djcxy.com/p/14224.html

上一篇: 多个网络摄像头捕捉在一个AVI与C#(Windows窗体)

下一篇: 如何挂接摄像头捕获?