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(); } } }
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(); } } }