Computer Vision API – OCR

The “OCR” operation detects and extracts text from image and provides the output as JSON. The OCR operation executes synchronously and may not be suitable for large documents. It uses an earlier recognition model and supports more languages.

API referencehttps://bit.ly/2Q3Bujz

Pre-requisites

  • Computer Vision service or Cognitive Services provisioned on Azure
  • Postman App

Image requirements

The OCR operation works on images that meet the following requirements:

  • The image must be presented in JPEG, PNG, GIF, or BMP format.
  • The size of the input image must be between 50 x 50 and 4200 x 4200 pixels.
  • The text in the image can be rotated by any multiple of 90 degrees plus a small angle of up to 40 degrees.

OCR Operation

  • Launch Postman
  • Append your endpoint URL from pre-requisites step with /vision/2.0/ocr
  • Provide the parameters in Params tab. language and detectorientation
  • If the language parameter is set to “unk” then OCR service will auto detect the language.
  • If the detectorientation parameter is set to true then the OCR service will try to detect the image orientation before processing.
  • Provide the subscription key and content-type in Headers tab
  • Provide the image URL in the Body tab.
  • Following image is provided in the blob URL
  • Here is the OCR output from the API
 {
    "language": "en",
    "textAngle": 0.0,
    "orientation": "Up",
    "regions": [
        {
            "boundingBox": "26,27,311,291",
            "lines": [
                {
                    "boundingBox": "245,27,80,17",
                    "words": [
                        {
                            "boundingBox": "245,33,15,11",
                            "text": "v'"
                        },
                        {
                            "boundingBox": "265,27,60,13",
                            "text": "Microsoft"
                        }
                    ]
                },
                {
                    "boundingBox": "26,57,225,38",
                    "words": [
                        {
                            "boundingBox": "26,58,154,37",
                            "text": "Analyzing"
                        },
                        {
                            "boundingBox": "194,57,57,30",
                            "text": "and"
                        }
                    ]
                },
                {
                    "boundingBox": "26,95,298,38",
                    "words": [
                        {
                            "boundingBox": "26,95,164,38",
                            "text": "Visualizing"
                        },
                        {
                            "boundingBox": "206,97,70,30",
                            "text": "Data"
                        },
                        {
                            "boundingBox": "284,108,40,19",
                            "text": "*"
                        }
                    ]
                },
                {
                    "boundingBox": "28,133,134,37",
                    "words": [
                        {
                            "boundingBox": "28,133,37,37",
                            "text": "by"
                        },
                        {
                            "boundingBox": "78,134,84,36",
                            "text": "Using"
                        }
                    ]
                },
                {
                    "boundingBox": "29,171,295,30",
                    "words": [
                        {
                            "boundingBox": "29,171,147,29",
                            "text": "Microsoft"
                        },
                        {
                            "boundingBox": "190,172,96,29",
                            "text": "Power"
                        },
                        {
                            "boundingBox": "297,172,27,28",
                            "text": "Bl"
                        }
                    ]
                },
                {
                    "boundingBox": "160,280,177,38",
                    "words": [
                        {
                            "boundingBox": "160,294,14,8",
                            "text": "-"
                        },
                        {
                            "boundingBox": "206,280,131,38",
                            "text": "70-778"
                        }
                    ]
                }
            ]
        }
    ]
} 

Leave a Reply

Your email address will not be published. Required fields are marked *