ocr_image_translation(self, *args, **kwargs) Method

Invoke the OCR image translation interface to return recognition text and translation results.
Request Syntax

ocr_translation_request = OcrTranslateRequest(image=image, language="en", to="zh-chs")
ocr_translation_result = vision_client.ocr_image_translation(ocr_translation_request)

Parameters

image : Image Type. Required for image to be recognized with text information.
language :String. Required. Language code for the language to be translated. See table below
to :String. Required. Language code for the target language. See table below.

List of Codes for Supported Languages

Simplified Chinese English French German Spanish Japanese Korean Hindi
zh-chs en fr de es ja ko hi

Results Returned: OcrTranslateResult Type

Field Summary

Name Type Meaning
TextAngle Int The angle between the text to be recognized and the axis.
Status Int Status code. 0 indicates normal.
Orientation String Text orientation (UP, DOWN, LEFT, RIGHT)
Language String The identified language codes, corresponding to the table above.
To String The identified language codes, corresponding to the table above.
Regions OcrRegion Type Array Recognized text results, including text content, coordinate position information and the translation result information

Example

{
"status":0,
"orientation":"UP",
"language":"en",
"regions":[
    {
        "boundingBox":"142,196,306,299",
        "lines":[
            {
                "boundingBox":"237,196,164,16",
                "text":"COMPANY NAME ",
                "toText":"公司名称"
            },
            {
                "boundingBox":"244,220,144,6",
                "text":"SLOGAN OF THE GOES HERE ",
                "toText":"口号在这里去"
            },
            {
                "boundingBox":"142,441,138,14",
                "text":"DWYANE CLARK ",
                "toText":"克拉克"
            },
            {
                "boundingBox":"184,464,95,8",
                "text":"GRAPHIC DESIGNER ",
                "toText":"平面设计器"
            },
            {
                "boundingBox":"375,479,32,6",
                "text":"AD DRESS ",
                "toText":"广告礼服"
            },
            {
                "boundingBox":"403,489,45,6",
                "text":"N USA ",
                "toText":"N 美国"
            }
        ]
    }
],
"to":"zh-chs",
"textAngle":0
}