OCR on Windows Phone 8 WP8

I am new to the programming world and am trying to develop an application using OCR. I want the application to convert a singular receipt to text (nothing complicated).

However, my problem is that I discovered a lack of information for OCR on WP8 and how to implement it. I would like it to be a built-in WP feature and this information would be easily accessible, how to implement it.

Does anyone know where I could look, or a simple example of a piece of code that I could use? No subscription based service required.

+7
ocr windows-phone-8
source share
2 answers

Microsoft recently released the OCR library for Windows Runtime. Jerry Nixon posted a video in which you indicated him, and there is also an msdn article.

Jerry Nixon's Blog

MSDN

+1
source share

You can try using the same OCR service as Bing Lens. If you havenโ€™t tried it yet: open the camera, change the lens to a bing lens and try

The endpoint of the service is http://ocrrest.bingvision.net/V1 . It also gives you information about the location of the detected text with its bounding box.

Probably some kind of analysis of the violinist will help you send your image in a similar way.

I have a small snippet below that expects an image as an array of bytes

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); } } } 
0
source share

All Articles