views:

968

answers:

4

Hi, 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

A: 

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

Kirill V. Lyadvinsky
+1  A: 

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.

bkritzer
+1  A: 

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.

Julien L.
A: 

Well, I think there are 2 key concepts in this question that have been misunderstood:

1) How to hook webcam capture
2) ...any application that uses the webcam...

If I understood right, OpenCV is useful for writing your own complete application, complete meaning that it will open camera and will process images. So it wouldn't satisfy point 2), which I understand as referring to other application (not yours!) opening the camera, and your application processing the images.

Point 1) seems to confirm it, because "hook" is a word usually meaning interception of some other process that are not part of your own application. So I doubt if this question is answered or not. I am also interested on it.

oscar