private void toolStripButtonOpenFreerun_Click(object sender, EventArgs e) { uEye.Defines.Status statusRet; statusRet = initCamera(); if (statusRet == uEye.Defines.Status.SUCCESS) { // start capture statusRet = m_Camera.Acquisition.Capture(); if (statusRet != uEye.Defines.Status.SUCCESS) { MessageBox.Show("Starting live video failed"); } else { // everything is ok m_IsLive = true; UpdateToolbar(); } } // cleanup on any camera error if (statusRet != uEye.Defines.Status.SUCCESS && m_Camera.IsOpened) { m_Camera.Exit(); } }
private void Cycle() { WaitHandle[] waitevents = new WaitHandle[2]; waitevents[0] = m_eventoAccion; waitevents[1] = m_eventoSalir; bool bSeguir = true; while (bSeguir) { int nEvent = WaitHandle.WaitAny(waitevents, 500); if (nEvent == 0) { if (m_queueAcciones.Count == 0) { continue; } Acciones acc = m_queueAcciones.Dequeue(); switch (acc) { case Acciones.Init: Init(); break; case Acciones.Foto: m_bSnapShot = true; m_Camera.Acquisition.Capture(); break; case Acciones.StartVideo: m_Camera.Acquisition.Capture(); break; case Acciones.StopVideo: m_Camera.Acquisition.Stop(); break; case Acciones.SetFormatPhoto: SetImageFormat(ImageFormat.Foto); break; case Acciones.SetFormatVideo: SetImageFormat(Properties.Settings.Default.VideoFormat.ToImageFormat()); break; } AccionTerminada.Set(); } else if (nEvent == 1) { bSeguir = false; } } m_Camera.Exit(); }
public void OnExit() { //close display window if (display) { imVis.Unload(); vis.Dispose(); } m_IsLive = false; uEye.Defines.Status statusRet = uEye.Defines.Status.SUCCESS; //Termminate video recording (if initiated) if (m_Camera.Video.Running) { statusRet = m_Camera.Video.Stop(); } //Termnate frame acquisition statusRet = m_Camera.Acquisition.Stop(); if (m_Camera.IsOpened) { m_Camera.Exit(); } this.Abort(); this.Dispose(); }
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { uEye.Defines.Status statusRet; statusRet = ids_Camera.Acquisition.Stop(uEye.Defines.DeviceParameter.Wait); statusRet = ids_Camera.Exit(); }
public void ExitCamera() { if (_camera != null) { _camera.Exit(); } _camera = null; }
public static CameraResults DisposeCamera() { if (CameraStatus.Status == "Live") { Camera.EventFrame -= onFrameEvent; Camera.Exit(); } else { Application.Current.Dispatcher.Invoke(new Action(() => { Camera.Exit(); })); } CameraStatus.ErrorCode = ""; CameraStatus.Status = "Disposed"; CameraStatus.ErrorDescription = ""; return(CameraStatus); }
private void Button_Exit_Prog_Click(object sender, EventArgs e) { m_Camera.Acquisition.Stop(); ClearSequence(); FreeImageMems(); // Close the Camera m_Camera.Exit(); Close(); }
private void Close() { try { camera.Exit(); } catch (Exception e) { LogError(e, ""); } }
/// <summary> /// 退出相机 /// </summary> /// <returns></returns> public override bool ExitCamera() { if (camera == null) { return(true); } camera.Exit(); camera = null; displayHandle = IntPtr.Zero; return(true); }
public void Close() { Stop(); try { camera.Exit(); } catch (Exception e) { log.Error(e); } }
/// <summary> /// initialize camera /// </summary> /// <returns></returns> public bool InitCamera(int s32Cam) { // Open Camera uEye.Defines.Status status = camera.Init(s32Cam, displayHandle); if (status != uEye.Defines.Status.SUCCESS) { SetError("Camera initializing failed"); return(false); } // Allocate Memory status = camera.Memory.Allocate(); if (status != uEye.Defines.Status.SUCCESS) { SetError("Allocate Memory failed"); return(false); } camera.EventFrame += Camera_EventFrame; // cleanup on any camera error if (status != uEye.Defines.Status.SUCCESS && camera.IsOpened) { camera.Exit(); } return(true); }
public uEyeCamera(int ID, string parPath, bool stack, bool disp, int X, int targetFR, PulsePal <MovementData> pulsePal) { this.stack = stack; this.targetFrameRate = targetFR; this.display = disp; this.pulsePal = pulsePal; this.ID = ID.ToString(); //check all the available IDS cameras m_Camera = new uEye.Camera(); uEye.Types.CameraInformation[] cameraList; uEye.Info.Camera.GetCameraList(out cameraList); firstFrame = new Frame(); //if there are no cameras available then return with a false state if (cameraList.Length == 0) { m_IsLive = false; } else { //initialize the camera with the appropriate ID uEye.Defines.Status statusRet; statusRet = CameraInit(Convert.ToInt32(cameraList[ID].DeviceID)); //if initialization is successful if (statusRet == uEye.Defines.Status.SUCCESS) { //try to capture a frame statusRet = m_Camera.Acquisition.Capture(); if (statusRet != uEye.Defines.Status.SUCCESS) { m_IsLive = false; MessageBox.Show("Starting Live Video Failed"); } else { m_IsLive = true; //load camera parameters from external file LoadParametersFromFile(parPath); m_Camera.Video.ResetCount(); //if frames are to save then initialize frame queue //if (stack) //queue = new ConcurrentStack<Frame>(); //if frames are to display initialize display window if (display) { provider = new ServiceProvider(); vis = new TypeVisualizerDialog(); provider.services.Add(vis); imVis = new ImageVisualizer(); System.Drawing.Rectangle rect; m_Camera.Size.AOI.Get(out rect); imVis.Load(provider, rect.Width, rect.Height); vis.Show(); vis.Location = new System.Drawing.Point(X, 0); } } //perform onFrameEvent routine when a EventFrame occurs m_Camera.EventFrame += OnFrameEvent; } //if initialization was unsuccessful then exit if (statusRet != uEye.Defines.Status.SUCCESS && m_Camera.IsOpened) { m_Camera.Exit(); } } }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { camera.Exit(); }
private void Button_Exit_Prog_Click(object sender, EventArgs e) { // Close the Camera Camera.Exit(); Close(); }
private void BtnImport_Click(object sender, EventArgs e) { // Locate an .ini file. OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.Title = CameraLang.FormConfiguration_ImportParameters; //openFileDialog.InitialDirectory = Path.GetDirectoryName(ProfileHelper.GetProfileFilename(summary.Identifier)); openFileDialog.RestoreDirectory = true; openFileDialog.Filter = "Ini file (*.ini)" + "|*.ini;"; openFileDialog.FilterIndex = 0; if (openFileDialog.ShowDialog() != DialogResult.OK) { return; } string filename = openFileDialog.FileName; if (string.IsNullOrEmpty(filename) || !File.Exists(filename)) { return; } // The timing here is finnicky. // connect() will start the delay buffer allocation on the current image size and start receiving frames. // disconnect prevents reading the new values from the camera. // Load with new sizes while the camera is streaming will fail because the buffers are wrong. // So we need to load the new values with the camera opened but not streaming. this.SuspendLayout(); disconnect(); ProfileHelper.Replace(summary.Identifier, filename); // Reopen the camera but do not start grabbing. uEye.Defines.Status status = camera.Init((Int32)deviceId | (Int32)uEye.Defines.DeviceEnumeration.UseDeviceID); if (status != uEye.Defines.Status.SUCCESS) { log.ErrorFormat("Error trying to open IDS uEye camera."); return; } // Load new parameters. ProfileHelper.Load(camera, summary.Identifier); cameraProperties = CameraPropertyManager.Read(camera, deviceId); SpecificInfo info = summary.Specific as SpecificInfo; PopulateStreamFormat(); info.StreamFormat = this.SelectedStreamFormat.Value; info.CameraProperties = cameraProperties; summary.UpdateDisplayRectangle(Rectangle.Empty); CameraTypeManager.UpdatedCameraSummary(summary); // Reconnect. camera.Exit(); connect(); // Reload UI. RemoveCameraControls(); PopulateCameraControls(); this.ResumeLayout(); }
public uEyeCamera(int ID, string parPath, bool stack, bool disp, int X) { this.stack = stack; this.display = disp; //check all the available IDS cameras m_Camera = new uEye.Camera(); uEye.Types.CameraInformation[] cameraList; uEye.Info.Camera.GetCameraList(out cameraList); //if there are no cameras available then return with a false state if (cameraList.Length == 0) { m_IsLive = false; } else { //initialize the camera with the appropriate ID uEye.Defines.Status statusRet; statusRet = CameraInit(Convert.ToInt32(cameraList[ID].CameraID)); //if initialization is successful if (statusRet == uEye.Defines.Status.SUCCESS) { //try to capture a frame statusRet = m_Camera.Acquisition.Capture(); if (statusRet != uEye.Defines.Status.SUCCESS) { m_IsLive = false; MessageBox.Show("Starting Live Video Failed"); } else { m_IsLive = true; //load camera parameters from external file LoadParametersFromFile(parPath); m_Camera.Video.ResetCount(); //if frames are to save then initialize frame queue if (stack) { queue = new ConcurrentStack <Frame>(); } //if frames are to display initialize display window if (display) { provider = new ServiceProvider(); vis = new TypeVisualizerDialog(); provider.services.Add(vis); imVis = new ImageVisualizer(); imVis.Load(provider); vis.Show(); vis.Location = new System.Drawing.Point(X, 0); } } } //if initialization was unsuccessful then exit if (statusRet != uEye.Defines.Status.SUCCESS && m_Camera.IsOpened) { m_Camera.Exit(); } } }
private void Button_Exit_Click(object sender, EventArgs e) { /* Close the camera */ m_Camera.Exit(); Close(); }