使用cascade文件,是不是要吧圖像弄成灰才能夠識別呢?為什麼我彩色的,總是沒有識別出來?
提供一下全部代码和cascode文件。我测试一下。
import sensor, time, image
sensor.reset()
sensor.set_pixformat(sensor.GRAYSCALE)
sensor.set_framesize(sensor.LCD)
sensor.skip_frames(time = 2000)
sensor.set_auto_gain(False)
sensor.set_framesize(sensor.LCD)
sensor.set_auto_whitebal(False)
stopgrey_cascade = image.HaarCascade("stopgrey.cascade", stages=25)
print(stopgrey_cascade)
clock = time.clock()
while (True):
clock.tick()
img = sensor.snapshot()
objects = img.find_features(stopgrey_cascade, threshold=0.75, scale_factor=1.25)
for r in objects:
img.draw_rectangle(r)
print(clock.fps())@kidswong999 文件怎么上传呢?

@gohw 图片为上图
haar算法只能使用灰度的。