.. currentmodule:: esp_ai .. _esp_ai.face_detection: class face_detection -- 人脸检测 ====================================== face_detection 用于人脸检测。 示例:: import esp_ai c = esp_ai.face_detection() #构建人脸检测对象 c.start) #启动 c.read() #获取检测结果 构造函数 ------------ .. class:: face_detection(None) 构建人脸检测对象,无参数。需要初始化摄像头和LCD。 使用方法 -------------- .. method:: face_detection.start() 启动AI功能。 .. method:: face_detection.read() 获取人脸检测结果,返回矩形区域数量、对应的矩形框左边以及五点关键特征值。 结果说明: 无检测结果返回(0) 1个结果,返回15个值。 (1,A[x0],A[y0],A[x1],A[y1],A[left_eye_X],A[left_eye_Y],A[right_eye_X],A[right_eye_Y], A[nose_X],A[nose_Y],A[left_mouth_X],A[left_mouth_Y],A[right_mouth_X],A[right_mouth_Y]) 说明:v[0]:人脸数量;v[1-4]:矩形左上角和右下角坐标;v[5-14]:左眼、右眼、鼻子、左嘴角、右嘴角坐标。 2个结果,返回29个值。(2, .......) 说明:v[0]:人脸数量;v[1-14]:人脸1数据;v[15-28]人脸2数据。 当前最大支持返回2个结果。