Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Webcam capture (VFW)

Posted on 2006-05-08
Medium Priority
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

MilanKM earned 2000 total points
ID: 16628867
See following link, may be what ur looking for...



Author Comment

ID: 16632238
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses
Course of the Month13 days, 23 hours left to enroll

580 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