Ejemplo n.º 1
0
        private static void DarknessTest()
        {
            List <string> darkFingerprins   = new List <string>(new[] { "57_6", "19_4", "45_6", "86_1", "38_4", "38_2", "4_5", "7_2", "14_2", "19_7" });
            List <string> normalFingerprins = new List <string>(new[] { "1_7", "3_3", "5_3", "6_2", "8_8", "11_1", "21_5", "30_4", "30_8", "32_5" });


            for (int threshold = 80; threshold < 120; threshold += 5)
            {
                double darkAverage   = 0;
                double normalAverage = 0;
                for (int i = 0; i < darkFingerprins.Count; i++)
                {
                    var image = ImageHelper.LoadImage(Constants.PathToDb + darkFingerprins[i] + ".tif");
                    darkAverage += QualityHelper.GetDarkness(image);
                }
                darkAverage /= darkFingerprins.Count;
                darkAverage *= 100;
                for (int j = 0; j < normalFingerprins.Count; j++)
                {
                    var image = ImageHelper.LoadImage(Constants.PathToDb + normalFingerprins[j] + ".tif");
                    normalAverage += QualityHelper.GetDarkness(image);
                }
                normalAverage /= normalFingerprins.Count;
                normalAverage *= 100;
                string str = String.Format("{0} {1} {2} {3}\n", threshold, normalAverage, darkAverage, darkAverage - normalAverage);
                File.AppendAllText(@"D:\darkness1.txt", str);
            }
        }
Ejemplo n.º 2
0
 internal static Tuple<InputVector,InputVector,InputVector> GetMultyFuzzyInput(string fileName1, string fileName2, string fileName3, string fileNameEt, QualityHelper qhelper)
 {
   var res1 = GetMonoFuzzyInput(fileName1, fileNameEt, qhelper);
   var res2 = GetMonoFuzzyInput(fileName2, fileNameEt, qhelper);
   var res3 = GetMonoFuzzyInput(fileName3, fileNameEt,qhelper);
   Tuple<InputVector, InputVector, InputVector> res =
     new Tuple<InputVector, InputVector, InputVector>(res1, res2, res3);
   return res;
 }
Ejemplo n.º 3
0
        public static long MultymodalAllDifTest(int step, double thresholdStep, double startThreshold, double endThreshold)
        {
            Stopwatch w        = Stopwatch.StartNew();
            string    strFirst = String.Format("Threshold NumFull NumYes NumNo NumIdk\n");

            File.AppendAllText(Constants.resultsPath + "MultymodalAllDifTest.txt", strFirst);

            DecisionMaker decisionMaker = new DecisionMaker();
            QualityHelper qhelper       = new QualityHelper();
            DbHelper      dbHelper      = new DbHelper();
            Dictionary <int, List <Tuple <string, string, string> > > fpForMatchDictionary = new Dictionary <int, List <Tuple <string, string, string> > >();
            Dictionary <int, int> BestFp = new Dictionary <int, int>();

            for (int j = 1; j < 101; j += step)
            {
                var newFpForMatch = dbHelper.GetTestingFingerprintDiff(j);
                fpForMatchDictionary.Add(j, newFpForMatch);

                int bestFp = DbHelper.GetBestFingerprint(j);
                BestFp.Add(j, bestFp);
            }

            for (double threshold = startThreshold; threshold < endThreshold + 0.001; threshold += thresholdStep)
            {
                int numYes = 0;
                int numNo  = 0;
                int numIdk = 0;
                int numAll = 0;
                for (int j = 1; j < 101; j += step)
                {
                    int bestFp     = BestFp[j];
                    var fpForMatch = fpForMatchDictionary[j];

                    string fileNameEt = j.ToString() + "_" + bestFp.ToString() + ".tif";
                    foreach (var item in fpForMatch)
                    {
                        var input = InputHelper.GetMultymodalInput(item.Item1, item.Item2, item.Item3, fileNameEt);
                        if (input[0] > threshold && input[1] > threshold && input[2] > threshold)
                        {
                            numYes++;
                        }
                        else
                        {
                            numNo++;
                        }
                        numAll++;
                    }
                }
                string str = String.Format("{0} {1} {2} {3} {4}\n", threshold, numAll, numYes, numNo, 0);
                File.AppendAllText(Constants.resultsPath + "MultymodalAllDifTest.txt", str);
            }
            w.Stop();
            return(w.ElapsedMilliseconds);
        }
