Computer Vision API – Recognize Text

Recognize Text operation in Computer Vision API is similar to the OCR operation and it executes asynchronously. The Recognize Text operation uses updated recognition models.

Note: The Recognize Text API is being deprecated instead the Read API has the same functionality and is updated to handle PDF, TIFF, and multi-page files.

API referencehttps://bit.ly/2mndw5z

Pre-requisites

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

Image requirements

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

  • The image must be presented in JPEG, PNG, or BMP format.
  • The dimensions of the image must be between 50 x 50 and 4200 x 4200 pixels.
  • The file size of the image must be less than 4 megabytes (MB).

Recognize Text Operation

  • Launch Postman
  • Append your endpoint URL from pre-requisites step with /vision/2.0/recognizetext
  • Provide the parameter “mode” in the params tab.
  • 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 output from the RecognizeText operation. Note: You will receive a HTTP code 202 – Accepted response immediately and it will include an “Operation-Location”¬†header. We need to further query the operation status using the URL specified in this header. The operation ID will expire in 48 hours.
  • Try issuing a ‘GET’ with the Operation-Location URL to get the output.
 {
    "status": "Succeeded",
    "recognitionResult": {
        "lines": [
            {
                "boundingBox": [
                    1,
                    8,
                    311,
                    13,
                    310,
                    49,
                    0,
                    44
                ],
                "text": "The fire brigade has arrived",
                "words": [
                    {
                        "boundingBox": [
                            1,
                            10,
                            48,
                            10,
                            51,
                            43,
                            5,
                            46
                        ],
                        "text": "The"
                    },
                    {
                        "boundingBox": [
                            55,
                            10,
                            96,
                            10,
                            99,
                            41,
                            58,
                            42
                        ],
                        "text": "fire",
                        "confidence": "Low"
                    },
                    {
                        "boundingBox": [
                            103,
                            10,
                            175,
                            12,
                            176,
                            40,
                            106,
                            40
                        ],
                        "text": "brigade"
                    },
                    {
                        "boundingBox": [
                            182,
                            12,
                            224,
                            14,
                            224,
                            40,
                            183,
                            40
                        ],
                        "text": "has"
                    },
                    {
                        "boundingBox": [
                            230,
                            14,
                            311,
                            20,
                            311,
                            44,
                            231,
                            41
                        ],
                        "text": "arrived"
                    }
                ]
            },
            {
                "boundingBox": [
                    0,
                    46,
                    327,
                    37,
                    328,
                    60,
                    0,
                    69
                ],
                "text": "Adenauer is in a tough spot. Waiting.",
                "words": [
                    {
                        "boundingBox": [
                            0,
                            54,
                            69,
                            48,
                            69,
                            64,
                            0,
                            68
                        ],
                        "text": "Adenauer",
                        "confidence": "Low"
                    },
                    {
                        "boundingBox": [
                            86,
                            46,
                            100,
                            46,
                            100,
                            63,
                            86,
                            64
                        ],
                        "text": "is"
                    },
                    {
                        "boundingBox": [
                            111,
                            45,
                            126,
                            44,
                            126,
                            63,
                            111,
                            63
                        ],
                        "text": "in"
                    },
                    {
                        "boundingBox": [
                            141,
                            43,
                            151,
                            43,
                            150,
                            62,
                            141,
                            62
                        ],
                        "text": "a"
                    },
                    {
                        "boundingBox": [
                            172,
                            42,
                            209,
                            42,
                            209,
                            61,
                            171,
                            61
                        ],
                        "text": "tough"
                    },
                    {
                        "boundingBox": [
                            222,
                            41,
                            264,
                            41,
                            264,
                            61,
                            222,
                            61
                        ],
                        "text": "spot."
                    },
                    {
                        "boundingBox": [
                            270,
                            41,
                            328,
                            43,
                            327,
                            61,
                            270,
                            61
                        ],
                        "text": "Waiting.",
                        "confidence": "Low"
                    }
                ]
            },
            {
                "boundingBox": [
                    0,
                    82,
                    277,
                    65,
                    279,
                    91,
                    1,
                    109
                ],
                "text": "bring support and comfort to",
                "words": [
                    {
                        "boundingBox": [
                            0,
                            87,
                            48,
                            82,
                            49,
                            104,
                            1,
                            109
                        ],
                        "text": "bring",
                        "confidence": "Low"
                    },
                    {
                        "boundingBox": [
                            59,
                            81,
                            130,
                            75,
                            130,
                            98,
                            61,
                            103
                        ],
                        "text": "support",
                        "confidence": "Low"
                    },
                    {
                        "boundingBox": [
                            135,
                            75,
                            180,
                            72,
                            180,
                            95,
                            136,
                            97
                        ],
                        "text": "and"
                    },
                    {
                        "boundingBox": [
                            191,
                            72,
                            254,
                            70,
                            254,
                            93,
                            191,
                            95
                        ],
                        "text": "comfort",
                        "confidence": "Low"
                    },
                    {
                        "boundingBox": [
                            259,
                            70,
                            277,
                            70,
                            277,
                            92,
                            258,
                            93
                        ],
                        "text": "to"
                    }
                ]
            },
            {
                "boundingBox": [
                    0,
                    117,
                    307,
                    104,
                    309,
                    133,
                    2,
                    147
                ],
                "text": "Commonwealth countries do",
                "words": [
                    {
                        "boundingBox": [
                            1,
                            121,
                            156,
                            111,
                            158,
                            137,
                            4,
                            148
                        ],
                        "text": "Commonwealth",
                        "confidence": "Low"
                    },
                    {
                        "boundingBox": [
                            165,
                            110,
                            277,
                            108,
                            278,
                            133,
                            167,
                            136
                        ],
                        "text": "countries",
                        "confidence": "Low"
                    },
                    {
                        "boundingBox": [
                            289,
                            108,
                            308,
                            108,
                            309,
                            133,
                            290,
                            133
                        ],
                        "text": "do"
                    }
                ]
            }
        ]
    }
} 

Leave a Reply

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