import sensor, time, image, pyb
led = pyb.LED(3)
# Reset sensor
sensor.reset()
# Sensor settings
sensor.set_contrast(1)
sensor.set_gainceiling(16)
# HQVGA and GRAYSCALE are the best for face tracking.
sensor.set_framesize(sensor.HQVGA)
sensor.set_pixformat(sensor.GRAYSCALE)
face_cascade = image.HaarCascade("frontalface", stages=25)
#stages值未传入时使用默认的stages。stages值设置的小一些可以加速匹配,但会降低准确率。
print(face_cascade)
clock = time.clock()
while (True):
clock.tick()
img = sensor.snapshot()
#注意:比例因子越低,图像越小,检测的对象越小。
#阈值越高,检测率越高,误报越多。
objects = img.find_features(face_cascade, threshold=0.75, scale=1.35, roi)
#image.find_features(cascade, threshold=0.5, scale=1.5),thresholds越大,
#匹配速度越快,错误率也会上升。scale可以缩放被匹配特征的大小。
#在找到的目标上画框,标记出来
for r in objects:
img.draw_rectangle(r)
a = r.x()
print(a)
#time.sleep(100) #延时100ms
print(clock.fps())
希望有大佬可以告诉我人脸区域的中心坐标可以这么输出
请问例程中 r 的四个参数如单独输出
或者说如何单独的输出r的四个参数
https://docs.singtown.com/micropython/zh/latest/openmvcam/library/omv.image.html#image.find_features
你直接print(r)就知道了,这是一个列表。