人体识别

最近更新时间:2023-12-01 17:57:56

我的收藏

简介

本文档提供关于人体识别的相关 API 概览以及 SDK 示例代码。
API
操作描述
腾讯云数据万象通过 AIBodyRecognition 接口识别并输出画面中人体,输出其位置(矩形框)和置信度。图片人体识别请求包属于 GET 请求,请求时需要携带签名。

人体识别

腾讯云数据万象通过 AIBodyRecognition 接口识别并输出画面中人体,输出其位置(矩形框)和置信度。图片人体识别请求包属于 GET 请求,请求时需要携带签名。

方法原型

func (s *CIService) AIBodyRecognition(ctx context.Context, key string, opt *AIBodyRecognitionOptions) (*AIBodyRecognitionResult, *Response, error)

请求示例

// 将 examplebucket-1250000000 和 COS_REGION 修改为真实的信息
bu, _ := url.Parse("https://examplebucket-1250000000.cos.COS_REGION.myqcloud.com")
b := &cos.BaseURL{BucketURL: bu}
c := cos.NewClient(b, &http.Client{
Transport: &cos.AuthorizationTransport{
SecretID: os.Getenv("SECRETID"),
SecretKey: os.Getenv("SECRETKEY"),
}
})
obj := "pic/body.jpeg"
opt := &cosAIBodyRecognitionOptions{}
res, _, err := client.CI.AIBodyRecognition(context.Background(), obj, opt)
log_status(err)
fmt.Printf("%+v\\n", res)

参数说明

type AIBodyRecognitionOptions struct {
DetectUrl string `url:"detect-url,omitempty"`
}
参数名称
参数描述
类型
是否必填
DetectUrl
您可以通过填写 detect-url 处理任意公网可访问的图片链接。不填写 detect-url 时,后台会默认处理 key ,填写了 detect-url 时,后台会处理 detect-url 链接。
string

结果说明

调用 AIBodyRecognition 函数,会解析 api 返回的 xml 内容到 AIBodyRecognitionResult 结构,具体返回参数可查看 人体识别 文档。