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