当前位置: 首页>>代码示例>>C#>>正文


C# API.GetStringProperty方法代码示例

本文整理汇总了C#中API.GetStringProperty方法的典型用法代码示例。如果您正苦于以下问题:C# API.GetStringProperty方法的具体用法?C# API.GetStringProperty怎么用?C# API.GetStringProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在API的用法示例。


在下文中一共展示了API.GetStringProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetResult

        /// <summary>
        /// Populate the OCR results into the metadata associated with the image
        /// </summary>
        /// <param name="a2IaEngine"></param>
        /// <param name="resultId">OCR result Id</param>
        /// <param name="voucher">Metadata of the image to be populated</param>
        public static void GetResult(API a2IaEngine, int resultId, OcrVoucher voucher)
        {
            // A2iA amount recognition
            if (a2IaEngine.GetStringProperty(resultId, Constants.EngineFields.Amount) == Constants.Enabled)
            {
                switch (voucher.VoucherType)
                {
                    case VoucherType.Credit:
                        voucher.AmountResult.Result = a2IaEngine.GetStringProperty(resultId,
                            Constants.ResultFields.Amount1);
                        var temp = a2IaEngine.GetStringProperty(resultId,
                            string.Concat(Constants.ResultFields.CreditBase, "Amount"));
                        var temp1 = a2IaEngine.GetStringProperty(resultId,
                            string.Concat(Constants.ResultFields.AltCreditBase, "Amount"));
                        var temp2 = a2IaEngine.GetStringProperty(resultId,
                            string.Concat(Constants.ResultFields.CheckBase, "Amount"));
                        System.Diagnostics.Debug.WriteLine("credit base = {0}, alt credit base = {1} check base = {2}", temp, temp1, temp2);

                            voucher.AmountResult.Score = a2IaEngine.GetStringProperty(resultId,
                            Constants.ResultFields.AmountConfidence1);
                        break;
                    default:
                        voucher.AmountResult.Result = a2IaEngine.GetStringProperty(resultId,
                            Constants.ResultFields.Amount);
                        voucher.AmountResult.Score = a2IaEngine.GetStringProperty(resultId,
                            Constants.ResultFields.AmountConfidence);
                        break;
                }

                var x1 = (int)((float)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.AmountLocationX1]);
                var y1 = (int)((float)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.AmountLocationY1]);
                var x2 = (int)((float)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.AmountLocationX2]);
                var y2 = (int)((float)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.AmountLocationY2]);

                voucher.AmountResult.Location = new Rectangle(x1, y1, x2 - x1, y2 - y1);
            }

            // A2iA codeline recognition
            if (a2IaEngine.GetStringProperty(resultId, Constants.EngineFields.CodeLine) == Constants.Enabled)
            {
                voucher.CodelineResult.Result = a2IaEngine.GetStringProperty(resultId, Constants.ResultFields.CodelineRecognition);
                voucher.CodelineResult.Score = a2IaEngine.GetStringProperty(resultId, Constants.ResultFields.CodelineConfidence);

                var x1 = (int)((float)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.CodelineLocationX1]);
                var y1 = (int)((float)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.CodelineLocationY1]);
                var x2 = (int)((float)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.CodelineLocationX2]);
                var y2 = (int)((float)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.CodelineLocationY2]);

                voucher.CodelineResult.Location = new Rectangle(x1, y1, x2 - x1, y2 - y1);
            }

            // A2iA date recognition
            if (a2IaEngine.GetStringProperty(resultId, Constants.EngineFields.Date) == Constants.Enabled)
            {
                var day = (uint)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.DateRecognitionDay];
                var month = (uint)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.DateRecognitionMonth];
                var year = (uint)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.DateRecognitionYear];

                voucher.DateResult.Result = string.Format("{0}/{1}/{2}", day, month, year);
                voucher.DateResult.Score = a2IaEngine.GetStringProperty(resultId, Constants.ResultFields.DateConfidence);

                var x1 = (int)((float)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.DateLocationX1]);
                var y1 = (int)((float)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.DateLocationY1]);
                var x2 = (int)((float)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.DateLocationX2]);
                var y2 = (int)((float)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.DateLocationY2]);

                voucher.DateResult.Location = new Rectangle(x1, y1, x2 - x1, y2 - y1);
            }

            // Image Rotation
            voucher.ImageRotation = (int)(float)a2IaEngine.ObjectProperty[resultId, Constants.ResultFields.OrientationCorrection];

            //Log.Verbose("v {0} - amt {1} score {2} - micr {3} score {4}", voucher.Id, voucher.AmountResult.Result, voucher.AmountResult.Score, voucher.CodelineResult.Result, voucher.CodelineResult.Score);
        }
开发者ID:jhonner72,项目名称:plat,代码行数:80,代码来源:Functions.cs


注:本文中的API.GetStringProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。