Beispiel #1
0
 /// <summary>
 /// Private Constructor for Image Processing Pack to be called in factory method
 /// </summary>
 /// <param name="framePublisher">Frame Publisher (streamer)</param>
 /// <param name="uiMonitor">User Interface Frame monitor to show frames</param>
 /// <param name="imagingProcess">Image Processing Unit</param>
 private ImageProcessPack(FramePublisher framePublisher, FrameUiMonitor uiMonitor, ImagingProcess imagingProcess)
 {
     Streamer = framePublisher;
     UiMonitor = uiMonitor;
     ImageProcessUnit = imagingProcess;
     _isCreated = true;
 }
Beispiel #2
0
 /// <summary>
 /// Private Constructor for Image Processing Pack to be called in factory method
 /// </summary>
 /// <param name="framePublisher">Frame Publisher (streamer)</param>
 /// <param name="uiMonitor">User Interface Frame monitor to show frames</param>
 /// <param name="imagingProcess">Image Processing Unit</param>
 private ImageProcessPack(FramePublisher framePublisher, FrameUiMonitor uiMonitor, ImagingProcess imagingProcess)
 {
     Streamer         = framePublisher;
     UiMonitor        = uiMonitor;
     ImageProcessUnit = imagingProcess;
     _isCreated       = true;
 }
Beispiel #3
0
        /// <summary>
        /// Factory method - Builds Image Processing Unit and all relevant components
        /// </summary>
        /// <param name="dispatcher">Dispatcher used to present frames in GUI relevant thread</param>
        /// <param name="screen">Canvas to draw frames on</param>
        /// <returns>ImageProcessPack with all components</returns>
        public static ImageProcessPack Create(Dispatcher dispatcher, System.Windows.Controls.Canvas screen)
        {
            if (!_isCreated)
            {
                IsDemoMode = Configuration.Attributes.GetValue <bool>(Configuration.Names.KEY_IS_DEMO_MODE);

                //Frame/Demo streamer
                FramePublisher framePublisher;
                if (!IsDemoMode)
                {
                    framePublisher = new FrameStreamer();
                }
                else
                {
                    framePublisher = new DemoStreamer();
                }

                FrameUiMonitor uiMonitor = new FrameUiMonitor(framePublisher, dispatcher, screen);

                //Initialize Marks
                double widthRate  = screen.Width / framePublisher.FrameWidth;
                double heightRate = screen.Height / framePublisher.FrameHeight;
                Marks.Initialize(dispatcher, screen, widthRate, heightRate);

                //Image/Demo processing unit
                ImagingProcess imagingProcess;
                if (!IsDemoMode)
                {
                    imagingProcess = new FrameProcessingUnit(framePublisher);
                }
                else
                {
                    imagingProcess = new DemoProcessingUnit(framePublisher);
                }

                return(new ImageProcessPack(framePublisher, uiMonitor, imagingProcess));
            }
            return(null);
        }
Beispiel #4
0
        /// <summary>
        /// Factory method - Builds Image Processing Unit and all relevant components
        /// </summary>
        /// <param name="dispatcher">Dispatcher used to present frames in GUI relevant thread</param>
        /// <param name="screen">Canvas to draw frames on</param>
        /// <returns>ImageProcessPack with all components</returns>
        public static ImageProcessPack Create(Dispatcher dispatcher, System.Windows.Controls.Canvas screen)
        {
            if (!_isCreated)
            {
                IsDemoMode = Configuration.Attributes.GetValue<bool>(Configuration.Names.KEY_IS_DEMO_MODE);

                //Frame/Demo streamer
                FramePublisher framePublisher;
                if (!IsDemoMode)
                {
                    framePublisher = new FrameStreamer();
                }
                else
                {
                    framePublisher = new DemoStreamer();
                }

                FrameUiMonitor uiMonitor = new FrameUiMonitor(framePublisher, dispatcher, screen);

                //Initialize Marks
                Marks.Initialize(dispatcher, screen, framePublisher.FrameWidth, framePublisher.FrameHeight);

                //Image/Demo processing unit
                ImagingProcess imagingProcess;
                if (!IsDemoMode)
                {
                    imagingProcess = new FrameProcessingUnit(framePublisher);
                }
                else
                {
                    imagingProcess = new DemoProcessingUnit(framePublisher);
                    imagingProcess.Initialize();
                }

                return new ImageProcessPack(framePublisher, uiMonitor, imagingProcess);
            }
            return null;
        }
 /// <summary>
 /// Operations to perform once the window is loaded
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 public void OnWindowLoaded(object sender, RoutedEventArgs e)
 {
     if (!ImageProcessPack.IsDemoMode)
     {
         _monitorA = new FrameUiMonitor(_imagePack.ImageProcessUnit.ImageProcessingMonitorA,
             Dispatcher, _guiImageA);
         _monitorB = new FrameUiMonitor(_imagePack.ImageProcessUnit.ImageProcessingMonitorB,
             Dispatcher, _guiImageB);
         _monitorC = new FrameUiMonitor(_imagePack.ImageProcessUnit.ImageProcessingMonitorC,
             Dispatcher, _guiImageC);
         _monitorD = new FrameUiMonitor(_imagePack.ImageProcessUnit.ImageProcessingMonitorD,
             Dispatcher, _guiImageD);
         _monitorA.Start();
         _monitorB.Start();
         _monitorC.Start();
         _monitorD.Start();
         Initialize();
     }
     else
     {
         MessageBox.Show("Image Processing Tools are not available in Demo Mode!");
         Close();
     }
 }