private void LowPassFilter(object sender, RoutedEventArgs e)
        {
            temporary = Filtrator.LowPassFilter(JMask.GAUSS, (Bitmap)workingImage.Clone());
            ImageWindow iw = new ImageWindow(ImageSupporter.Bitmap2BitmapImage(temporary));

            iw.Show();
        }
Пример #2
0
        public static void gaborFilterRandom(Bitmap b)
        {
            GaborFilter gb     = new GaborFilter();
            Random      random = new Random();
            Bitmap      bx;



            for (int i = 1; i < 100; i++)
            {
                gb.Gamma  = random.NextDouble() * random.Next(1, 10);;
                gb.Lambda = random.Next(1, 10);
                gb.Psi    = random.NextDouble();
                gb.Sigma  = random.Next(1, 10);

                gb.Theta = 0;
                bx       = ImageSupporter.ColorToGrayscale(b);
                if (gb.Gamma == 0)
                {
                    gb.Gamma = 0.01;
                }
                Console.WriteLine(gb.Gamma + " " + gb.Lambda + " " + gb.Psi + " " + gb.Sigma + " " + gb.Theta);
                try
                {
                    ImageWindow iw = new ImageWindow(ImageSupporter.Bitmap2BitmapImage(gb.Apply(bx)));
                    iw.Title = gb.Gamma + " " + gb.Lambda + " " + gb.Psi + " " + gb.Sigma + " " + gb.Theta;
                    iw.Show();
                }
                catch (Exception e)
                {
                    e.GetBaseException();
                }
            }
        }
        private void Gornoprzepustowy(object sender, RoutedEventArgs e)
        {
            temporary = Filtrator.HighPassFilter(EMask.Prewitt, (Bitmap)workingImage.Clone());
            ImageWindow iw = new ImageWindow(ImageSupporter.Bitmap2BitmapImage(temporary));

            iw.Show();
        }
        private void Laplasjan(object sender, RoutedEventArgs e)
        {
            temporary = Filtrator.LaplasjanFilter((Bitmap)workingImage.Clone());
            ImageWindow iw = new ImageWindow(ImageSupporter.Bitmap2BitmapImage(temporary));

            iw.Show();
        }
Пример #5
0
        public Bitmap gaborFilter(Bitmap b, float gamma, float lambda, float psi, float sigma, float theta)
        {
            GaborFilter filter = new GaborFilter();
            Random      random = new Random();
            Boolean     flaga  = true;



            filter.Gamma  = gamma;
            filter.Lambda = lambda;
            filter.Psi    = psi;
            filter.Sigma  = sigma;
            filter.Theta  = theta;

            Bitmap bx = ImageSupporter.ColorToGrayscale(b);

            var okno = new ImageWindow(ImageSupporter.Bitmap2BitmapImage(filter.Apply(ImageSupporter.ColorToGrayscale(bx))));

            okno.Title = filter.Gamma + " " + filter.Lambda + " " + filter.Psi + " " + filter.Sigma + " " + filter.Theta;
            okno.Show();


            filter.Gamma = 3.0;
            filter.Theta = 0.0;
            GrayscaleToRGB grayscaleToRGB = new GrayscaleToRGB();

            return(grayscaleToRGB.Apply(filter.Apply(ImageSupporter.ColorToGrayscale(b))));
        }
        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;
        }
