/// <summary> /// Sets Camera Exposure in ms /// </summary> public bool SetCameraExpoure(double millisecExposure, string serialnumber) { bool Status = true; int cameraModule = this.GetCameraModuleNumber(serialnumber); if (cameraModule == -1) { return(false); } if (this.cogAcqFifo[cameraModule] != null) { ICogAcqExposure cogAcqExposure = this.cogAcqFifo[cameraModule].OwnedExposureParams; if (cogAcqExposure != null) { // set exposure to 1ms cogAcqExposure.Exposure = millisecExposure; } } else { Status = false; } return(Status); }
}//卸載CCD結束 /// <summary> /// 調整曝光值 /// </summary> /// <param name="TempCameras">指定相機</param> /// <param name="Exposure">給定曝光值</param> /// <returns>設定成功與否</returns> public static Boolean CCD_Exposure_Function(VisionCameras TempCameras, double Exposure) { string ProcID = System.Reflection.MethodInfo.GetCurrentMethod().Name.ToString(); try { // Get a reference to the ExposureParams interface of the AcqFifo. ICogAcqExposure ExposureParams = ICogAcqFifo_CCDNumber_AcqFifo_Tool[(Int32)TempCameras].OwnedExposureParams; ICogAcqBrightness BrightnessParams = ICogAcqFifo_CCDNumber_AcqFifo_Tool[(Int32)TempCameras].OwnedBrightnessParams; ICogAcqContrast ContrastParams = ICogAcqFifo_CCDNumber_AcqFifo_Tool[(Int32)TempCameras].OwnedContrastParams; // Always check to see an "Owned" property is supported // before using it. if (ExposureParams != null) // Check for exposure support. { BrightnessParams.Brightness = 0.5; ContrastParams.Contrast = 0; ExposureParams.Exposure = Exposure; // sets ExposureTimeAbs ICogAcqFifo_CCDNumber_AcqFifo_Tool[(Int32)TempCameras].Prepare(); // writes the properties to the camera. } SaveLog.Msg_("調整曝光值 " + TempCameras.ToString() + " :" + Exposure.ToString()); return(true); } catch (Exception ex) { SaveLog.Msg_(ModularID + ":\r\n" + ProcID + ":\r\n" + ex.ToString()); SaveLog.Msg_("調整曝光值 " + TempCameras.ToString() + " :" + Exposure.ToString() + " 失敗"); return(false); } }
public Camera(ICogAcqFifo acqFifo) { if (acqFifo == null) { return; } cogAcqFifo = acqFifo; cogROIParams = cogAcqFifo.OwnedROIParams; cogContrast = cogAcqFifo.OwnedContrastParams; cogExposure = cogAcqFifo.OwnedExposureParams; cogBrightness = cogAcqFifo.OwnedBrightnessParams; cogAcqTrigger = cogAcqFifo.OwnedTriggerParams; GrabTime = DateTime.MinValue; }