void Form1_DragDrop(object sender, DragEventArgs e)
        {
            String[] files = (String[])e.Data.GetData(DataFormats.FileDrop);
            // foreach (string file in files) Console.WriteLine(file);
            //this.TXT.Text = files[0];
            Bitmap bitmap = new Bitmap(files[0]);

            BitmapImage logo = new BitmapImage();

            logo.BeginInit();
            logo.UriSource = new Uri(files[0]);
            logo.EndInit(); // Getting the exception here
            originalImage.Source = logo;

            Bitmap tmp = ImageSupporter.ColorToGrayscale(ImageSupporter.BitmapImage2Bitmap(logo));
            Bitmap or  = Filtrator.segmentation(100, tmp);

            //originalImage.Source = ImageSupporter.Bitmap2BitmapImage(ImageSupporter.ColorToGrayscale(ImageSupporter.BitmapImage2Bitmap(logo)));
            originalImage.Source = ImageSupporter.Bitmap2BitmapImage(or);
            newImageSource       = files[0];


            fingerprint        = new Fingerprint((BitmapImage)originalImage.Source);
            this.orginalBitmap = fingerprint.orginalImage;
            this.workingImage  = (Bitmap)orginalBitmap.Clone();

            //actualFingerprint = new Fingerprint(logo);
            helpText.Visibility = Visibility.Hidden;
        }
        private void ShowChosenFingerprint(object sender, RoutedEventArgs e)
        {
            int index = DatabaseList.Items.IndexOf(sender);

            chossenDatabaseElement = index;
            DatabaseElement chosen = databaseList[index];

            Bitmap b = ImageSupporter.BitmapImage2Bitmap(new BitmapImage(new Uri(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + "\\database\\" + chosen.FingerprntName + ".png")));

            MinutiaWektor zbazy = database.mBase[index].MinutiaesWektor;

            b             = MatchMinuties2(b, zbazy, Color.Blue, Color.Orange);
            QUATRE.Source = ImageSupporter.Bitmap2BitmapImage(b);
        }
        private void ListBox_DoubleClick(object sender, RoutedEventArgs e)
        {
            int                 index        = EqualFingerprintList.Items.IndexOf(sender);
            DatabaseElement     chosen       = equals[index].Item1;
            ModyficationElement przesuniecie = equals[index].Item3;
            MinutiaWektor       wektor       = temporaryMinutiasMap;

            MinutiaWektor przesunietyWektor = new MinutiaWektorComperer().MapMinutiaWektor(temporaryMinutiasMap, przesuniecie);

            Bitmap b = ImageSupporter.BitmapImage2Bitmap(new BitmapImage(new Uri(Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + "\\database\\" + chosen.FingerprntName + ".png")));

            b = MatchMinuties2(b, przesunietyWektor, Color.Green, Color.Green);
            MinutiaWektor zbazy = database.mBase[index].MinutiaesWektor;

            b = MatchMinuties2(b, zbazy, Color.Blue, Color.Blue);
            b = MatchMinuties2(b, temporaryMinutiasMap, Color.Orange, Color.Orange);

            QUATRE.Source = ImageSupporter.Bitmap2BitmapImage(b);
        }
        private void Obrazek_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            System.Windows.Point p = e.GetPosition(obrazek);
            Bitmap b = ImageSupporter.BitmapImage2Bitmap((BitmapImage)obrazek.Source);


            int xr = (int)(p.X * (((double)b.Width) / obrazek.ActualWidth) + 0.5);
            int yr = (int)(p.Y * (((double)b.Height) / obrazek.ActualHeight) + 0.5);

            try
            {
                if (choo.Method != null)
                {
                    choo.Invoke(xr, yr);
                }
            }
            catch (Exception ex)
            {
            }
        }
        private void LoadImage(String path)
        {
            BitmapImage logo = new BitmapImage();

            logo.BeginInit();
            logo.UriSource = new Uri(path);
            logo.EndInit();
            //originalImage.Source = logo;

            Bitmap tmp = ImageSupporter.ColorToGrayscale(ImageSupporter.BitmapImage2Bitmap(logo));
            Bitmap or  = Filtrator.segmentation(100, tmp);

            //originalImage.Source = ImageSupporter.Bitmap2BitmapImage(ImageSupporter.ColorToGrayscale(ImageSupporter.BitmapImage2Bitmap(logo)));
            //originalImage.Source = ImageSupporter.Bitmap2BitmapImage(or);
            newImageSource = path;


            fingerprint        = new Fingerprint(ImageSupporter.Bitmap2BitmapImage(or));
            this.orginalBitmap = fingerprint.orginalImage;
            this.workingImage  = (Bitmap)orginalBitmap.Clone();
        }
        public static void matchArea(System.Windows.Controls.Image image, int xStart, int yStart, int width, int height)
        {
            Bitmap bitmap = ImageSupporter.BitmapImage2Bitmap((BitmapImage)image.Source);


            for (int a = 0; a < width; a++)
            {
                for (int b = 0; b < height; b++)
                {
                    byte bit = bitmap.GetPixel(a + xStart, b + yStart).R;
                    if (bit + 122 < 255)
                    {
                        bitmap.SetPixel(a + xStart, b + yStart, Color.FromArgb(bit + 122, bit, bit));
                    }
                    else
                    {
                        bitmap.SetPixel(a + xStart, b + yStart, Color.FromArgb(bit - 122, bit, bit));
                    }
                }
            }
            image.Source = ImageSupporter.Bitmap2BitmapImage(bitmap);
        }
Пример #7
0
 public Fingerprint(BitmapImage bitmapImage)
 {
     localOrientationMap = ImageSupporter.convertToModuloBitmap(ImageSupporter.BitmapImage2Bitmap(bitmapImage), squareLen);
     orginalImage        = ImageSupporter.convertToModuloBitmap(ImageSupporter.BitmapImage2Bitmap(bitmapImage), squareLen);
 }