本文介绍视觉智能开放平台通过配置审计接入,作为事件源发布到事件总线EventBridge的事件类型。

事件类型

视觉智能开放平台支持发布到事件总线EventBridge的事件类型如下所示。

事件类型 type参数值
通用文字识别 viapi:ocr:RecognizeCharacter
视频文件通用文字识别 viapi:ocr:RecognizeVideoCharacter

CloudEvents规范中定义的参数解释,请参见事件概述

通用文字识别

通用文字识别时,事件总线EventBridge接收到的示例事件如下所示。

 {
  "id": "25da3c42-0caa-4259-****-50d4c189f12b",
  "source": "acs.viapi",
  "specversion": "1.0",
  "type": "viapi:ocr:RecognizeCharacter",
  "datacontenttype": "application/json;charset=utf-8",
  "subject": "acs.viapi:cn-shanghai:1056067501*****:Request/6DE1D35C-2ED2-5FDC-*****-D2311A1C6932",
  "time": "2021-09-28T02:27:42.089Z",
  "aliyunaccountid": "1056067501*****",
  "aliyunpublishtime": "2021-09-28T02:27:42.115Z",
  "aliyunoriginalaccountid": "1056067501*****",
  "aliyuneventbusname": "default",
  "aliyunregionid": "cn-shanghai",
  "data": {
    "httpCode": "200",
    "jobId": "6DE1D35C-2ED2-5FDC-12DC-D2311A1C****",
    "ossFile": "oss://viapi-test/test/objectdet/DetectIPCObject/test***.jpeg",
    "requestId": "6DE1D35C-2ED2-5FDC-12DC-D2311A1C****",
    "result": "{\"Results\":[{\"Probability\":0.95983,\"TextRectangle\":{\"Angle\":0,\"Left\":50,\"Top\":50,\"Width\":100,\"Height\":40},\"Text\":\"文字内容\"},{\"Probability\":0.95983,\"TextRectangle\":{\"Angle\":10,\"Left\":50,\"Top\":50,\"Width\":100,\"Height\":40},\"Text\":\"文字内容\"}]}",
    "status": "PROCESS_SUCCESS"
  }
}

data字段包含的参数解释如下表所示。

参数 类型 示例值 描述
httpCode String 200 业务方的HttpCode。
jobId String 6DE1D35C-2ED2-5FDC-12DC-D2311A1C**** 执行任务的ID。
ossFile String oss://viapi-test/test/objectdet/DetectIPCObject/test***.jpeg OSS文件地址。
requestId String 6DE1D35C-2ED2-5FDC-12DC-D2311A1C**** 执行任务的请求ID。
result String {\"Results\":[{\"Probability\":0.95983,\"TextRectangle\":{\"Angle\":0,\"Left\":50,\"Top\":50,\"Width\":100,\"Height\":40},\"Text\":\"文字内容\"},{\"Probability\":0.95983,\"TextRectangle\":{\"Angle\":10,\"Left\":50,\"Top\":50,\"Width\":100,\"Height\":40},\"Text\":\"文字内容\"}]} 结果数据。
status String PROCESS_SUCCESS 任务处理结果状态。

视频文件通用文字识别

视频文件通用文字识别时,事件总线EventBridge接收到的示例事件如下所示。

{
  "id": "25da3c42-0caa-4259-****-50d4c189f12b",
  "source": "acs.viapi",
  "specversion": "1.0",
  "type": "viapi:ocr:RecognizeVideoCharacter",
  "datacontenttype": "application/json;charset=utf-8",
  "subject": "acs.viapi:cn-shanghai:1056067501*****:Request/6DE1D35C-2ED2-5FDC-*****-D2311A1C6932",
  "time": "2021-09-28T02:27:42.089Z",
  "aliyunaccountid": "1056067501*****",
  "aliyunpublishtime": "2021-09-28T02:27:42.115Z",
  "aliyunoriginalaccountid": "1056067501*****",
  "aliyuneventbusname": "default",
  "aliyunregionid": "cn-shanghai",
  "data": {
    "httpCode": "200",
    "jobId": "6DE1D35C-2ED2-5FDC-****-D2311A1C6932",
    "ossFile": "oss://viapi-test/test/objectdet/DetectIPCObject/test***.jpeg",
    "requestId": "6DE1D35C-2ED2-5FDC-****-D2311A1C6932",
    "result": "{\"Width\":1920,\"height\":1080,\"Frames\":[{\"Timestamp\":1,\"Elements\":[{\"Score\":0.95983,\"TextRectangle\":{\"Angle\":0,\"Left\":50,\"Top\":50,\"Width\":100,\"Height\":40},\"Text\":\"文字内容\"},{\"Score\":0.95983,\"TextRectangle\":{\"Angle\":10,\"Left\":50,\"Top\":50,\"Width\":100,\"Height\":40},\"Text\":\"文字内容\"}]}]}",
    "status": "PROCESS_SUCCESS"
  }
}

关于data字段包含的参数解释,请参见参数解释