PersonAppearComponent

最低版本: 1.0.0最后更新: 2020/3/30

组件功能:

       判断有人出现(支持找特定id, name及任何人)

支持平台

平台是否支持
豹小秘
豹花/大瓶
M平台

参数

参数名类型
paramPersonAppearParam

PersonAppearParam

属性JS类型Java类型默认值必填说明最低版本
personIdnumberintno用于检测特定id的人脸1.0.0
personNamestringStringno用于检测特定名字的人脸(如果id和name都未提供则检测符合条件的任意人脸或人体)1.0.0
maxDistancenumberdouble3mno检测最大距离1.0.0
maxFaceAngleXnumberdouble60度no检测最大人脸角度1.0.0
isNeedInCompleteFacebooleanbooleanfalseno是否需要检测不完整人脸1.0.0
incompleteFaceCacheTimeoutnumberlong(毫秒)3000msno不完整人脸检测缓存时间1.0.0
isNeedBodybooleanbooleanfalseno是否需要检测人体1.0.0
isNeedRecognizebooleanboolean默认识别no是否需要识别1.1.2
recognizeTimeoutnumberlong(毫秒)2000msno识别超时时间1.1.2
isNeedDeletePicbooleanboolean默认删除no识别完成后是否删除照片1.1.2
appearTimeoutnumberlong(毫秒)7000msno检测超时时间1.1.2
scenestringStringno场景名称1.20.0

结果码

返回结果描述
RESULT_SUCCESS32610001检测成功
RESULT_TIMEOUT32610003组件执行超时

错误码

返回错误描述
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;

};