• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2600
  • Last Modified:

Webcam capture (VFW)


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!
1 Solution
See following link, may be what ur looking for...


ndjnlAuthor Commented:
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?
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now