Exemple #1
0
        public void OpenImage(object sender, RoutedEventArgs e)
        {
            var openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "JPG images (*.jpg)|*.jpg| PPM Images (*.ppm)|*.ppm";
            if (openFileDialog.ShowDialog().Value)
            {
                if (System.IO.Path.GetExtension(openFileDialog.FileName) == ".jpg")
                {
                    _bitmap = LoadImage(openFileDialog.FileName);
                }
                else
                {
                    _bitmap = LoadPPMImage(openFileDialog.FileName);
                }
                _directBitmap           = new DirectBitmap(_bitmap);
                _histogram              = new Histogram(_directBitmap);
                GridSpectro.DataContext = _histogram;
                PointTransformation.InitTransform(_directBitmap);
                Title              = openFileDialog.FileName;
                _zoomValue         = 1.0;
                ImageCanvas.Source = BitmapConverter.GetBitmapSource(_bitmap);
                SetZoom();
            }
        }
Exemple #2
0
 public void Show(string filePath, OpenMode openMode)
 {
     if (openMode == OpenMode.PPM)
     {
         _bitmap = LoadPPMImage(filePath);
     }
     else
     {
         _bitmap = LoadImage(filePath);
     }
     _directBitmap           = new DirectBitmap(_bitmap);
     _histogram              = new Histogram(_directBitmap);
     _binarization           = new LevelBinarization(_directBitmap, _histogram);
     GridSpectro.DataContext = _histogram;
     PointTransformation.InitTransform(_directBitmap);
     Title = filePath;
     ImageCanvas.Source = BitmapConverter.GetBitmapSource(_bitmap);
     Show();
 }