Пример #1
0
        public void TestSegmentationPlusBigunPlusGlobalBinarization()
        {
            for (int i = 0; i < 20; i++)
            {
                var fp = new FingerprintProcessor();

                int[,] mask;

                var image = ImageHelper.LoadImage(Resources.SampleFinger1);

                int rows = image.GetLength(0);
                int columns = image.GetLength(1);

                var src = image.Select2D(x => (float) x).Make1D();

                var result = fp.SegmentImage(src, rows, columns, out mask, true);

                Stopwatch sw = new Stopwatch();
                sw.Start();
                FingerprintProcessor.Enhance(result, columns, rows);
                result = fp.BinarizeImage(result, rows, columns, true);

                sw.Stop();
                Trace.WriteLine("Binarization with GPU took " + sw.ElapsedMilliseconds + " ms");

                var path = Constants.Path + Guid.NewGuid() + ".png";

                ImageHelper.SaveArray(result.Make2D(rows, columns).Select2D(x => (double) x), path);

                Process.Start(path);
            }
        }
Пример #2
0
        public void TestMinutiaExtraction()
        {
            for (int i = 0; i < 20; i++)
            {
                var fp = new FingerprintProcessor();

                int[,] mask;

                var image = ImageHelper.LoadImage(Resources.SampleFinger1);

                int rows = image.GetLength(0);
                int columns = image.GetLength(1);
                Stopwatch sw = new Stopwatch();
                sw.Start();

                var src = image.Select2D(x => (float)x).Make1D();

                int regionSize = 17;
                int overlap = 1;

                var result = fp.SegmentImage(src, rows, columns, out mask, true);

                FingerprintProcessor.Enhance(result, columns, rows);

                var orField = fp.MakeOrientationField(result, rows, columns, regionSize, overlap, true);

                int orFieldWidth = columns / (regionSize - overlap);
                int orFieldHeight = rows / (regionSize - overlap);

                result = fp.BinarizeImage(result, rows, columns, true);

                result = fp.ThinImage(result, rows, columns, true);

                List<Minutia> mins = fp.FindMinutiae(result, rows, columns, orField, orFieldHeight, orFieldWidth, mask);
                
                sw.Stop();
                Trace.WriteLine("Binarization with GPU took " + sw.ElapsedMilliseconds + " ms");

                var path = Constants.Path + Guid.NewGuid() + ".png";

                ImageHelper.MarkMinutiaeWithDirections(Resources.SampleFinger1, mins, path);

                Process.Start(path);
            }

           
        }
Пример #3
0
        public void TestOrField()
        {
            for (int i = 0; i < 20; i++)
            {
                var fp = new FingerprintProcessor();

                var image = ImageHelper.LoadImage(Resources.SampleFinger1);


                int rows = image.GetLength(0);
                int columns = image.GetLength(1);

                var src = image.Select2D(x => (float) x).Make1D();

                Stopwatch sw = new Stopwatch();
                sw.Start();

                int regionSize = 17;
                int overlap = 1;

                int[,] mask;

                fp.SegmentImage(src, rows, columns, out mask, true);

                FingerprintProcessor.Enhance(src, columns, rows);

                var result = fp.MakeOrientationField(src, rows, columns, regionSize, overlap, true);

                sw.Stop();

                Trace.WriteLine("OrField with GPU took " + sw.ElapsedMilliseconds + " ms");

                var path = Constants.Path + Guid.NewGuid() + ".png";

                int orFieldWidth = columns/(regionSize - overlap);
                int orFieldHeight = rows/(regionSize - overlap);

                ImageHelper.SaveFieldAbove(image, result.Make2D(orFieldHeight, orFieldWidth).Select2D(x => (double) x),
                                           regionSize, overlap, path);

                Process.Start(path);
            }
        }