有奖捉虫:办公协同&微信生态&物联网文档专题 HOT

简介

本文档提供关于汽车识别的 API 概览以及 SDK 示例代码。
API
说明
车辆车牌检测功能为同步请求方式,您可以通过本接口检测图片中的车辆,识别出车辆的品牌、颜色、位置、车牌位置等信息。该接口属于 GET 请求

车辆车牌检测

功能说明

检测图片中的车辆,识别出车辆的品牌、颜色、位置、车牌位置等信息。

方法原型

func (s *CIService) DetectCar(ctx context.Context, key string) (*DetectCarResult, *Response, error)

请求示例

key := "pic/car.png"
res, _, err := c.CI.DetectCar(context.Background(), key)

参数说明

参数名称
参数描述
key
对象键(Key)是对象在存储桶中的唯一标识。例如,在对象的访问域名examplebucket-1250000000.cos.ap-guangzhou.myqcloud.com/pic/pic.jpg中,对象键为 pic/pic.jpg

结果说明

type DetectCarResult struct {
XMLName xml.Name `xml:"Response"`
RequestId string `xml:"RequestId,omitempty"`
CarTags []CarTags `xml:"CarTags,omitempty"`
}

type CarTags struct {
Serial string `xml:"Serial,omitempty"`
Brand string `xml:"Brand,omitempty"`
Type string `xml:"Type,omitempty"`
Color string `xml:"Color,omitempty"`
Confidence int `xml:"Confidence,omitempty"`
Year int `xml:"Year,omitempty"`
CarLocation []CarLocation `xml:"CarLocation,omitempty"`
PlateContent []PlateContent `xml:"PlateContent,omitempty"`
}

type CarLocation struct {
X int `xml:"X,omitempty"`
Y int `xml:"Y,omitempty"`
}

type PlateContent struct {
Plate string `xml:"Plate,omitempty"`
Color string `xml:"Color,omitempty"`
Type string `xml:"Type,omitempty"`
PlateLocation *PlateLocation `xml:"PlateLocation,omitempty"`
}

type PlateLocation struct {
X int `xml:"X,omitempty"`
Y int `xml:"Y,omitempty"`
}
参数名称
参数描述
RequestId
唯一请求 ID,每次请求都会返回。定位问题时需要提供该次请求的 RequestId
CarTags
车辆属性识别的结果数组,支持返回多个车辆信息
Serial
车系
Brand
车辆品牌
Type
车辆类型
Color
车辆颜色
Confidence
置信度,0 - 100
Year
年份,识别不出年份时返回0
CarLocation
车辆在图片中的坐标信息,可能返回多个坐标点的值
PlateContent
车牌信息,包含车牌号、车牌颜色、车牌位置。支持返回多个车牌
Plate
车牌号信息
Color
车牌的颜色
Type
车牌的种类,例如普通蓝牌
PlateLocation
车牌的位置
X
定位出的车牌左上角、右上角、左下角、右下角的 X 坐标
Y
定位出的车牌左上角、右上角、左下角、右下角的 Y 坐标