public override string ToString() { if (m_Camera == null) { return("Камера не открыта"); } return(cameraInfo.ToString()); }
/// <summary>Открывает камеру</summary> /// <param name="ID">ID камеры</param> public void OpenCamera(string ID) { if (m_Camera == null) { try { m_Camera = m_Vimba.GetCameraByID(ID); m_Camera.Open(VmbAccessModeType.VmbAccessModeFull); cameraInfo = new CameraInfo(m_Camera); LogWrite("Камера открыта: " + cameraInfo.ToString()); FeatureCollection features = m_Camera.Features; Feature feature = features["PixelFormat"]; try { if (feature.EnumValues.Contains("Mono16") && feature.IsEnumValueAvailable("Mono16")) { feature.EnumValue = "Mono16"; } else { if (feature.EnumValues.Contains("Mono14") && feature.IsEnumValueAvailable("Mono14")) { feature.EnumValue = "Mono14"; } else { if (feature.EnumValues.Contains("Mono12") && feature.IsEnumValueAvailable("Mono12")) { feature.EnumValue = "Mono12"; } else { if (feature.EnumValues.Contains("Mono10") && feature.IsEnumValueAvailable("Mono10")) { feature.EnumValue = "Mono10"; } else { throw new Exception(); } } } } } catch (Exception exc) { LogWrite("PixelFormats error. " + exc.ToString()); } //Инициализируем фичи CameraFeature InitFeatures(); // Set the GeV packet size to the highest possible value // (In this example we do not test whether this cam actually is a GigE cam) try { if (m_Camera.InterfaceType == VmbInterfaceType.VmbInterfaceEthernet) { this.m_Camera.Features["GVSPAdjustPacketSize"].RunCommand(); while (false == this.m_Camera.Features["GVSPAdjustPacketSize"].IsCommandDone()) { // Do Nothing } } } catch { // Do Nothing } try { if (m_Camera.Features.ContainsName("AcquisitionFrameRateEnable")) { m_Camera.Features["AcquisitionFrameRateEnable"].BoolValue = false; //делаем fps зависимым от экспозиции и других параметров } } catch (Exception exc) { } } catch (VimbaException vexc) { m_Camera = null; LogWrite(vexc.Message); } catch (Exception exc) { LogWrite(exc.Message); } } }