示例#1
0
        public static void OutputRecognitionResult(se.smartid.RecognitionResult recog_result)
        {
            Console.WriteLine("Document type: {0}", recog_result.GetDocumentType());
            Console.WriteLine("Match results:");

            MatchResultVector match_results = recog_result.GetMatchResults();

            for (int i = 0; i < match_results.Count; i++)
            {
                Console.WriteLine("    Template Type = {0}", match_results[i].GetTemplateType());
                Console.WriteLine("    Zone = {{({0:0.0}, {1:0.0}), ({2:0.0}, {3:0.0}), ({4:0.0}, {5:0.0}), ({6:0.0}, {7:0.0})}}",
                                  match_results[i].GetQuadrangle().GetPoint(0).x, match_results[i].GetQuadrangle().GetPoint(0).y,
                                  match_results[i].GetQuadrangle().GetPoint(1).x, match_results[i].GetQuadrangle().GetPoint(1).y,
                                  match_results[i].GetQuadrangle().GetPoint(2).x, match_results[i].GetQuadrangle().GetPoint(2).y,
                                  match_results[i].GetQuadrangle().GetPoint(3).x, match_results[i].GetQuadrangle().GetPoint(3).y);
            }
            Console.WriteLine("String fields:");
            StringVector string_field_names = recog_result.GetStringFieldNames();

            for (int i = 0; i < string_field_names.Count; i++)
            {
                StringField     field       = recog_result.GetStringField(string_field_names[i]);
                String          is_accepted = field.IsAccepted() ? "[+]" : "[-]";
                Utf16CharVector chars       = field.GetValue().GetUtf16String();
                StringBuilder   value       = new StringBuilder();
                foreach (Char ch in chars)
                {
                    value.Append(ch);
                }
                Console.WriteLine("    {0,-15} {1} {2}",
                                  field.GetName(), is_accepted, value);
            }
            Console.WriteLine("Image fields:");
            StringVector image_field_names = recog_result.GetImageFieldNames();

            for (int i = 0; i < image_field_names.Count; i++)
            {
                ImageField field       = recog_result.GetImageField(image_field_names[i]);
                String     is_accepted = field.IsAccepted() ? "[+]" : "[-]";
                Console.WriteLine("    {0, -15} {1} W: {2} H: {3}",
                                  field.GetName(), is_accepted,
                                  field.GetValue().width, field.GetValue().height);
            }

            Console.WriteLine("Result terminal:    {0}", recog_result.IsTerminal() ? "[+]" : "[-]");
        }