简体   繁体   中英

Using Aforge.net or C# to get or set camera properties ( e.g. exposure time)

I'm currently looking for some libraries .dll that allow me to interfere with the web camera to set or get the camera parameters, although the Microsoft Lifecam (the webcam) already provided an API preinstalled, I want to write the code the set these properties in my own windows form program. Appreciate any idea!

Using Aforge.net or C# to get or set camera properties ( eg exposure time)

Yea, by using the library (dll) of AForge, you can do that.
Here I put a snippet of the code for setting the exposure value.

You might get an example project here: CameraPrefs - example

public VideoCaptureDevice source;
private IAMCameraControl cameraControls;

...

// Match specified camera name to device
FilterInfoCollection videoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
for (int i = 0, n = videoDevices.Count; i < n; i++)
{
    if (name == videoDevices[i].Name)
    {
        moniker = videoDevices[i].MonikerString;
        break;
    }
}

source = new VideoCaptureDevice(moniker);
cameraControls = (IAMCameraControl)source.SourceObject;

cameraControls.Set(CameraControlProperty.Exposure, -11, CameraControlFlags.Manual);

I hope this might help others as well; in case if you already figure out the way to do this. =)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM