AI模块 API

需要集成AI模块才能使用

options

options 支持的参数有:

useFaceDetector

  • 类型boolean
  • 默认值false
  • 用法

是否使用人脸检测功能。

useObjectDetector

  • 类型boolean
  • 默认值false
  • 用法

是否使用物体检测功能。

aiFaceDetectLevel

  • 类型number
  • 默认值2
  • 用法

人脸检测的等级,值为1、2、3,4,5 值越大,检测的人脸越多,但是性能消耗也越大。

对于级别:1 低,2 中,3 高,4 较高,5 极高。

aiObjectDetectLevel

  • 类型number
  • 默认值2
  • 用法

物体检测的等级,值为1、2、3,4,5 值越大,检测的物体越多,但是性能消耗也越大。

对于级别:1 低,2 中,3 高,4 较高,5 极高。

aiFaceDetectShowRect

  • 类型boolean
  • 默认值false
  • 用法

是否在人脸检测的时候,显示人脸的矩形框。

aiObjectDetectShowRect

  • 类型boolean
  • 默认值false
  • 用法

是否在物体检测的时候,显示物体的矩形框。

aiFaceDetectInterval

  • 类型number
  • 默认值1
  • 用法

人脸检测的间隔,单位为秒。

aiObjectDetectInterval

  • 类型number
  • 默认值1
  • 用法

物体检测的间隔,单位为秒。

aiFaceDetectRectConfig

  • 类型object
  • 默认值{}
  • 参数
    • {string} borderColor 边框颜色 默认值 #0000FF
    • {number} borderWidth 边框宽度 默认值 2

人脸检测的矩形框的配置。

aiObjectDetectRectConfig

  • 类型object
  • 默认值{}
  • 参数
    • {string} borderColor 边框颜色 默认值 #0000FF
    • {number} borderWidth 边框宽度 默认值 2
    • {string} color 文字颜色 默认值 #000
    • {number} fontSize 文字大小 默认值 14

物品检测的矩形框的配置。

方法

faceDetectOpen()

  • 返回
    • {void}
  • 用法: 打开人脸检测功能。

faceDetectClose()

  • 返回
    • {void}
  • 用法: 关闭人脸检测功能。

objectDetectOpen()

  • 返回
    • {void}
  • 用法: 打开物品检测功能。

objectDetectClose()

  • 返回
    • {void}
  • 用法: 关闭物品检测功能。

updateAiFaceDetectLevel(level)

  • 参数
    • {number} level 人脸检测的等级,值为1、2、3,4,5 值越大,检测的精度越大,但是性能消耗也越大。
  • 返回
    • {void}
  • 用法: 更新人脸检测的等级。

updateAiObjectDetectLevel(level)

  • 参数
    • {number} level 物品检测的等级,值为1、2、3,4,5 值越大,检测的精度越大,但是性能消耗也越大。
  • 返回
    • {void}
  • 用法: 更新物品检测的等级。

updateAiObjectDetectInterval(interval)

  • 参数
    • {number} interval 物品检测的间隔,单位为秒。
  • 返回
    • {void}
  • 用法: 更新物品检测的间隔。

updateAiFaceDetectInterval(interval)

  • 参数
    • {number} interval 人脸检测的间隔,单位为秒。
  • 返回
    • {void}
  • 用法: 更新人脸检测的间隔。

事件

aiObjectDetectorInfo

监听物体检测的信息。

  • 回调参数
    • {object} data 物体检测的信息。

格式

{
  ts:'', // 时间戳
  list:{ // array
     zh:'',
     en:''
     confidence:'', // 准确度
     rect:{ // 坐标系
        width:'',
        height:'',
        x:'',
        y:''
     }
  }
}
jessibucaPro.on('aiObjectDetectorInfo', (data) => {
    console.log('aiObjectDetectorInfo', data);
});
// or
jessibucaPro.on(JessibucaPro.EVENTS.aiObjectDetectorInfo, (data) => {
    console.log('aiObjectDetectorInfo', data);
});

aiFaceDetectorInfo

监听人脸检测的信息。

  • 回调参数
    • {object} data 人脸检测的信息。

格式:

{
  ts:'', // 时间戳
  list:{ // 坐标系
    x:'',
    y:'',
    width:'',
    height:''
  }
}
jessibucaPro.on('aiFaceDetectorInfo', (event) => {
    console.log('aiFaceDetectorInfo', event);
});

// or
jessibucaPro.on(JessibucaPro.EVENTS.aiFaceDetectorInfo, (event) => {
    console.log('aiFaceDetectorInfo', event);
});