private void comboBoxEditCameraList_SelectedIndexChanged(object sender, EventArgs e) { if (comboBoxEditCameraList.Properties.Items.Count > 0 && comboBoxEditCameraList.SelectedIndex >= 0) { cameraSelected = (Camera)comboBoxEditCameraList.SelectedItem; } }
public void SelectCamera(Camera camera) { ThrashOldCamera(); _selectedCamera = camera; CameraHelper(_selectedCamera, 720, 480, 50); StartPreview(); }
public override void SetUp() { // Refresh the list of available cameras lstCameras.Clear(); foreach (Camera cam in CameraService.AvailableCameras) lstCameras.Add(cam); if (lstCameras.Count > 0) activeCamera = lstCameras[0]; }
public FormCameraConfig() { InitializeComponent(); comboBoxEditCameraList.Properties.Items.Clear(); foreach (Camera cam in CameraService.AvailableCameras) { comboBoxEditCameraList.Properties.Items.Add(cam); } if (comboBoxEditCameraList.Properties.Items.Count > 0) { comboBoxEditCameraList.SelectedIndex = 0; comboBoxEditCameraList.Select(); cameraSelected = (Camera)comboBoxEditCameraList.SelectedItem; } }
public CameraFrameSource([Import(ExportInterfaceNames.DefaultCamera)] Camera camera) { if (camera == null) throw new ArgumentNullException("camera"); this.Camera = camera; }
public void CameraHelper(Camera camera, int width, int height, int fps) { try { _frameSource = new CameraFrameSource(camera) { Camera = { CaptureWidth = width, CaptureHeight = height, Fps = fps } }; _frameSource.NewFrame += OnImageCaptured; } catch(Exception ex) { MessageBox.Show(ex.Message); } }
void formCamera_FormClosing(object sender, FormClosingEventArgs e) { if (formCamera.isOK) { videoCamera = formCamera.cameraSelected; flipVertical = videoCamera.FlipVertical; flipHorizontal = videoCamera.FlipHorizontal; thrashOldCamera(); startCapturing(); } }