void CloseCameras() { panoCam?.Close(); panoCam = null; tableCam?.Close(); tableCam = null; }
void StartPanoCam() { panoCam = new CamRetriever(CamRetriever.getPanoCamIndex()); panoCam.CropArea = new RectangleF(Properties.Settings.Default.Pano_Crop_Left, Properties.Settings.Default.Pano_Crop_Top, Properties.Settings.Default.Pano_Crop_Width, Properties.Settings.Default.Pano_Crop_Height); panoCam.NewFrameAvailableEvent += NewFrameAvailableEvent; panoCam.Start(); }
public MainWindow() { InitializeComponent(); cbTableCam.SelectionChanged += CbTableCam_SelectionChanged; string[] cameraDevices = CamRetriever.getCameraList(); cbTableCam.ItemsSource = cameraDevices; if (cameraDevices.Length > 0) { cbTableCam.SelectedIndex = 0; } StartPanoCam(); }
void StartTableCam() { tableCam?.Close(); int tableCamIndex = cbTableCam.SelectedIndex >= 0 ? cbTableCam.SelectedIndex : 0; tableCam = new CamRetriever(tableCamIndex); tableCam.CropArea = new RectangleF(Properties.Settings.Default.Table_Crop_Left, Properties.Settings.Default.Table_Crop_Top, Properties.Settings.Default.Table_Crop_Width, Properties.Settings.Default.Table_Crop_Height); tableCam.NewFrameAvailableEvent += NewFrameAvailableEvent; tableCam.Start(); }
private void NewFrameAvailableEvent(int camIndex, Bitmap frameBmp) { if (camIndex == CamRetriever.getPanoCamIndex()) { Action displayaction = delegate { BitmapImage imgSrc = Utilities.ToBitmapImage(frameBmp, ImageFormat.Jpeg); panoDisplayer.Source = imgSrc; }; panoDisplayer.Dispatcher.Invoke(displayaction); } else { frameBmp.RotateFlip(RotateFlipType.Rotate270FlipNone); Action displayaction = delegate { BitmapImage imgSrc = Utilities.ToBitmapImage(frameBmp, ImageFormat.Jpeg); tableDisplayer.Source = imgSrc; }; tableDisplayer.Dispatcher.Invoke(displayaction); } }