web config - Set gain and expsoure without DisplayPropertyPage (Aforge, Directshow) -
web config - Set gain and expsoure without DisplayPropertyPage (Aforge, Directshow) -
can tell me how can alter gain or exposure directshow afroge.
i tried can see below didn't succeed. doing wrong?
thanks in advance
using aforge.video; using aforge.video.directshow;
... ...
videocapturedevice videosource;
private void changeprop(int value) { videosource.setcameraproperty(cameracontrolproperty.exposure, value, cameracontrolflags.auto); }
this code works me. of code taken afroge samples.
private videocapturedevice videodevice; private filterinfocollection videodevices; private videocapabilities[] videocapabilities; public bool setcamera(cameras camera, int camdevice, cameraresolution camresolution, int exposurevalue, int zoomvalue, int focusvalue) { // enumerate video devices videodevices = new filterinfocollection(filtercategory.videoinputdevice); //select photographic camera according specified index videodevice = new videocapturedevice(videodevices[camdevice].monikerstring); //get video capabilities setting resoluton videocapabilities = videodevice.videocapabilities; if (camera == cameras.c910) { switch (camresolution) { case cameraresolution.a_640x480: videodevice.videoresolution = videocapabilities[0]; break; case cameraresolution.b_800x600: videodevice.videoresolution = videocapabilities[14]; break; case cameraresolution.c_960x720: videodevice.videoresolution = videocapabilities[16]; break; case cameraresolution.d_1280x720: videodevice.videoresolution = videocapabilities[17]; break; case cameraresolution.e_1920x1080: videodevice.videoresolution = videocapabilities[24]; break; default: videodevice.videoresolution = videocapabilities[0]; break; } } else if (camera == cameras.c920) { switch (camresolution) { case cameraresolution.a_640x480: videodevice.videoresolution = videocapabilities[0]; break; case cameraresolution.b_800x600: videodevice.videoresolution = videocapabilities[10]; break; case cameraresolution.c_960x720: videodevice.videoresolution = videocapabilities[12]; break; case cameraresolution.d_1280x720: videodevice.videoresolution = videocapabilities[14]; break; case cameraresolution.e_1920x1080: videodevice.videoresolution = videocapabilities[16]; break; default: videodevice.videoresolution = videocapabilities[0]; break; } } else { videodevice.videoresolution = videocapabilities[0]; } seek { videodevice.setcameraproperty( cameracontrolproperty.zoom, zoomvalue, cameracontrolflags.manual); videodevice.setcameraproperty( cameracontrolproperty.focus, focusvalue, cameracontrolflags.manual); videodevice.setcameraproperty( cameracontrolproperty.exposure, exposurevalue, cameracontrolflags.manual); } grab (exception ex) { messagebox.show(ex.tostring()); }
web-config webcam directshow aforge webcam-capture
Comments
Post a Comment