2. 人脸检测

2.1. 代码

例程:

from mpython import *
from camera import *
import time

camera = CameraV831(tx=Pin.P16, rx=Pin.P15)
camera.face_detect_init()
while True:
    camera.face_detect.recognize()
    if camera.face_detect.face_num != None:
        print(str('人脸数量:') + str(camera.face_detect.face_num))
        print(str('置信度:') + str(camera.face_detect.max_score))
    time.sleep_ms(20)

2.2. mPython图形化示例

../_images/face_detect.png

2.3. 方法

CameraV831(tx=Pin.P16, rx=Pin.P15)

tx 串口发送引脚

rx 串口接收引脚

例如:

from mpython import *
from camera import *
camera = CameraV831(tx=Pin.P16, rx=Pin.P15)