特征点识别,想让他循环识别的同时不影响摄像头拍摄的画面
-
特征点识别,想让他循环识别的同时不影响摄像头拍摄的画面,应该怎么写才能实现呢?用time.sleep放在循环里会导致snapshot跟着延时,有什么实现方法吗?
kpts1 = image.load_descriptor("/panda.orb") kpts2 = image.load_descriptor("/phone.orb") print(1) while(True): img = sensor.snapshot() kpts = img.find_keypoints(max_keypoints=150, threshold=10, scale_factor=1.2) print(2) match1 = image.match_descriptor(kpts, kpts1, threshold=85) if (match1.count()>6): print(3) match2 = image.match_descriptor(kpts, kpts2, threshold=85) if (match2.count()>6): print(4) time.sleep(2)
-
import sensor, image, time import pyb sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QVGA) sensor.skip_frames(time = 2000) clock = time.clock() last = pyb.millis() while(True): clock.tick() img = sensor.snapshot() if pyb.millis() - last > 2000: last = pyb.millis() print("match_descriptor every 2s") ##match_descriptor #print(clock.fps())