Пример #7
0
        public static void GaborFilter(Bitmap b, float gamma, float lambda, float psi, float sigma, float theta)
        {
            GaborFilter gb     = new GaborFilter();
            Random      random = new Random();
            Bitmap      bx;



            gb.Gamma  = gamma;
            gb.Lambda = lambda;
            gb.Psi    = psi;
            gb.Sigma  = sigma;

            gb.Theta = theta;
            bx       = ImageSupporter.ColorToGrayscale((Bitmap)b.Clone());


            Bitmap tmp = bx;

            tmp = gb.Apply(bx);

            ImageWindow iw = new ImageWindow(ImageSupporter.Bitmap2BitmapImage(tmp));

            iw.Title = gb.Gamma + " " + gb.Lambda + " " + gb.Psi + " " + gb.Sigma + " " + gb.Theta;
            iw.Show();
        }
        private void Test(object sender, RoutedEventArgs e)
        {
            MinutiaWektor       wektor            = database.mBase[1].MinutiaesWektor;
            ModyficationElement przesuniecie      = new ModyficationElement(0, 0, 10);
            MinutiaWektor       przesunietyWektor = new MinutiaWektorComperer().MapMinutiaWektor(wektor, przesuniecie);
            Bitmap b = (Bitmap)orginalBitmap.Clone();

            b             = MatchMinuties(b, przesunietyWektor);
            QUATRE.Source = ImageSupporter.Bitmap2BitmapImage(b);
        }
 //metody nieużywane do działąnia programu, ale istotne w trakcie testów i przygotowania pracy dyplomowej
 public void losowyObszar(object sender, EventArgs e)
 {
     fingerprint = new Fingerprint((BitmapImage)originalImage.Source);
     fingerprint.startRecognition(fingerprint.localOrientationMap);
     randomCel = fingerprint.getRandomCell(mapakierunkow);
     ImageSupporter.WriteBitmap(randomCel.bitmap);
     QUATRE.Source = ImageSupporter.Bitmap2BitmapImage(randomCel.bitmap);
     fingerprint.merge();
     threetothreeImage.Source = ImageSupporter.ToBitmapSource(ImageSupporter.Scale(1, fingerprint.localOrientationMap));
 }
 private void ShowOK(object sender, RoutedEventArgs e)
 {
     try
     {
         this.workingImage      = (Bitmap)temporary.Clone();
         odszumionyObraz.Source = ImageSupporter.Bitmap2BitmapImage(workingImage);
     }
     catch (Exception ex)
     {
     }
 }
 private void Cancel(object sender, RoutedEventArgs e)
 {
     try
     {
         temporary              = (Bitmap)orginalBitmap.Clone();
         workingImage           = (Bitmap)orginalBitmap.Clone();
         odszumionyObraz.Source = ImageSupporter.Bitmap2BitmapImage(workingImage);
     }
     catch (Exception ex)
     {
     }
 }
        private void AddImageToDatabase(String text)
        {
            String name = text;

            try
            {
                ImageSupporter.Save(ImageSupporter.Bitmap2BitmapImage(orginalBitmap), Directory.GetParent(Directory.GetCurrentDirectory()).Parent.FullName + "\\database\\" + name + ".png");
            }
            catch (Exception ex)
            {
            }
        }
        private void MinutaesDetection(object sender, RoutedEventArgs e)
        {
            QUATRE.Source = ImageSupporter.Bitmap2BitmapImage(fingerprint.getSectionPoints((Bitmap)workingImage.Clone()));

            Tuple <Bitmap, Bitmap> alreadyPassedImages = fingerprint.getAlreadyPassed();

            pojedynczyKierunek.Source    = ImageSupporter.Bitmap2BitmapImage(alreadyPassedImages.Item2);
            threetothreeImage.Source     = ImageSupporter.Bitmap2BitmapImage(alreadyPassedImages.Item1);
            temporaryMinutiasMap         = new MinutiaWektor(fingerprint.GetTemporaryMinutiasMap());
            MinuteaWektorInformator.Text = "Wykryto " + temporaryMinutiasMap.m.Count() + " minucji \n" +
                                           +temporaryMinutiasMap.GetEndCount() + " zakończeń \n" +
                                           +temporaryMinutiasMap.GetForkCount() + " rozwidleń";
        }
        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);
        }
        public void MapaKierunkow(object sender, RoutedEventArgs e)
        {
            // mapakierunkow.Source = ImageSupporter.Bitmap2BitmapImage(actualFingerprint.returnGrey());
            try
            {
                // fingerprint.startRecognition(fingerprint.localOrientationMap);
                fingerprint.startRecognition((Bitmap)workingImage.Clone());
                fingerprint.toDirectionMask();

                mapakierunkow.Source = ImageSupporter.Bitmap2BitmapImage(fingerprint.localOrientationMap);
            }
            catch (InvalidCastException ex)
            {
                Console.WriteLine("Nie podałeś odcisku palca do analizy");
            }
        }
Пример #16
0
        public Bitmap GetImageWithMatchedMinutias()
        {
            getSectionPointsBitmap(orginalBitmap);
            this.alreadyPassedInverted = (Bitmap)alreadyPassed.Clone();
            this.alreadyPassed         = (Bitmap)orginalBitmap.Clone();
            this.orginalBitmap         = ImageSupporter.ReverseBitmap(orginalBitmap);
            ImageWindow iw = new ImageWindow(ImageSupporter.Bitmap2BitmapImage(training));

            iw.Show();
            this.training = (Bitmap)orginalBitmap.Clone();
            this.inverted = true;
            getSectionPointsBitmap(orginalBitmap);
            this.orginalBitmap = ImageSupporter.ReverseBitmap(orginalBitmap);
            getMinutionsMap();//tutaj jest sprawdzanie i usuwanie niewłaściwych minucji
            this.inverted = false;
            return(MatchMunities());
        }
        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);
        }
