request($this->bodyAnalysisUrl, $data);
}
/**
* 人体检测与属性识别接口
*
* @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
* @param array $options - 可选参数对象,key: value都为string类型
* @description options列表:
* type gender,
age,
lower_wear,
upper_wear,
headwear,
glasses,
upper_color,
lower_color,
cellphone,
upper_wear_fg,
upper_wear_texture,
lower_wear_texture,
orientation,
umbrella,
bag,
smoke,
vehicle,
carrying_item,
upper_cut,
lower_cut,
occlusion,
is_human | 1)可选值说明:
gender-性别,
age-年龄阶段,
lower_wear-下身服饰,
upper_wear-上身服饰,
headwear-是否戴帽子,
glasses-是否戴眼镜,
upper_color-上身服饰颜色,
lower_color-下身服饰颜色,
cellphone-是否使用手机,
upper_wear_fg-上身服饰细分类,
upper_wear_texture-上身服饰纹理,
orientation-身体朝向,
umbrella-是否撑伞;
bag-背包,
smoke-是否吸烟,
vehicle-交通工具,
carrying_item-是否有手提物,
upper_cut-上方截断,
lower_cut-下方截断,
occlusion-遮挡,
is_human-是否是正常人体
2)type 参数值可以是可选值的组合,用逗号分隔;**如果无此参数默认输出全部21个属性**
* @return array
*/
public function bodyAttr($image, $options=array()){
$data = array();
$data['image'] = base64_encode($image);
$data = array_merge($data, $options);
return $this->request($this->bodyAttrUrl, $data);
}
/**
* 人流量统计接口
*
* @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
* @param array $options - 可选参数对象,key: value都为string类型
* @description options列表:
* area 特定框选区域坐标,支持多个多边形区域,最多支持10个区域,如输入超过10个区域,截取前10个区域进行识别。
**此参数为空或无此参数、或area参数设置错误时,默认识别整个图片的人数** 。
area参数设置错误的示例:某个坐标超过原图大小,x、y坐标未成对出现等;注意:**设置了多个区域时,任意一个坐标设置错误,则认为area参数错误、失效**。
**area参数设置格式**:
1)多个区域用英文分号“;”分隔;
2)同一个区域内的坐标用英文逗号“,”分隔,默认尾点和首点相连做闭合。
示例:
1)单个多边形区域:x1,y1,x2,y2,x3,y3...xn,yn
2)多个多边形区域:xa1,ya1,xa2,ya2,xa3,ya3...xan,yan;xb1,yb1,xb2,yb2,xb3,yb3...xbn,ybn;..
* show 是否输出渲染的图片,默认不返回,**选true时返回渲染后的图片(base64)**,其它无效值或为空则默认false
* @return array
*/
public function bodyNum($image, $options=array()){
$data = array();
$data['image'] = base64_encode($image);
$data = array_merge($data, $options);
return $this->request($this->bodyNumUrl, $data);
}
/**
* 手势识别接口
*
* @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
* @param array $options - 可选参数对象,key: value都为string类型
* @description options列表:
* @return array
*/
public function gesture($image, $options=array()){
$data = array();
$data['image'] = base64_encode($image);
$data = array_merge($data, $options);
return $this->request($this->gestureUrl, $data);
}
/**
* 人像分割接口
*
* @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
* @param array $options - 可选参数对象,key: value都为string类型
* @description options列表:
* type 可以通过设置type参数,自主设置返回哪些结果图,避免造成带宽的浪费
1)可选值说明:
labelmap - 二值图像,需二次处理方能查看分割效果
scoremap - 人像前景灰度图
foreground - 人像前景抠图,透明背景
2)type 参数值可以是可选值的组合,用逗号分隔;如果无此参数默认输出全部3类结果图
* @return array
*/
public function bodySeg($image, $options=array()){
$data = array();
$data['image'] = base64_encode($image);
$data = array_merge($data, $options);
return $this->request($this->bodySegUrl, $data);
}
/**
* 驾驶行为分析接口
*
* @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
* @param array $options - 可选参数对象,key: value都为string类型
* @description options列表:
* type smoke,cellphone,
not_buckling_up,
both_hands_leaving_wheel,
not_facing_front |识别的属性行为类别,英文逗号分隔,默认所有属性都识别;
smoke //吸烟,
cellphone //打手机 ,
not_buckling_up // 未系安全带,
both_hands_leaving_wheel // 双手离开方向盘,
not_facing_front // 视角未看前方
* @return array
*/
public function driverBehavior($image, $options=array()){
$data = array();
$data['image'] = base64_encode($image);
$data = array_merge($data, $options);
return $this->request($this->driverBehaviorUrl, $data);
}
/**
* 人流量统计-动态版接口
*
* @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
* @param string $dynamic - true:动态人流量统计,返回总人数、跟踪ID、区域进出人数;
false:静态人数统计,返回总人数
* @param array $options - 可选参数对象,key: value都为string类型
* @description options列表:
* case_id 当dynamic为True时,必填;任务ID(通过case_id区分不同视频流,自拟,不同序列间不可重复即可)
* case_init 当dynamic为True时,必填;每个case的初始化信号,为true时对该case下的跟踪算法进行初始化,为false时重载该case的跟踪状态。当为false且读取不到相应case的信息时,直接重新初始化
* show 否返回结果图(含统计值和跟踪框渲染),默认不返回,选true时返回渲染后的图片(base64),其它无效值或为空则默认false
* area 当dynamic为True时,必填;静态人数统计时,只统计区域内的人,缺省时为全图统计。
动态人流量统计时,进出区域的人流会被统计。
逗号分隔,如‘x1,y1,x2,y2,x3,y3...xn,yn',按顺序依次给出每个顶点的xy坐标(默认尾点和首点相连),形成闭合多边形区域。
服务会做范围(顶点左边需在图像范围内)及个数校验(数组长度必须为偶数,且大于3个顶点)。只支持单个多边形区域,建议设置矩形框,即4个顶点。**坐标取值不能超过图像宽度和高度,比如1280的宽度,坐标值最小建议从1开始,最大到1279**。
* @return array
*/
public function bodyTracking($image, $dynamic, $options=array()){
$data = array();
$data['image'] = base64_encode($image);
$data['dynamic'] = $dynamic;
$data = array_merge($data, $options);
return $this->request($this->bodyTrackingUrl, $data);
}
/**
* 手部关键点识别接口
*
* @param string $image - 图像数据,base64编码,要求base64编码后大小不超过4M,最短边至少15px,最长边最大4096px,支持jpg/png/bmp格式
* @param array $options - 可选参数对象,key: value都为string类型
* @description options列表:
* @return array
*/
public function handAnalysis($image, $options=array()){
$data = array();
$data['image'] = base64_encode($image);
$data = array_merge($data, $options);
return $this->request($this->handAnalysisUrl, $data);
}
}