示例#1
0
 void CloseCameras()
 {
     panoCam?.Close();
     panoCam = null;
     tableCam?.Close();
     tableCam = null;
 }
示例#2
0
 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();
 }
示例#3
0
 public MainWindow()
 {
     InitializeComponent();
     cbTableCam.SelectionChanged += CbTableCam_SelectionChanged;
     string[] cameraDevices = CamRetriever.getCameraList();
     cbTableCam.ItemsSource = cameraDevices;
     if (cameraDevices.Length > 0)
     {
         cbTableCam.SelectedIndex = 0;
     }
     StartPanoCam();
 }
示例#4
0
        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();
        }
示例#5
0
 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);
     }
 }