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);
});