【问题标题】:OCR on Windows Phone 8 WP8Windows Phone 8 WP8 上的 OCR
【发布时间】:2013-08-16 02:05:41
【问题描述】:

我是编程领域的新手,我正在尝试开发一个使用 OCR 的应用。 我希望应用程序将单数收据转换为文本(不太复杂)。

但是我的问题是我发现 WP8 上的 OCR 信息不足,以及如何实现它。 我会认为它是 WP 的内置功能,并且可以轻松访问有关如何实现它的信息。

有人知道我可以在哪里看,或者我可以使用的简单示例 sn-p 代码吗? 不想要基于订阅的服务。

【问题讨论】:

  • Windows phone 8 不支持任何 OCR API。您可以尝试一些外部库。看一看-leadtools.com/sdk/windows-phone/default.htm
  • @SadAlAbdullah,请将此作为答案,添加支持您答案的 Microsoft 声明,以便我们结束。

标签: windows-phone-8 ocr


【解决方案1】:

Microsoft 最近发布了适用于 Windows 运行时的 OCR 库。 Jerry Nixon 已经发布了一个视频指导你,还有一篇 msdn 文章。

Jerry Nixon's Blog

MSDN

【讨论】:

    【解决方案2】:

    您可以尝试使用与 Bing Lens 相同的 OCR 服务。没试过的:打开相机,换镜头试试看

    服务端点是http://ocrrest.bingvision.net/V1。它还为您提供有关检测到的文本及其边界框的位置信息

    可能一些提琴手分析会帮助您以类似的方式发送您的图像。

    我下面有一个小sn-p,它期望图像为字节数组

        public static readonly string ocrServiceUrl = "http://ocrrest.bingvision.net/V1";            // was: "platform.bing.com/ocr/V1";
        public static readonly string ocrLanguage = "en";
    
        public static async Task<JsonObject> MakeOcrJSON(byte[] image)
        {
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(string.Format("{0}/Recognize/{1}", ocrServiceUrl, ocrLanguage));
            request.Method = "POST";
    
            using (Stream requestStream = await request.GetRequestStreamAsync())
            {
                requestStream.Write(image, 0, image.Length);
            }
    
            try
            {
                using (HttpWebResponse response = (HttpWebResponse) (await request.GetResponseAsync()))
                {
                    using (var responseStream = new StreamReader(response.GetResponseStream()))
                    {
                        var json = JsonObject.Parse(responseStream.ReadToEnd());
                        return json;
                    }
                }
            }
            catch (WebException we)
            {
                using (Stream responseStream = we.Response.GetResponseStream())
                {
                    DataContractJsonSerializer serializer = new DataContractJsonSerializer(typeof(OcrResponse));
                    OcrResponse ocrResponse = (OcrResponse)serializer.ReadObject(responseStream);
                    string ErrorMessage = "Unknown Error";
                    if (ocrResponse.OcrFault.HasValue)
                    {
                        ErrorMessage = string.Format(
                            "HTTP status code: {0} Message: {1}",
                            ocrResponse.OcrFault.Value.HttpStatusCode,
                            ocrResponse.OcrFault.Value.Message);
                    }
                    throw new Exception(ErrorMessage);
                }
            }
        }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-26
      • 1970-01-01
      相关资源
      最近更新 更多