logo

教程的人脸识别代码识别不了

2021-07-25 16:45
X
fuv6
import sensor, time, image


sensor.reset()

sensor.set_contrast(3)
sensor.set_gainceiling(16)
sensor.set_framesize(sensor.HQVGA)
sensor.set_pixformat(sensor.GRAYSCALE)

face_cascade = image.HaarCascade("frontalface", stages=25)
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)


    #在找到的目标上画框,标记出来
    for r in objects:
        img.draw_rectangle(r)
2021-07-25 17:30
I
网红小智智 星瞳科技

https://singtown.com/learn/50013/

按照视频步骤操作。

2021-07-25 17:39
X
fuv6

@kidswong999 你好,使用视频的代码还是识别不到人脸,返回的objects为空,但是其他的比如色块的识别是正常的

2021-07-25 17:46
I
网红小智智 星瞳科技

换一个位置,换一个光照环境,换个角度。

2021-07-25 17:51
X
fuv6

@kidswong999 换成纯白的背景也是不行,会不会是内置的frontalface的问题

2021-07-26 17:46
I
网红小智智 星瞳科技

你用的什么硬件,什么固件?sensor用的什么?