眨眼张嘴检测

在AI摄像头进行眨眼张嘴检测。

眨眼和张嘴检测是计算机视觉中常见的面部行为分析任务,通常用于疲劳检测、活体检测、人机交互等场景。

Python示例

例程:眨眼张嘴检测
#mPythonType:0
from mpython import *

import smartcamera_k230 as smartcamera

smart_camera = smartcamera.SmartCameraK230(tx=Pin.P1, rx=Pin.P0)

smart_camera.model_init(27)

while True:
    smart_camera.face_living_body.recognize()
    print(str('眨眼次数:') + str(smart_camera.face_living_body.mouth_blink_counter[0]))
    print(str('张嘴次数:') + str(smart_camera.face_living_body.mouth_blink_counter[1]))

mPython图形化示例

../../../../_images/%E7%9C%A8%E7%9C%BC.png

函数方法

smart_camera.model_init(cur_state)

实例化模型

参数:

cur_state (int) -- 初始化模型id

class smart_camera.face_living_body
recognize()

运行识别

class smart_camera.face_living_body

眨眼张嘴检测实例

变量:
  • mouth_blink_counter (list) -- 眨眼张嘴次数列表

  • mouth_blink_counter[0] (int) -- 眨眼次数

  • mouth_blink_counter[1] (int) -- 张嘴次数

测试视频