Webcam capture (VFW)

Posted on 2006-05-08
Last Modified: 2012-05-05

I've created a remote webcam capture program using VFW (avicap32.dll) in VB6. On most cams and devices, it's able to capture correctly. Now there are some webcams that capture grayscale (non-color) images in my program, although they are able to capture color images (as is tested with other applications).

So here's my main question:
How can I set the capture driver to capture color images using VFW?

I've tried to use the WM_CAP_GET_VIDEOFORMAT and WM_CAP_SET_VIDEOFORMAT messages and changing the BITMAPINFO structure manually, but when changed, WM_CAP_SET_VIDEOFORMAT always returns false, which means the operation wasn't succesfull. I expect the problem to be the size and setting of the bmiColors array. Are there standardized API's for transforming this?

Now I've got secondary question of less importance:
How can I set the capture driver to return JPEG/PNG images instead of DIB/BMP images. I've tried it the same way as setting the color-scale by using WM_CAP_GET_VIDEOFORMAT and WM_CAP_SET_VIDEOFORMAT and changing the 'compression'-flag, but just like setting the color-scale, it always returns false.

One more thing: I don't want to do both things using the pop-up dialogs, everything should be in code.

Maybe these problems are all around memory handling. I prefer a VB solution, but since I couldn't even find a C/C++-solution which would point me in the right direction and I needed some help, even a C++-solution or general info would be very well appreciated.

Thanks in advance!
Question by:ndjnl
    LVL 14

    Accepted Solution

    See following link, may be what ur looking for...


    Author Comment

    Thanks MilanKM, this solves the secondary problem. Points will be splitted when I'll close this question. However, my main problem, converting the color-scale, has not yet been solved. Can you or anyone else can help, or has some usefull info on how to set the grayscale to color?

    Featured Post

    Looking for New Ways to Advertise?

    Engage with tech pros in our community with native advertising, as a Vendor Expert, and more.

    Join & Write a Comment

    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    730 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now