例程讲解20-Frame-Differencing->on_disk_basic_frame_differencing 需sd卡的简单帧差分
import sensor, image, os, time
TRIGGER_THRESHOLD = 5
sensor.reset()
BG_UPDATE_FRAMES = 50
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
sensor.set_auto_whitebal(False)
clock = time.clock()
if not "temp" in os.listdir(): os.mkdir("temp")
print("About to save background image...")
sensor.skip_frames(time = 2000)
sensor.snapshot().save("temp/bg.bmp")
print("Saved background image - Now frame differencing!")
while(True):
clock.tick()
img = sensor.snapshot()
img.difference("temp/bg.bmp")
hist = img.get_histogram()
diff = hist.get_percentile(0.99).l_value() - hist.get_percentile(0.90).l_value()
triggered = diff > TRIGGER_THRESHOLD
print(clock.fps())
星瞳科技OpenMV官方中文文档函数讲解:

星瞳科技OpenMV官方中文文档函数讲解:

星瞳科技OpenMV官方中文文档函数讲解:
