How to set exposure for Still Image capture when using DirectShow API on Windows?

Alok Chander 30 Reputation points
2023-12-06T02:57:20.69+00:00

I am trying to use the Windows Directshow API to capture still images using a UVC camera. I am using this article from Microsof(https://learn.microsoft.com/en-us/windows/win32/directshow/capturing-an-image-from-a-still-image-pin) to implement this. I want to be able to capture still images at different exposures so I can later use OpenCV to create an HDR image with them. I am aware that Directshow is a legacy feature. I ended up using it as it was the only API that had an example of how to implement still image capture for uvc cameras.

I tried setting the camera exposure before the still image trigger(pAMVidControl->SetMode(pPin, VideoControlFlag_Trigger) using the IAMCameraControl interface(https://learn.microsoft.com/en-us/windows/win32/api/strmif/nn-strmif-iamcameracontrol). I can see the exposure change in the preview feed but the still image captured has a different exposure to what I set it to. Is there a different interface for setting the camera exposure for still image capture?

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,511 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,626 questions
{count} votes