Ejemplo n.º 4
0
 public static void GetQualityDb()
 {
     for (int i = 41; i < 101; i++)
     {
         for (int j = 1; j < 9; j++)
         {
             int[,] nfiqMask = QualityHelper.GetQualityMap(Constants.PathToDb + i + "_" + j + ".tif");
             double nfiqQuality = QualityHelper.GetAverageQualityNfiq(nfiqMask);
             string str         = String.Format("{0} {1} {2}\n", i, j, nfiqQuality);
             File.AppendAllText(Constants.qualityDb + "qualityAll.txt", str);
         }
     }
 }
Ejemplo n.º 5
0
        private static void OneFingerQualityTest()
        {
            int i     = 88;
            int j     = 3;
            var image = ImageHelper.LoadImage(Constants.PathToDb + i + "_" + j + ".tif");

            int[,] nfiqMask =
                QualityHelper.GetQualityMap(Constants.PathToDb + i + "_" + j + ".tif");
            double nfiqBadReg  = QualityHelper.GetLowQualityBlocksNfiq(nfiqMask);
            double nfiqQuality = QualityHelper.GetAverageQualityNfiq(nfiqMask);
            double darkness    = QualityHelper.GetDarkness(image);
            double background  = QualityHelper.GetBackgroundPercentage(image);

            i++;
        }
Ejemplo n.º 6
0
        private static void FullQualityTest()
        {
            Stopwatch w = Stopwatch.StartNew();

            for (int i = 1; i < 101; i++)
            {
                for (int j = 1; j < 9; j++)
                {
                    var image = ImageHelper.LoadImage(Constants.PathToDb + i + "_" + j + ".tif");
                    int[,] nfiqMask =
                        QualityHelper.GetQualityMap(Constants.PathToDb + i + "_" + j + ".tif");
                    double nfiqBadReg  = QualityHelper.GetLowQualityBlocksNfiq(nfiqMask);
                    double nfiqQuality = QualityHelper.GetAverageQualityNfiq(nfiqMask);
                    double darkness    = QualityHelper.GetDarkness(image);
                    double background  = QualityHelper.GetBackgroundPercentage(image);
                    string str         = String.Format("{0} {1} {2} {3} {4} {5}\n", i, j, nfiqBadReg, nfiqQuality, darkness, background);
                    File.AppendAllText(Constants.qualityDb + "qualityTest2.txt", str);
                }
            }
            w.Stop();
            //File.AppendAllText(@"D:\qualityTest1.txt", w.ElapsedMilliseconds.ToString());
        }
Ejemplo n.º 7
0
    internal static InputVector GetMonoFuzzyInput(string fileName1, string fileNameEt, QualityHelper qhelper)
    {
      //var img1 = ImageHelper.LoadImage(Constants.PathToDb + fileName1);
      //var imgEt = ImageHelper.LoadImage(Constants.PathToDb + fileNameEt);

      double identity1 = Matcher.GetIdentity(fileNameEt, fileName1);

      
      //var map = QualityHelper.GetQualityMap(Constants.PathToDb + fileName1);
      //double awerageQuality = QualityHelper.GetAverageQualityNfiq(map);
      //double badBlocks = QualityHelper.GetLowQualityBlocksNfiq(map);
      //double darkness = QualityHelper.GetDarkness(img1);
      //double background = QualityHelper.GetBackgroundPercentage(img1);

      InputVector input = new InputVector();
      input.AverageQuality = qhelper.GetAverageQualityNfiqS(fileName1);
      input.Background =  qhelper.GetBackgroundS(fileName1);
      input.BadBlocks = qhelper.GetLowQualityBlocksNfiqS(fileName1);
      input.Darkness = qhelper.GetDarknessS(fileName1);
      input.Identity = identity1;
      return input;
    }
Ejemplo n.º 8
0
        private static void OneFingerTest(string fileName1, string fileName2)
        {
            var    img1      = ImageHelper.LoadImage(Constants.PathToDb + fileName1);
            var    img2      = ImageHelper.LoadImage(Constants.PathToDb + fileName2);
            double identity1 = Matcher.GetIdentity(fileName2, fileName1);

            var         map            = QualityHelper.GetQualityMap(Constants.PathToDb + fileName1);
            double      awerageQuality = QualityHelper.GetAverageQualityNfiq(map);
            double      badBlocks      = QualityHelper.GetLowQualityBlocksNfiq(map);
            double      darkness       = QualityHelper.GetDarkness(img1);
            double      background     = QualityHelper.GetBackgroundPercentage(img1);
            InputVector input          = new InputVector();

            input.AverageQuality = awerageQuality;
            input.Background     = background;
            input.BadBlocks      = badBlocks;
            input.Darkness       = darkness;
            input.Identity       = identity1;

            DecisionMaker m = new DecisionMaker();

            m.GetAnswerForFinger(input, 0.5);
        }
