예제 #1
0
        public OpticalFlowForm()
        {
            InitializeComponent();
            _CLProcessor             = new CLProcessor(_Kernels);
            _OpenFileDialog          = new OpenFileDialog();
            _ImageFileHandler        = new FileHandler();
            _CurrentLKImplementation = (SimpleImage left, SimpleImage right, int level) => _CLProcessor.CalculateAdvancedPyramidalLK(left, right, level);

            string carsImagePath1 = "C:\\Users\\Ricsi\\Desktop\\BME\\2019_20_1\\FlowDatasets\\KITTI\\training\\image_2\\000006_10.png";
            string carsImagePath2 = "C:\\Users\\Ricsi\\Desktop\\BME\\2019_20_1\\FlowDatasets\\KITTI\\training\\image_2\\000006_11.png";

            Bitmap leftInput  = _ImageFileHandler.GetImageFromFile(carsImagePath1);
            Bitmap rightInput = _ImageFileHandler.GetImageFromFile(carsImagePath2);

            try
            {
                calcCurrentOpticalFlow(leftInput, rightInput, __StandardPyramidLevel);
                _SlideType = slideShowType.SingleOpticalFlowPair;
            }
            catch (Exception e)
            {
                Console.Write(e.Message);
                if (MessageBox.Show(e.Message, "Process couldn't complete", MessageBoxButtons.OK, MessageBoxIcon.Error) == DialogResult.OK)
                {
                    this.Close();
                    return;
                }

                Console.WriteLine("Exception end");
            }

            DisplayImage();
        }