Link to home
Start Free TrialLog in
Avatar of ndjnl
ndjnl

asked on

Webcam capture (VFW)

Hi,

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!
Nick
ASKER CERTIFIED SOLUTION
Avatar of MilanKM
MilanKM

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ndjnl
ndjnl

ASKER

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?