private void ConfigPropertyValue(PropertyType type, float value) { if (m_camera.IsConnected()) { CameraProperty property = new CameraProperty(type); property.absControl = false; property.onOff = true; property.autoManualMode = false; property.valueA = (uint)value; m_camera.SetProperty(property); } }
public void ReconnectCamera(ManagedPGRGuid guid) { lock (this) { if (m_isConnected == true) { try { if (m_camera.IsConnected()) { m_camera.Disconnect(); m_camera.Connect(guid); } else { m_camera.Connect(guid); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } } Debug.WriteLine("Reconnected to camera"); } }
public void Dispose() { if (camera.IsConnected()) { camera.StopCapture(); camera.Disconnect(); } }
public void UpdateCameraInformation(CameraInfo cameraInfo) { m_model.Text = cameraInfo.modelName; m_vendor.Text = cameraInfo.vendorName; m_sensor.Text = cameraInfo.sensorInfo; m_resolution.Text = cameraInfo.sensorResolution; m_interface.Text = InterfaceTranslator.GetInterfaceString(cameraInfo.interfaceType); m_busSpeed.Text = BusSpeedTranslator.GetBusSpeedString(cameraInfo.maximumBusSpeed); m_pciEBusSpeed.Text = BusSpeedTranslator.GetPCIeBusSpeedString(cameraInfo.pcieBusSpeed); m_iidcVersion.Text = string.Format("{0:0.##}", (float)cameraInfo.iidcVersion / 100.0f); m_firmwareVersion.Text = cameraInfo.firmwareVersion; m_firmwareBuildTime.Text = cameraInfo.firmwareBuildTime; m_driver.Text = cameraInfo.driverName; if (m_camera == null || m_camera.IsConnected() == false) { Debug.WriteLine("Camera not found or disconnected"); ClearInformation(); return; } if (cameraInfo.interfaceType == InterfaceType.Usb3 && cameraInfo.pcieBusSpeed == PCIeBusSpeed.Speed_2_5) { // Insufficient speed, set the text to red m_pciEBusSpeed.ForeColor = Color.Red; toolTipPCIeBusSpeed.SetToolTip(m_pciEBusSpeed, "PCIe bus speed is too low - USB 3.0 performance may be degraded"); toolTipPCIeBusSpeed.Active = true; } else { m_pciEBusSpeed.ForeColor = m_pciEBusSpeedLabel.ForeColor; toolTipPCIeBusSpeed.Active = false; } if (IsLadybug2) { const uint Ladybug2HeadRegAddress = 0x1F80; uint uiHeadNumber = 0; try { uiHeadNumber = m_camera.ReadRegister(Ladybug2HeadRegAddress); } catch (FC2Exception ex) { BasePage.ShowErrorMessageDialog("Unable to read head number in the register. Initialize camera information page failed.", ex); ClearInformation(); return; } m_serialNumber.Text = string.Format("{0} (Head S/N.{1}", cameraInfo.serialNumber, uiHeadNumber); } else { m_serialNumber.Text = cameraInfo.serialNumber.ToString(); } }
public Bitmap GrabImage() { try { if (m_camera.IsConnected()) { m_camera.StartCapture(); m_camera.RetrieveBuffer(m_rawImage); m_rawImage.Convert(PixelFormat.PixelFormatBgr, m_processedImage); m_camera.StopCapture(); imageSize.Width = (int)m_rawImage.cols; imageSize.Height = (int)m_rawImage.rows; timeStamp = m_rawImage.timeStamp; } } catch (FC2Exception ex) { Debug.WriteLine("Error: " + ex.Message); } return(m_processedImage.bitmap); }
public void UpdateGigECameraInformation(CameraInfo cameraInfo) { if (m_camera == null || m_camera.IsConnected() == false) { Debug.WriteLine("Camera not found or disconnected"); return; } if (cameraInfo.interfaceType != InterfaceType.GigE) { string blankStr = "N/A"; m_versionValue.Text = blankStr; m_userDefNameValue.Text = blankStr; m_xmlURL1Value.Text = blankStr; m_xmlURL2Value.Text = blankStr; m_macAddressValue.Text = blankStr; m_ipValue.Text = blankStr; m_subnetMaskValue.Text = blankStr; m_defaultGatewayValue.Text = blankStr; m_lblLLAStatus.Text = blankStr; m_lblDHCPStatus.Text = blankStr; m_lblPersistentIPStatus.Text = blankStr; return; } m_versionValue.Text = string.Format("{0}.{1}", cameraInfo.gigEMajorVersion, cameraInfo.gigEMinorVersion); m_userDefNameValue.Text = cameraInfo.userDefinedName; m_xmlURL1Value.Text = cameraInfo.xmlURL1; m_xmlURL2Value.Text = cameraInfo.xmlURL2; byte[] macAddrBytes = cameraInfo.macAddress.GetAddressBytes(); m_macAddressValue.Text = string.Format( "{0:X2}:{1:X2}:{2:X2}:{3:X2}:{4:X2}:{5:X2}", macAddrBytes[0], macAddrBytes[1], macAddrBytes[2], macAddrBytes[3], macAddrBytes[4], macAddrBytes[5]); m_ipValue.Text = cameraInfo.ipAddress.ToString(); m_subnetMaskValue.Text = cameraInfo.subnetMask.ToString(); m_defaultGatewayValue.Text = cameraInfo.defaultGateway.ToString(); m_ipValue.ForeColor = Color.Black; m_subnetMaskValue.ForeColor = Color.Black; m_defaultGatewayValue.ForeColor = Color.Black; m_tooltip.RemoveAll(); try { ManagedGigECamera gigECam = (ManagedGigECamera)m_camera; uint ipConfigurationVal = gigECam.ReadGVCPRegister(0x0014); m_lblLLAStatus.Text = string.Format("{0}", (ipConfigurationVal & 0x4) != 0 ? "Enabled" : "Disabled"); m_lblDHCPStatus.Text = string.Format("{0}", (ipConfigurationVal & 0x2) != 0 ? "Enabled" : "Disabled"); m_lblPersistentIPStatus.Text = string.Format("{0}", (ipConfigurationVal & 0x1) != 0 ? "Enabled" : "Disabled"); } catch (InvalidCastException) { Debug.WriteLine("Camera is not a GigE camera"); } catch (FC2Exception ex) { Debug.WriteLine("Failed to read IP configuration status: " + ex.Message); } }