ocr_image_translation(self, *args, **kwargs) 方法

Ocr图片翻译接口,返回识别文本结果以及翻译结果
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 类型,必须, 待识别的带有文本信息的图片
language :string,必须, 待翻译语言的语言代号,见下表
to :string,必须, 翻译目标语言的语言代号,见下表

支持的语言代号列表

简体中文 英文 法语 德语 西班牙语 日语 韩语 印地语
zh-chs en fr de es ja ko hi

返回结果: OcrTranslateResult 类型

Field Summary

name type meaning
textAngle int 待识别文字与中轴线所成的角度
status int 状态码,0表示正常
orientation string 文字朝向(UP, DOWN, LEFT, RIGHT)
language string 所识别出的语言代码,对应关系见上表
to string 翻译成的语言代码,对应关系见上表
regions OcrRegion 类型数组 识别出的文本结果,包括文本内容,坐标位置信息已经翻译结果信息

样例

{
"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
}

results matching ""

    No results matching ""