PersonAppearComponent
最低版本: 1.0.0最后更新: 2020/10/21组件功能:
判断有人出现(支持找特定id, name及任何人)
支持平台:
平台 | 是否支持 |
豹小秘 | 是 |
豹花/大瓶 | 是 |
豹小秘 Mini | 是 |
参数
参数名 | 类型 |
param | PersonAppearParam |
PersonAppearParam
属性 | JS类型 | Java类型 | 默认值 | 必填 | 说明 | 最低版本 |
personId | number | int | 无 | no | 用于检测特定id的人脸 | 1.0.0 |
personName | string | String | 无 | no | 用于检测特定名字的人脸(如果id和name都未提供则检测符合条件的任意人脸或人体) | 1.0.0 |
maxDistance | number | double | 3m | no | 检测最大距离 | 1.0.0 |
maxFaceAngleX | number | double | 60度 | no | 检测最大人脸角度 | 1.0.0 |
isNeedInCompleteFace | boolean | boolean | false | no | 是否需要检测不完整人脸 | 1.0.0 |
incompleteFaceCacheTimeout | number | long(毫秒) | 3000ms | no | 不完整人脸检测缓存时间 | 1.0.0 |
isNeedBody | boolean | boolean | false | no | 是否需要检测人体 | 1.0.0 |
isNeedRecognize | boolean | boolean | 默认识别 | no | 是否需要识别 | 1.1.2 |
recognizeTimeout | number | long(毫秒) | 2000ms | no | 识别超时时间 | 1.1.2 |
isNeedDeletePic | boolean | boolean | 默认删除 | no | 识别完成后是否删除照片 | 1.1.2 |
appearTimeout | number | long(毫秒) | 7000ms | no | 检测超时时间 | 1.1.2 |
scene | string | String | 无 | no | 场景名称 | 1.20.0 |
结果码
返回结果 | 值 | 描述 |
RESULT_SUCCESS | 32610001 | 检测成功 |
RESULT_TIMEOUT | 32610003 | 组件执行超时 |
错误码
返回错误 | 值 | 描述 |
ERROR_OPEN_PERSON_DETECT_FAILED | -32600004 | 获取人脸数据失败 |
示例代码:
private personAppearComponentRef: React.RefObject<
PersonAppearComponent
> = React.createRef();
this.personAppearParam = new PersonAppearParam(
undefined,undefined,1.5,
undefined, true,undefined,
undefined,false,undefined,
undefined,3000);
<PersonAppearComponent
ref={this.personAppearComponentRef}
param={this.personAppearParam}
onFinish={this.onFinish}
/>
public onFinish = (event?: ComponentEvent): boolean => {
if (event) {
switch (event.status) {
case ComponentResultConst.RESULT_SUCCESS:
console.log(TAG, 'onFinish event success faceAppear true');
return true;
case ComponentResultConst.RESULT_TIMEOUT:
console.log(TAG, 'onFinish event timeout faceAppear false');
return true;
case ComponentErrorConst.ERROR_OPEN_PERSON_DETECT_FAILED:
console.log(TAG, 'onFinish event error faceAppear false');
return true;
}
}
return false;
};