Пример #18
0
        //metoda zwracająca bank filtrów gabora dla zadanej bitmapy
        public static List <Bitmap> gaborFilterMyBank(Bitmap bs)
        {
            List <SetValuesForGabor> bank = new List <SetValuesForGabor>();

            bank.Add(new SetValuesForGabor(4, 8, 0.5f, 9.2f, 0));
            bank.Add(new SetValuesForGabor(4, 8, 0.5f, 4.8f, (float)ImageSupporter.DegreeToRadian(15)));
            bank.Add(new SetValuesForGabor(4, 6.5f, 0.5f, 4.3f, (float)ImageSupporter.DegreeToRadian(30)));
            bank.Add(new SetValuesForGabor(4, 7, 0.5f, 4.3f, (float)ImageSupporter.DegreeToRadian(45)));
            bank.Add(new SetValuesForGabor(4, 6.5f, 0.5f, 4.3f, (float)ImageSupporter.DegreeToRadian(60)));
            bank.Add(new SetValuesForGabor(4, 8, 0.5f, 4.8f, (float)ImageSupporter.DegreeToRadian(75)));
            bank.Add(new SetValuesForGabor(4, 7, 0.5f, 4.6f, (float)ImageSupporter.DegreeToRadian(90)));
            bank.Add(new SetValuesForGabor(4, 7.3f, 0.5f, 4.4f, (float)ImageSupporter.DegreeToRadian(105)));
            bank.Add(new SetValuesForGabor(4, 6.2f, 0.5f, 3.7f, (float)ImageSupporter.DegreeToRadian(120)));
            bank.Add(new SetValuesForGabor(4, 7, 0.5f, 4.3f, (float)ImageSupporter.DegreeToRadian(135)));
            bank.Add(new SetValuesForGabor(4, 6.5f, 0.5f, 4.3f, (float)ImageSupporter.DegreeToRadian(150)));
            bank.Add(new SetValuesForGabor(4, 8, 0.5f, 4.8f, (float)ImageSupporter.DegreeToRadian(165)));



            GaborFilter gb     = new GaborFilter();
            Random      random = new Random();
            Bitmap      bx;
            Bitmap      b = (Bitmap)bs.Clone();

            List <Bitmap> gaborBank = new List <Bitmap>();

            bx = ImageSupporter.ColorToGrayscale(b);

            for (int i = 0; i < bank.Count; i++)
            {
                bank[i].SetGaborFilter(gb);
                gaborBank.Add(gb.Apply((Bitmap)bx.Clone()));

                ImageWindow im = new ImageWindow(ImageSupporter.Bitmap2BitmapImage(gaborBank[i]));

                im.Title = gb.Gamma + " " + gb.Lambda + " " + gb.Psi + " " + gb.Sigma + " " + gb.Theta;
                im.Show();
            }

            return(gaborBank);
        }
        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);
        }
        private void gradient(object sender, EventArgs e)
        {
            try
            {
                // Console.WriteLine(randomCel.wektorToAngle(randomCel.getWektor(threeToThree)));
                int x = Int32.Parse(Console.ReadLine());
                int y = Int32.Parse(Console.ReadLine());

                fingerprint = new Fingerprint((BitmapImage)originalImage.Source);
                fingerprint.startRecognition(fingerprint.localOrientationMap);
                randomCel = fingerprint.getCell(mapakierunkow, x, y);
                ImageSupporter.WriteBitmap(randomCel.bitmap);
                QUATRE.Source = ImageSupporter.Bitmap2BitmapImage(randomCel.bitmap);
                fingerprint.merge();
                threetothreeImage.Source = ImageSupporter.ToBitmapSource(ImageSupporter.Scale(1, fingerprint.localOrientationMap));
            }
            catch (System.NullReferenceException en)
            {
                Console.WriteLine("Nie masz wylosowanego obszaru 3 na 3");
            }

            //Console.WriteLine(imageCell.)
        }
 public void changeImage(Bitmap bitmap)
 {
     obrazek.Source = ImageSupporter.Bitmap2BitmapImage(bitmap);
 }
 public void OK()
 {
     this.workingImage      = (Bitmap)temporary.Clone();
     odszumionyObraz.Source = ImageSupporter.Bitmap2BitmapImage(workingImage);
 }
 private void MinutaesDetection()
 {
     QUATRE.Source        = ImageSupporter.Bitmap2BitmapImage(fingerprint.getSectionPoints((Bitmap)workingImage.Clone()));
     temporaryMinutiasMap = new MinutiaWektor(fingerprint.GetTemporaryMinutiasMap());
 }
        private void StartImageWindow(Bitmap bitmap)
        {
            ImageWindow iw = new ImageWindow(ImageSupporter.Bitmap2BitmapImage(bitmap), OK);

            iw.Show();
        }