例程讲解04-Image-Filters->basic_frame_differencing简单帧间差分
import sensor, image, os, time
sensor.reset()
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")
print(clock.fps())
星瞳科技OpenMV官方中文文档函数讲解: