I'm trying to turn a light on the back of a Windows 7 tablet that has a built in cam and light on the back. If I put the code in to show the settings dialog (this.videoElement.ShowPropertyPage();) I can check and uncheck the "Low Light Compensation" checkbox, it turns the light on and off. I'm trying to do that programmatically with the IAMCameraControl interface using GetRange and Set.
The enumeration "CameraControlProperty" doesn't have a flash option. I found one on msdn that does have a flash option, but it was in the CE version of directshow.
I've tried getting other items in settings like "Focus" and I'm able to get and set those values no
Keep in mind there is a similar setting in IAMVideoProcAmp where you set Backlight Compensation (VideoProcAmpProperty.BacklightCompensation). This is different, I'm able to set that, but it doesn't turn on the light.
Any idea how I might be able to get a handle to that setting?
Here is an image of exactly what I want to programmatically check/un-check (turn on/off).
So, a few things I'd suggest:
1) Go ahead and try the flash value from CE. It might not work, but it's sure worth a try.
2) Make sure that you are checking the return value from any Set, and maybe even follow it up with a Get to be sure the change 'took.'
3) You might try putting the dialog up and changing the setting, then use IPersist to save the settings. (Hopefully) you can just restore the settings from the saved IPersist each time you use the camera. Note that the settings are camera-specific, and settings from one camera should not be used against another.
Thanks for the pointers snarfle.
Turns out this article got me going on the right path.
I had to update the CameraControlProperty enumeration and add the KSPROPERTY_CAMERACONTROL_AUTO_EXPOSURE_PRIORITY option.
public enum CameraControlProperty
Pan = 0,
Tilt = 1,
Roll = 2,
Zoom = 3,
Exposure = 4,
Iris = 5,
Focus = 6,
KSPROPERTY_CAMERACONTROL_SCANMODE = 7,
KSPROPERTY_CAMERACONTROL_PRIVACY = 8,
KSPROPERTY_CAMERACONTROL_PANTILT = 9,
KSPROPERTY_CAMERACONTROL_PAN_RELATIVE = 10,
KSPROPERTY_CAMERACONTROL_TILT_RELATIVE = 11,
KSPROPERTY_CAMERACONTROL_ROLL_RELATIVE = 12,
KSPROPERTY_CAMERACONTROL_ZOOM_RELATIVE = 13,
KSPROPERTY_CAMERACONTROL_EXPOSURE_RELATIVE = 14,
KSPROPERTY_CAMERACONTROL_IRIS_RELATIVE = 15,
KSPROPERTY_CAMERACONTROL_FOCUS_RELATIVE = 16,
KSPROPERTY_CAMERACONTROL_PANTILT_RELATIVE = 17,
KSPROPERTY_CAMERACONTROL_FOCAL_LENGTH = 18,
KSPROPERTY_CAMERACONTROL_AUTO_EXPOSURE_PRIORITY = 19
Then I could use the Get/Set on the IAMCameraControl like this:
int result = activeCamera.Get (CameraControlProperty.KSPROPERTY_CAMERACONTROL_AUTO_EXPOSURE_PRIORITY, out pValue, out pCapFlags);
if (pValue == 1)
result = activeCamera.Set(CameraControlProperty.KSPROPERTY_CAMERACONTROL_AUTO_EXPOSURE_PRIORITY, 0, CameraControlFlags.Manual);
result = activeCamera.Set(CameraControlProperty.KSPROPERTY_CAMERACONTROL_AUTO_EXPOSURE_PRIORITY, 1, CameraControlFlags.Manual);
I hope this helps someone!
How exactly does one "add" an enum into that list so it gets recognized by the system? I'm using Windows 7 with a Windows SDK 7.a (though it's a native C++, not a .NET) and when I'm trying to set the scan mode (enum 7 in your list) I get a failed response from Windows... So I'm obviously missing the "registration" step.
Could you explain a bit - how exactly does one add a value (an existing one, nothing fancy) into the list of recognized IDs?
(see related question in SO: http://stackoverflow.com/questions/17914413/de-interlace-captured-video-with-directshow)
To add an element to an enum is easy enough. You've got the source code to the library. Add the element and build the dll.
There is no "getting the system to recognize it." The driver for the device either supports the capability or not. Just because the camera has the ability to perform one of these actions doesn't mean that the driver does. Or at least not necessarily by using the standard interfaces.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.