Example #1
0
        private void NewMethod_verify()
        {
            AFISVerificationResult result = new AFISVerificationResult();
            LocalUser user_found          = new LocalUser();
            //_afis = new LocalAFIS();
            //Dictionary<long, LocalUser> userList = _afis.GetUserList();
            int threshold = Properties.Settings.Default.VerificationThreshold;

            //xamlListBoxUsers.Items.Clear();
            //bool found = false; ;
            //double matchValue = 0;


            //List<Fingerprint> fg = new List<Fingerprint>();
            using (tranxDataContext tx = new tranxDataContext())
            {
                tx.Connection.ConnectionString = Utils.getConnection();
                var fng = tx.fingerprint_Table_verifies.Select(s => s);
                lst_feedback2.Items.Clear();
                //foreach (fingerprint_Table_verify templateFile in fng)
                Parallel.ForEach(fng, templateFile =>
                {
                    lst_feedback2.Items.Insert(0, templateFile.refNO);

                    byte[] data = Utils.convert_string2byteArray(templateFile.finger_data);

                    //String templateFileString = Path.GetFileNameWithoutExtension(templateFile);
                    String fingerPos = templateFile.position;

                    Fingerprint fingerprint = new Fingerprint();
                    fingerprint.Template    = new Template();
                    fingerprint.Template.SetData(data, Dermalog.Afis.FingerCode3.Enums.TemplateFormat.Dermalog);
                    fingerprint.Position = UInt32.Parse(fingerPos);
                    //fg.Add(fingerprint);

                    dynamic verifyme = gen_FingerPrints(templateFile.refNO, fingerprint);

                    templateFile.VerifiedAS = "NOT_Verified_OK";
                    if (verifyme.found)
                    {
                        templateFile.VerifiedAS = "VerifiedOK";
                    }
                }

                                 );

                tx.SubmitChanges();
            }
            //return "";
        }
Example #2
0
        private dynamic gen_FingerPrints(string refNO, Fingerprint fp)
        {
            dynamic verify_Result         = new ExpandoObject();
            AFISVerificationResult result = new AFISVerificationResult();
            int threshold = Properties.Settings.Default.VerificationThreshold;

            //List<Fingerprint> fg = new List<Fingerprint>();
            using (tranxDataContext tx = new tranxDataContext())
            {
                tx.Connection.ConnectionString = Utils.getConnection();
                var fng = tx.fingerprint_Tables.Select(s => s).Where(w => w.refNO == refNO);
                //lst_feedback.Items.Clear();
                //foreach (fingerprint_Table_verify templateFile in fng)
                Parallel.ForEach(fng, (templateFile, loopState) =>
                {
                    //lst_feedback.Items.Insert(0, templateFile.refNO);

                    byte[] data = Utils.convert_string2byteArray(templateFile.finger_data);

                    //String templateFileString = Path.GetFileNameWithoutExtension(templateFile);
                    String fingerPos = templateFile.position;

                    Fingerprint fingerprint = new Fingerprint();
                    fingerprint.Template    = new Template();
                    fingerprint.Template.SetData(data, Dermalog.Afis.FingerCode3.Enums.TemplateFormat.Dermalog);
                    //fingerprint.Position = UInt32.Parse(fingerPos);
                    //fg.Add(fingerprint);

                    double dScore = new Matcher().Match(fingerprint.Template, fp.Template);
                    //double dScore = new Matcher().Match(userFingerprints[i].Template, fingerprints[j].Template);

                    if (dScore > threshold)
                    {
                        //dMaxScore = dScore;
                        result.Score = dScore;;
                        result.Hit   = true;
                        //return result;
                        verify_Result.found     = true;
                        verify_Result.result    = result;
                        verify_Result.fingerPos = fingerPos;
                        //tx.SubmitChanges();
                        //str.Append(user.Value.Name);
                        loopState.Stop();
                    }
                });
            }
            return(verify_Result);
        }
Example #3
0
        private void NewMethod()
        {
            AFISVerificationResult result = new AFISVerificationResult();
            LocalUser user_found          = new LocalUser();

            _afis = new LocalAFIS();
            Dictionary <long, LocalUser> userList = _afis.GetUserList();
            int threshold = Properties.Settings.Default.VerificationThreshold;
            //xamlListBoxUsers.Items.Clear();
            bool   found      = false;;
            double matchValue = 0;


            List <Fingerprint> fg = new List <Fingerprint>();

            using (tranxDataContext tx = new tranxDataContext())
            {
                tx.Connection.ConnectionString = Utils.getConnection();
                var fng = tx.fingerprint_Table_verifies.Select(s => s);
                lst_feedback.Items.Clear();
                //foreach (fingerprint_Table_verify templateFile in fng)
                Parallel.ForEach(fng, templateFile =>
                {
                    lst_feedback.Items.Insert(0, templateFile.refNO);

                    byte[] data = Utils.convert_string2byteArray(templateFile.finger_data);

                    //String templateFileString = Path.GetFileNameWithoutExtension(templateFile);
                    String fingerPos = templateFile.position;

                    Fingerprint fingerprint = new Fingerprint();
                    fingerprint.Template    = new Template();
                    fingerprint.Template.SetData(data, Dermalog.Afis.FingerCode3.Enums.TemplateFormat.Dermalog);
                    fingerprint.Position = UInt32.Parse(fingerPos);
                    fg.Add(fingerprint);

                    StringBuilder str = new StringBuilder();
                    Parallel.ForEach(userList, (user, loopState) =>
                                     //Parallel.ForEach(userList, options, (user, loopState) =>
                    {
                        foreach (Fingerprint fd in user.Value.Fingerprints)
                        {
                            //str.Clear();
                            //xamlListBoxUsers.Items.Add(user);
                            double dScore = new Matcher().Match(fingerprint.Template, fd.Template);
                            //double dScore = new Matcher().Match(userFingerprints[i].Template, fingerprints[j].Template);

                            if (dScore > threshold)
                            {
                                //dMaxScore = dScore;
                                result.Score = dScore;;
                                result.Hit   = true;
                                //return result;
                                templateFile.identifiedAS = user.Value.Name;
                                //tx.SubmitChanges();
                                //str.Append(user.Value.Name);
                                loopState.Stop();
                            }
                        }
                        //result = _afis.IdentifyUser_New(user.Key, fg, Properties.Settings.Default.VerificationThreshold);
                        //result = _afis.IdentifyUser(user.Key, fingerprints_all, Properties.Settings.Default.VerificationThreshold);
                        //if (result.Hit)
                        {
                            //templateFile.identifiedAS = str.ToString();
                            //found = true;
                            //matchValue = result.Score;
                            //loopState.Stop();
                        }
                    });
                });
                tx.SubmitChanges();
            }
            //return "";
        }