Ejemplo n.º 9
0
        public static long FuzzyDifTest(int step, double thresholdStep, double startThreshold, double endThreshold)
        {

            Stopwatch w = Stopwatch.StartNew();
            string strFirst = String.Format("Threshold NumFull NumYes NumNo NumIdk\n");
            File.AppendAllText(Constants.resultsPath + "FuzzyDifTest.txt", strFirst);

            DecisionMaker decisionMaker = new DecisionMaker();
            QualityHelper qhelper = new QualityHelper();
            DbHelper dbHelper = new DbHelper();
            Dictionary<int, List<Tuple<string, string, string>>> fpForMatchDictionary = new Dictionary<int, List<Tuple<string, string, string>>>();
            Dictionary<int, int> BestFp = new Dictionary<int, int>();

            for (int j = 1; j < 101; j += step)
            {
                var newFpForMatch = dbHelper.GetTestingFingerprintDiff(j);
                fpForMatchDictionary.Add(j, newFpForMatch);

                int bestFp = DbHelper.GetBestFingerprint(j);
                BestFp.Add(j, bestFp);
            }

            for (double threshold = startThreshold; threshold < endThreshold + 0.001; threshold += thresholdStep)
            {
                int numYes = 0;
                int numNo = 0;
                int numIdk = 0;
                int numAll = 0;
                for (int j = 1; j < 101; j += step)
                {
                    int bestFp = BestFp[j];
                    var fpForMatch = fpForMatchDictionary[j];

                    string fileNameEt = j.ToString() + "_" + bestFp.ToString() + ".tif";

                    foreach (var item in fpForMatch)
                    {
                        var input = InputHelper.GetMultyFuzzyInput(item.Item1, item.Item2, item.Item3, fileNameEt, qhelper);

                        var answer = decisionMaker.GetAnswer(input, threshold);
                        switch (answer.ValueName)
                        {
                            case "yes":
                                numYes++;
                                break;
                            case "no":
                                numNo++;
                                break;
                            case "idk":
                                numIdk++;
                                break;
                            default:
                                break;
                        }
                        numAll++;
                    }
                }
                string str = String.Format("{0} {1} {2} {3} {4}\n", threshold, numAll, numYes, numNo, numIdk);
                File.AppendAllText(Constants.resultsPath + "FuzzyDifTest.txt", str);
            }
            w.Stop();
            return w.ElapsedMilliseconds;
        }
Ejemplo n.º 10
0
        public static long MonomodalDifTest(int step, double thresholdStep, double startThreshold, double endThreshold)
        {

            Stopwatch w = Stopwatch.StartNew();
            string strFirst = String.Format("Threshold NumFull NumYes NumNo NumIdk\n");
            File.AppendAllText(Constants.resultsPath + "MonomodalSameTest.txt", strFirst);

            DecisionMaker decisionMaker = new DecisionMaker();
            QualityHelper qhelper = new QualityHelper();
            DbHelper dbHelper = new DbHelper();
            Dictionary<int, List<Tuple<string, string, string>>> fpForMatchDictionary = new Dictionary<int, List<Tuple<string, string, string>>>();
            Dictionary<int, int> BestFp = new Dictionary<int, int>();

            for (int j = 1; j < 101; j += step)
            {
                var newFpForMatch = dbHelper.GetTestingFingerprintDiff(j);
                fpForMatchDictionary.Add(j, newFpForMatch);

                int bestFp = DbHelper.GetBestFingerprint(j);
                BestFp.Add(j, bestFp);
            }

            for (double threshold = startThreshold; threshold < endThreshold + 0.001; threshold += thresholdStep)
            {
                int numYes = 0;
                int numNo = 0;
                int numIdk = 0;
                int numAll = 0;
                for (int j = 1; j < 101; j += step)
                {
                    int bestFp = BestFp[j];
                    var fpForMatch = fpForMatchDictionary[j];

                    string fileNameEt = j.ToString() + "_" + bestFp.ToString() + ".tif";
                    foreach (var item in fpForMatch)
                    {
                        var input1 = InputHelper.GetMonomodalInput(item.Item1, fileNameEt);
                        if (input1 < threshold)
                        {
                            numNo++;
                        }
                        else
                        {
                            numYes++;
                        }
                        numAll++;

                        var input2 = InputHelper.GetMonomodalInput(item.Item2, fileNameEt);
                        if (input2 < threshold)
                        {
                            numNo++;
                        }
                        else
                        {
                            numYes++;
                        }
                        numAll++;

                        var input3 = InputHelper.GetMonomodalInput(item.Item3, fileNameEt);
                        if (input3 < threshold)
                        {
                            numNo++;
                        }
                        else
                        {
                            numYes++;
                        }
                        numAll++;
                    }

                }
                string str = String.Format("{0} {1} {2} {3} {4}\n", threshold, numAll, numYes, numNo, 0);
                File.AppendAllText(Constants.resultsPath + "MonomodalDifTest.txt", str);

            }
            w.Stop();
            return w.ElapsedMilliseconds;
        }
