Computer Vision API OCR : Not extracting numbers properly

Karthik Somanathan 21 Reputation points
2021-01-11T16:37:07.77+00:00

Computer Vision API OCR : Not extracting numbers properly

Hey,

i am trying to extract the numbers from the attached image but i got the below response,i am calling this from javascript. 55416-img-2750.jpeg

i am expecting the below response: 0005775 and 0047105 , but i am getting only this 0047105 , can i please get any help on this ?

My code flow:

  1. sending image as multipart-form data

var file = $('#myImageToConvert').prop('files')[0];

var formData = new FormData();
formData.append('file', file);

var uriBase = "<<MY COMPUTER VISION API URL>>"+ "vision/v3.1/ocr";

$.ajax({
url: uriBase,
type: 'POST',
beforeSend: function(xhrObj) {
xhrObj.setRequestHeader("enc-Type","multipart/form-data");
xhrObj.setRequestHeader("Ocp-Apim-Subscription-Key", subKey);
},
data: formData,
async: false,
cache: false,
contentType: false,
processData: false
})

Response from API:
respose=={"language":"ja","textAngle":-0.08377580409572721,"orientation":"Right","regions":[{"boundingBox":"1933,1300,1688,1724","lines":[{"boundingBox":"2935,1300,300,28","words":[{"boundingBox":"2935,1304,73,24","text":"Globus"},{"boundingBox":"3016,1302,18,23","text":"M"},{"boundingBox":"3060,1300,36,23","text":"認"},{"boundingBox":"3096,1316,6,10","text":","},{"boundingBox":"3139,1313,8,7","text":"・"},{"boundingBox":"3169,1307,7,7","text":"・"},{"boundingBox":"3200,1305,18,8","text":"\""},{"boundingBox":"3220,1304,15,15","text":"、"}]},{"boundingBox":"2937,1305,297,107","words":[{"boundingBox":"2937,1341,208,71","text":"0047105"},{"boundingBox":"3159,1305,75,96","text":"&"}]},{"boundingBox":"3590,1850,31,381","words":[{"boundingBox":"3595,1850,26,68","text":"00-"},{"boundingBox":"3590,1922,25,27","text":"d"},{"boundingBox":"3596,1961,20,24","text":"0"},{"boundingBox":"3590,1986,26,33","text":"!"},{"boundingBox":"3590,2023,27,30","text":"0"},{"boundingBox":"3596,2066,21,14","text":"」"},{"boundingBox":"3597,2081,20,25","text":"0"},{"boundingBox":"3591,2108,26,27","text":"て"},{"boundingBox":"3594,2138,23,37","text":"01"},{"boundingBox":"3598,2176,19,24","text":":"},{"boundingBox":"3593,2203,24,28","text":"4"}]},{"boundingBox":"3520,1871,37,362","words":[{"boundingBox":"3520,1871,34,53","text":"S"},{"boundingBox":"3520,1935,35,55","text":"コ"},{"boundingBox":"3521,1997,35,53","text":"田"},{"boundingBox":"3521,2058,35,60","text":"口"},{"boundingBox":"3522,2119,35,49","text":"」"},{"boundingBox":"3522,2176,35,57","text":"ロ"}]},{"boundingBox":"1933,1906,31,206","words":[{"boundingBox":"1933,1906,25,26","text":"コ"},{"boundingBox":"1934,1935,25,28","text":"イ"},{"boundingBox":"1934,1970,26,27","text":"ロ"},{"boundingBox":"1936,2001,24,9","text":"一"},{"boundingBox":"1936,2016,26,29","text":"口"},{"boundingBox":"1937,2049,27,63","text":"32"}]},{"boundingBox":"1940,2142,54,576","words":[{"boundingBox":"1952,2142,30,54","text":"冒"},{"boundingBox":"1959,2319,30,38","text":"ロ"},{"boundingBox":"1960,2366,29,31","text":"第"},{"boundingBox":"1940,2458,46,44","text":"S"},{"boundingBox":"1941,2513,47,48","text":"コ"},{"boundingBox":"1944,2570,46,45","text":"8"},{"boundingBox":"1947,2621,45,51","text":"ロ"},{"boundingBox":"1949,2675,45,43","text":"丿"}]},{"boundingBox":"1987,2844,62,180","words":[{"boundingBox":"1987,2844,57,64","text":"0"},{"boundingBox":"1988,2924,61,64","text":"0"},{"boundingBox":"2004,3004,42,20","text":"【"}]}]}]}

Azure Computer Vision
Azure Computer Vision
An Azure artificial intelligence service that analyzes content in images and video.
381 questions
0 comments No comments
{count} votes

Accepted answer
  1. YutongTie-MSFT 53,211 Reputation points
    2021-01-12T01:27:30.303+00:00

    Hello,

    Could you please try Read API which is better fit for your scenario? https://westus.dev.cognitive.microsoft.com/docs/services/computer-vision-v3-1-ga/operations/5d986960601faab4bf452005

    I have tried in the website preview for you sample and I think the result contain what you want. Let me know if it still not works.

    55497-image.png

    Regards,
    Yutong

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Ertugrul Kurnaz 1 Reputation point
    2021-01-15T10:22:23.137+00:00

    I got the same problem, I only get words in my response. This is a problem in my case since I will need to get numeric values (partially code). The Read API documentation is really poor and I could not figure out how to send my binary data file using cURL in PHP. Is there anyone who can help me out please ?

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.