import sensor, time, image
# 重置感光元件
sensor.reset()
# 感光元件设置
sensor.set_contrast(3)
sensor.set_gainceiling(16)
# HQVGA and GRAYSCALE are the best for face tracking.
# HQVGA和灰度对于人脸识别效果最好
sensor.set_framesize(sensor.HQVGA)
sensor.set_pixformat(sensor.GRAYSCALE)
from image import SEARCH_EX, SEARCH_DS
face_cascade = image.HaarCascade("frontalface", stages=25)
print(face_cascade)
# FPS clock
clock = time.clock()
while (True):
clock.tick()
# 拍摄一张照片
template = sensor.snapshot()
r = template.find_template(template, 0.70, step=4, search=SEARCH_EX)
for m in r:
template.draw_rectangle(m)
x = r[0]
y = r[1]
w = r[2]
h = r[3]
print(r[0]+r[2]/2, r[1]+r[3]/2)
G
gfnx
@gfnx
0
声望
1
楼层
154
资料浏览
0
粉丝
0
关注
gfnx 发布的帖子
-
我想实现人脸识别返回画出的框的中心坐标 在这个代码中 报出这个错误