Ejemplo n.º 11
0
        public static long FuzzySameTest(int step, double thresholdStep, double startThreshold, double endThreshold)
        {
            Stopwatch w        = Stopwatch.StartNew();
            string    strFirst = String.Format("Threshold NumFull NumYes NumNo NumIdk\n");

            File.AppendAllText(Constants.resultsPath + "FuzzySameTest.txt", strFirst);

            DecisionMaker decisionMaker = new DecisionMaker();
            QualityHelper qhelper       = new QualityHelper();

            Dictionary <int, List <Tuple <string, string, string> > > fpForMatchDictionary = new Dictionary <int, List <Tuple <string, string, string> > >();
            Dictionary <int, int> BestFp = new Dictionary <int, int>();

            for (int j = 1; j < 101; j += step)
            {
                int bestFp = DbHelper.GetBestFingerprint(j);
                BestFp.Add(j, bestFp);

                var newFpForMatch = DbHelper.GetTestingFingerprintSame(j, bestFp);
                fpForMatchDictionary.Add(j, newFpForMatch);
            }


            for (double threshold = startThreshold; threshold < endThreshold + 0.001; threshold += thresholdStep)
            {
                int numYes = 0;
                int numNo  = 0;
                int numIdk = 0;
                int numAll = 0;
                for (int j = 1; j < 101; j += step)
                {
                    int bestFp = BestFp[j];

                    var fpForMatch = fpForMatchDictionary[j];

                    string fileNameEt = j.ToString() + "_" + bestFp.ToString() + ".tif";

                    foreach (var item in fpForMatch)
                    {
                        var input = InputHelper.GetMultyFuzzyInput(item.Item1, item.Item2, item.Item3, fileNameEt, qhelper);

                        var answer = decisionMaker.GetAnswer(input, threshold);
                        switch (answer.ValueName)
                        {
                        case "yes":
                            numYes++;
                            break;

                        case "no":
                            numNo++;
                            break;

                        case "idk":
                            numIdk++;
                            break;

                        default:
                            break;
                        }
                        numAll++;
                    }
                }
                string str = String.Format("{0} {1} {2} {3} {4}\n", threshold, numAll, numYes, numNo, numIdk);
                File.AppendAllText(Constants.resultsPath + "FuzzySameTest.txt", str);
            }
            w.Stop();
            return(w.ElapsedMilliseconds);
        }
Ejemplo n.º 12
0
        internal static InputVector GetMonoFuzzyInput(string fileName1, string fileNameEt, QualityHelper qhelper)
        {
            //var img1 = ImageHelper.LoadImage(Constants.PathToDb + fileName1);
            //var imgEt = ImageHelper.LoadImage(Constants.PathToDb + fileNameEt);

            double identity1 = Matcher.GetIdentity(fileNameEt, fileName1);


            //var map = QualityHelper.GetQualityMap(Constants.PathToDb + fileName1);
            //double awerageQuality = QualityHelper.GetAverageQualityNfiq(map);
            //double badBlocks = QualityHelper.GetLowQualityBlocksNfiq(map);
            //double darkness = QualityHelper.GetDarkness(img1);
            //double background = QualityHelper.GetBackgroundPercentage(img1);

            InputVector input = new InputVector();

            input.AverageQuality = qhelper.GetAverageQualityNfiqS(fileName1);
            input.Background     = qhelper.GetBackgroundS(fileName1);
            input.BadBlocks      = qhelper.GetLowQualityBlocksNfiqS(fileName1);
            input.Darkness       = qhelper.GetDarknessS(fileName1);
            input.Identity       = identity1;
            return(input);
        }
Ejemplo n.º 13
0
        internal static Tuple <InputVector, InputVector, InputVector> GetMultyFuzzyInput(string fileName1, string fileName2, string fileName3, string fileNameEt, QualityHelper qhelper)
        {
            var res1 = GetMonoFuzzyInput(fileName1, fileNameEt, qhelper);
            var res2 = GetMonoFuzzyInput(fileName2, fileNameEt, qhelper);
            var res3 = GetMonoFuzzyInput(fileName3, fileNameEt, qhelper);
            Tuple <InputVector, InputVector, InputVector> res =
                new Tuple <InputVector, InputVector, InputVector>(res1, res2, res3);

            return(res);
        }