6. Blink and Mouth-Open Detection
Perform blink and mouth-open detection on the AI Camera.
Blink and mouth-open detection is a common facial behavior analysis task in computer vision, typically used for fatigue detection, liveness detection, human-computer interaction, and similar scenarios.
6.1. Python Example
Example: Blink and Mouth-Open Detection
#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('Blink count: ') + str(smart_camera.face_living_body.mouth_blink_counter[0]))
print(str('Mouth-open count: ') + str(smart_camera.face_living_body.mouth_blink_counter[1]))
6.2. mPython Graphical Example
6.3. Functions and Methods
- smart_camera.model_init(cur_state)
Instantiate the model
- Parameters:
cur_state (int) – model id for initialization
- class smart_camera.face_living_body
- recognize()
Run recognition