public StrobePropertyControl() { m_camera = null; m_pinNumber = 0; InitializeComponent(); m_controlGroupBox.Enabled = false; }
public FullImageWindow() { InitializeComponent(); this.Title = string.Format("FLIR Integrated Imaging Solutions. Zoom Demo. Tier {0}", (RenderCapability.Tier >> 16).ToString()); m_busmgr = new ManagedBusManager(); m_ctldlg = new CameraControlDialog(); m_selDlg = new CameraSelectionDialog(); m_image = new ManagedImage(); m_converted = new ManagedImage(); m_bitmap = new BitmapImage(); m_worker = new BackgroundWorker(); m_worker.WorkerReportsProgress = true; m_worker.DoWork += new DoWorkEventHandler(m_worker_DoWork); m_worker.ProgressChanged += new ProgressChangedEventHandler(m_worker_ProgressChanged); m_Done = new AutoResetEvent(false); RenderOptions.SetBitmapScalingMode(myImage, BitmapScalingMode.LowQuality); RenderOptions.SetEdgeMode(myImage, EdgeMode.Aliased); if (m_selDlg.ShowModal()) { ManagedPGRGuid[] guids = m_selDlg.GetSelectedCameraGuids(); // Determine camera interface var interfaceType = m_busmgr.GetInterfaceTypeFromGuid(guids[0]); if (interfaceType == InterfaceType.GigE) { m_cam = new ManagedGigECamera(); } else { m_cam = new ManagedCamera(); } // Connect to camera object m_cam.Connect(guids[0]); // Connect control dialog m_ctldlg.Connect(m_cam); // Start capturing m_cam.StartCapture(); btn_nearfast.IsChecked = true; WorkerHelper helper = new WorkerHelper(); helper.converted = m_converted; helper.raw = m_image; helper.cam = m_cam; m_continue = true; m_worker.RunWorkerAsync(helper); } else { Application.Current.Shutdown(); } }
public void SetCamera(ManagedCameraBase camera) { Debug.Assert(camera != null, "Camera object is null!"); m_camera = camera; SetCameraInfo(m_camera); }
public CameraRegistersPage(ManagedCameraBase initialCamera) { SetCamera(initialCamera); m_lastRegBlockOffset = 0; InitializeComponent(); InitializePage(); }
public SinglePropertyControl(ManagedCameraBase initCamera, PropertyType property, string propertyName, bool isUsingValueB) { m_propType = property; m_camera = initCamera; m_useValueB = isUsingValueB; InitializeComponent(); InitializePropertyData(propertyName); }
public HDRPropertyControl(HDRPage initialParent, int imageNumber) { m_parent = initialParent; m_camera = m_parent.Camera; m_imageNumber = imageNumber; InitializeComponent(); InitializeControl(); }
public SinglePropertyControl(ManagedCameraBase initCamera, PropertyType property, string propertyName) { m_propType = property; m_camera = initCamera; InitializeComponent(); InitializePropertyData(propertyName); }
public void SetConnectStatus(bool isConnected) { m_isConnected = isConnected; if (isConnected == false && m_camera != null) { m_camera = null; m_camInfo = null; } }
public void SetCamera(ManagedCameraBase camera) { if (camera == null) { //bad! m_controlGroupBox.Enabled = false; } else { m_camera = camera; } }
public void SetCameraInfo(ManagedCameraBase camera) { try { m_camInfo = camera.GetCameraInfo(); } catch (FC2Exception ex) { ShowErrorMessageDialog("Error getting camera information.", ex); return; } }
private void UpdateNodeVoltageInformation(ManagedCameraBase cam) { try { const uint VoltageReg = 0x1A50; uint voltageRegVal = cam.ReadRegister(VoltageReg); if (voltageRegVal >> 31 == 0) { m_nodeVoltagesValue.Text = "N/A"; return; } int numAvailableVoltages = (int)((voltageRegVal & 0x00FFF000) >> 12); if (numAvailableVoltages == 0) { m_nodeVoltagesValue.Text = "N/A"; return; } const uint VoltageOffsetReg = 0x1A54; uint voltageOffsetRegVal = 0; voltageOffsetRegVal = cam.ReadRegister(VoltageOffsetReg); List <double> voltageList = new List <double>(); uint properVoltageOffset = (voltageOffsetRegVal * 4) & 0xFFFF; for (uint i = 0; i < numAvailableVoltages; i++) { uint currVoltageOffset = properVoltageOffset + (i * 4); uint currVoltageRegVal = cam.ReadRegister(currVoltageOffset); double voltage = MathUtilities.Convert32bitIEEEToFloat(currVoltageRegVal); voltageList.Add(voltage); } string voltageStr = string.Empty; foreach (double voltage in voltageList) { voltageStr += string.Format(" | {0:0.000}V", voltage); } m_nodeVoltagesValue.Text = voltageStr.Substring(3); } catch (FC2Exception ex) { m_nodeVoltagesValue.Text = "N/A"; ex.Dispose(); return; } }
public bool Connect() { bool flag = false; CameraSelectionDialog camSlnDlg = new CameraSelectionDialog(); camSlnDlg.Show(); camSlnDlg.Hide(); //if (camSlnDlg.ShowModal()) { try { ManagedPGRGuid[] selectedGuids = camSlnDlg.GetSelectedCameraGuids(); ManagedPGRGuid guidToUse = selectedGuids[0]; ManagedBusManager busMgr = new ManagedBusManager(); m_camera = new ManagedCamera(); // Connect to the first selected GUID m_camera.Connect(guidToUse); m_camCtlDlg.Connect(m_camera); CameraInfo camInfo = m_camera.GetCameraInfo(); camInfo.vendorName = "MicroTest"; camInfo.modelName = "v1"; // UpdateFormCaption(camInfo); // Set embedded timestamp to on EmbeddedImageInfo embeddedInfo = m_camera.GetEmbeddedImageInfo(); embeddedInfo.timestamp.onOff = true; //embeddedInfo.exposure.onOff = true; embeddedInfo.shutter.onOff = true; //tbox_uptime.Text = embeddedInfo.timestamp.ToString(); m_camera.SetEmbeddedImageInfo(embeddedInfo); flag = true; } catch (IndexOutOfRangeException e) { m_camCtlDlg.Disconnect(); if (m_camera != null) { m_camera.Disconnect(); } flag = false; throw e; } } return(flag); }
public LadybugPropertyControl(ManagedCameraBase initialCamera, PropertyType type, LadybugType ladybugType) { m_camera = initialCamera; m_propertyType = type; m_ladybugType = ladybugType; m_properties = new List <LadybugPropertyControlHolder>(NumberOfCameras); for (int i = 0; i < NumberOfCameras; i++) { m_properties.Add(new LadybugPropertyControlHolder()); } InitializeComponent(); InitializeControl(); }
public StrobePropertyControl(ManagedCameraBase camera, uint pinNumber) { InitializeComponent(); m_controlGroupBox.Text = string.Format("GPIO {0}", pinNumber); m_camera = camera; m_pinNumber = pinNumber; if (camera == null) { m_controlGroupBox.Enabled = false; return; } UpdateStrobeControl(); InitializeControlEvents(); }
private string GenerateToolTipString(ManagedPGRGuid guid) { if (guid.Equals(m_lastTooltipGuid)) { return(m_tooltipString); } m_lastTooltipGuid = guid; if (guid.Equals(m_currCameraGuid)) { StringBuilder tooltipStr = new StringBuilder(); tooltipStr.AppendFormat("Camera: {0} {1} ({2})", m_camInfo.vendorName, m_camInfo.modelName, m_camInfo.serialNumber).AppendLine(); tooltipStr.AppendFormat("Sensor: {0}", m_camInfo.sensorInfo).AppendLine(); tooltipStr.AppendFormat("Firmware: {0} Built: {1}", m_camInfo.firmwareVersion, m_camInfo.firmwareBuildTime).AppendLine(); tooltipStr.AppendFormat("Driver: {0}", m_camInfo.driverName).AppendLine(); m_tooltipString = tooltipStr.ToString(); return(m_tooltipString); } ManagedCameraBase tempCamera = null; if (m_busMgr.GetInterfaceTypeFromGuid(guid) == InterfaceType.GigE) { tempCamera = new ManagedGigECamera(); } else { tempCamera = new ManagedCamera(); } using (tempCamera) { tempCamera.Connect(guid); CameraInfo camInfo = tempCamera.GetCameraInfo(); StringBuilder tooltipStr = new StringBuilder(); tooltipStr.AppendFormat("Camera: {0} {1} ({2})", camInfo.vendorName, camInfo.modelName, camInfo.serialNumber).AppendLine(); tooltipStr.AppendFormat("Sensor: {0}", camInfo.sensorInfo).AppendLine(); tooltipStr.AppendFormat("Firmware: {0} Built: {1}", camInfo.firmwareVersion, camInfo.firmwareBuildTime).AppendLine(); tooltipStr.AppendFormat("Driver: {0}", camInfo.driverName).AppendLine(); m_tooltipString = tooltipStr.ToString(); return(m_tooltipString); } }
private void OnEntryRegisterChanged() { if (m_regEntryTextBox.Text.Length == 0) { // if nothing in the text box m_registerName.Text = string.Empty; // m_registerName.Text = ("Enter register value in the text box above."); m_regEntryTextBox.BackColor = Color.PaleGreen; return; } if (m_registerSet == RegisterSet.REGISTER_SET_IIDC) { uint registerVal = 0; try { // Get the text in the box registerVal = Convert.ToUInt32(m_regEntryTextBox.Text, 16); } catch (Exception ex) { m_registerName.Text = "Invalid"; m_regEntryTextBox.BackColor = Color.Red; return; } string regValString = ManagedCameraBase.GetRegisterString(registerVal); if (regValString.Equals("Invalid")) { m_regEntryTextBox.BackColor = Color.Red; } else { m_regEntryTextBox.BackColor = Color.PaleGreen; } m_registerName.Text = regValString; } else if (m_registerSet == RegisterSet.REGISTER_SET_GEV) { m_registerName.Text = "Unknown"; m_regEntryTextBox.BackColor = Color.PaleGreen; } }
public void Connect(ManagedCameraBase camera) { lock (this) { Debug.Assert(camera != null, "Can not connect to a null camera."); if (camera == null) { // Bad! Debug.WriteLine("Connecting a null camera."); return; } if (m_isConnected == true) { //if this camera control dialog has already connected //we need to disconnect the old camera first Disconnect(); } m_camera = camera; try { m_camInfo = m_camera.GetCameraInfo(); } catch (FC2Exception ex) { m_isConnected = false; Debug.WriteLine("Connect: Unable to get Camera Info. {0}", ex.Message); ex.Dispose(); return; } if (Initialize() == false) { m_isConnected = false; Debug.WriteLine("Unable to start initialization"); return; } m_isConnected = true; Debug.WriteLine("Connected to camera"); } }
public void StartPGRCam() { try { guidToUse.value0 = 3639281153; guidToUse.value1 = 3741026457; guidToUse.value2 = 2419196441; guidToUse.value3 = 2928867345; m_camera = new ManagedCamera(); m_camera.Connect(guidToUse); m_camera.StartCapture(); m_grabImages = true; StartGrabLoop(); } catch (FC2Exception ex) { System.Console.WriteLine("Failed to load form successfully: " + ex.Message); } }
public void Disconnect() { lock (this) { if (m_isConnected == true) { // Set all pages to disconnect status for (int i = 0; i < m_pages.Length; i++) { if (m_pages[i] != null) { m_pages[i].SetConnectStatus(false); } } m_camera = null; m_camInfo = null; m_isConnected = false; } Debug.WriteLine("Disconnected from camera"); } }
/// <summary> /// 连接相机 /// </summary> /// <param name="SerialNumber"></param> /// <returns></returns> bool ConnectCamera(string SerialNumber) { try { #if (SDK) ManagedBusManager busMgr = new ManagedBusManager(); //相机索引号 uint intSerialNumber = uint.Parse(SerialNumber); ManagedPGRGuid guid = busMgr.GetCameraFromSerialNumber(intSerialNumber); InterfaceType Type = busMgr.GetInterfaceTypeFromGuid(guid); if (Type == InterfaceType.GigE) { g_ManagedCameraBase = new ManagedGigECamera(); g_ManagedCameraBase.Connect(guid); SetGigEPacketResend();//设置丢帧重传 } else { g_ManagedCameraBase = new ManagedCamera(); g_ManagedCameraBase.Connect(guid); } if (g_BaseParCamera.BlUsingTrigger) { SetSoftTrriger(true);//设置触发 } #endif return(true); } catch (Exception ex) { Log.L_I.WriteError(NameClass, ex); return(false); } }
private void Form1_Load(object sender, EventArgs e) { Hide(); CameraSelectionDialog camSlnDlg = new CameraSelectionDialog(); bool retVal = camSlnDlg.ShowModal(); if (retVal) { try { ManagedPGRGuid[] selectedGuids = camSlnDlg.GetSelectedCameraGuids(); if (selectedGuids.Length == 0) { Debug.WriteLine("No cameras selected!"); Close(); return; } ManagedPGRGuid guidToUse = selectedGuids[0]; ManagedBusManager busMgr = new ManagedBusManager(); InterfaceType ifType = busMgr.GetInterfaceTypeFromGuid(guidToUse); if (ifType == InterfaceType.GigE) { m_camera = new ManagedGigECamera(); } else { m_camera = new ManagedCamera(); } // Connect to the first selected GUID m_camera.Connect(guidToUse); m_camCtlDlg.Connect(m_camera); CameraInfo camInfo = m_camera.GetCameraInfo(); UpdateFormCaption(camInfo); // Set embedded timestamp to on EmbeddedImageInfo embeddedInfo = m_camera.GetEmbeddedImageInfo(); embeddedInfo.timestamp.onOff = true; m_camera.SetEmbeddedImageInfo(embeddedInfo); m_camera.StartCapture(); m_grabImages = true; StartGrabLoop(); } catch (FC2Exception ex) { Debug.WriteLine("Failed to load form successfully: " + ex.Message); Close(); } } else { Close(); } Show(); }
private void ReadRegisterBlockValueFromCamera() { // Get the text in the box uint regBlockOffset = 0; try { // Get the text in the box regBlockOffset = Convert.ToUInt32(m_regBlockEntryTextBox.Text, 16); } catch (ArgumentException ex) { Debug.WriteLine(ex.Message); Debug.WriteLine(ex.StackTrace); ShowErrorMessageDialog("Invalid argument in function ReadRegisterBlockValueFromCamera().", ex); return; } catch (FormatException ex) { Debug.WriteLine(ex.Message); MessageBox.Show( "Please enter a valid register address.", "Invalid Register Address", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } catch (OverflowException ex) { Debug.WriteLine(ex.Message); MessageBox.Show( "The number you entered is too large. Please enter a valid register address.", "Invalid Register Address", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } int numQuadlets = Convert.ToInt32(m_numOfQuadletsToReadSpinButton.Value); uint[] values = new uint[numQuadlets]; if (m_registerSet == RegisterSet.REGISTER_SET_IIDC) { try { m_camera.ReadRegisterBlock(0xFFFF, regBlockOffset + 0xF0F00000, values); } catch (FC2Exception ex) { ShowErrorMessageDialog( string.Format( "There was an error reading IIDC register block 0x{0:X8} - 0x{1:X8}.", regBlockOffset, regBlockOffset + (4 * numQuadlets)), ex); return; } } else if (m_registerSet == RegisterSet.REGISTER_SET_GEV) { if (IsGEV() != true) { return; } ManagedGigECamera camera = (ManagedGigECamera)m_camera; try { camera.ReadGVCPRegisterBlock(regBlockOffset, values); } catch (FC2Exception ex) { ShowErrorMessageDialog( string.Format( "There was an error reading GVCP register block 0x{0:X8} - 0x{1:X8}.", regBlockOffset, regBlockOffset + (4 * numQuadlets)), ex); return; } } m_lastRegBlockOffset = regBlockOffset; m_regValueBlock.Rows.Clear(); m_updatingDatagridview = true; for (int i = 0; i < numQuadlets; i++) { uint currentRegVal = (uint)(regBlockOffset + (i * 4)); m_regValueBlock.Rows.Add(new DataGridViewRow()); m_regValueBlock.Rows[i].Cells[0].Value = string.Format("0x{0:X}", currentRegVal); m_regValueBlock.Rows[i].Cells[1].Value = string.Format("0x{0:X8}", values[i]); double ieeeVal = MathUtilities.Convert32bitIEEEToFloat(values[i]); m_regValueBlock.Rows[i].Cells[2].Value = ieeeVal; m_regValueBlock.Rows[i].Cells[3].Value = ManagedCameraBase.GetRegisterString(currentRegVal); } m_updatingDatagridview = false; }
public AdvCameraSettingsPage(ManagedCameraBase initialCamera) { SetCamera(initialCamera); InitializeComponent(); InitializePage(); }
public DCAMFormatPage(ManagedCameraBase initialCamera) { SetCamera(initialCamera); InitializeComponent(); InitializePage(); }
public DataFlashPage(ManagedCameraBase initialCamera) { SetCamera(initialCamera); InitializeComponent(); InitializePage(); }
public BasePage(ManagedCameraBase camera) { SetCamera(camera); InitializeComponent(); }
public void Connect(ManagedCameraBase camera) { m_mainFrame.Connect(camera); }
private void Form1_Load(object sender, EventArgs e) { //MessageBox.Show("VS2013"); textBox1.Text = Properties.Settings.Default.mirrorAngleStep; textBox2.Text = Properties.Settings.Default.mirrorAngle; textBoxDCMotorTime.Text = Properties.Settings.Default.motorTime; textBoxDCMotor2Time.Text = Properties.Settings.Default.motor2Time; Directory.CreateDirectory(savepath); Directory.CreateDirectory(savepath + "\\SavedMaxima\\"); PulseStopWatch.Start(); comboBox1.Items.Clear(); foreach (string item in System.IO.Ports.SerialPort.GetPortNames()) { comboBox1.Items.Add(item); } //comboBox1.SelectedItem = Properties.Settings.Default.myserialport; try { comboBox1.SelectedItem = comboBox1.Items[0]; } catch { } My_count = 0; Hide(); //CameraSelectionDialog camSlnDlg = new CameraSelectionDialog(); //bool retVal = camSlnDlg.ShowModal(); //if (retVal) if (true) { try { //ManagedPGRGuid[] selectedGuids = camSlnDlg.GetSelectedCameraGuids(); //ManagedPGRGuid guidToUse = selectedGuids[0]; ManagedBusManager busMgr = new ManagedBusManager(); /*InterfaceType ifType = busMgr.GetInterfaceTypeFromGuid(guidToUse); * if (ifType == InterfaceType.GigE) * { * m_camera = new ManagedGigECamera(); * } * else * { * m_camera = new ManagedCamera(); * }*/ m_camera = new ManagedCamera(); // Connect to the first selected GUID //m_camera.Connect(guidToUse); uint serial1 = busMgr.GetCameraSerialNumberFromIndex(0); ManagedPGRGuid guid = busMgr.GetCameraFromSerialNumber(serial1); m_camera.Connect(guid); m_camCtlDlg.Connect(m_camera); CameraInfo camInfo = m_camera.GetCameraInfo(); UpdateFormCaption(camInfo); // Set embedded timestamp to on EmbeddedImageInfo embeddedInfo = m_camera.GetEmbeddedImageInfo(); embeddedInfo.timestamp.onOff = true; m_camera.SetEmbeddedImageInfo(embeddedInfo); m_camera.StartCapture(); m_grabImages = true; StartGrabLoop(); } catch (FC2Exception ex) { //MessageBox.Show("Camera not detected. Make sure you have connected a camera"); label14.Show(); Debug.WriteLine("Failed to load form successfully: " + ex.Message); // Environment.ExitCode = -1; //Application.Exit(); //return; } toolStripButtonStart.Enabled = false; toolStripButtonStop.Enabled = true; } else { Environment.ExitCode = -1; Application.Exit(); return; } Show(); chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.Enabled = false; chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.Enabled = false; // chart1.ChartAreas[0].AxisY. //chart1.ChartAreas["ChartArea1"].AxisX.MajorGrid.LineColor = Color.Gray; //chart1.ChartAreas["ChartArea1"].AxisY.MajorGrid.LineColor = Color.Gray; chart1.Series[0].BorderWidth = 3; /* * if (checkBoxGraph.Checked) { timerGraph.Start(); } * else { timerGraph.Stop(); }*/ }
public GPIOPage(ManagedCameraBase initialCamera) { SetCamera(initialCamera); InitializeComponent(); InitializePage(); }
public DialogHolder(ManagedCameraBase cam, CameraControlMainFrame mainFrame) { camera = cam; camCtlMF = mainFrame; }
public CameraInformationPage(ManagedCameraBase initialCamera) { SetCamera(initialCamera); InitializeComponent(); InitializePage(); }