Code: Select all
import sensor, image, time, pyb, utime sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.B64x64) sensor.skip_frames(time = 2000) clock = time.clock() oldImage = sensor.snapshot().mean_pooled(4, 4) while(True): clock.tick() newImage = sensor.snapshot().mean_pooled(4, 4) x,y,c = newImage.find_displacement(oldImage) oldImage = newImage print("dx: %10f dy: %10f confidence: %10f FPS: %f time: %d" % (x, y, c, clock.fps(), utime.ticks_ms()))
The camera is about 4" off of the desk and is moved back and forth about 18" over a 5 second period. The desk that I'm testing on is unfinished plywood so there is definition in the surface. I ploted the data in Excel to see the measured displacement and it looks like statistical noise (I've attached the graphs).
Am I missing something here? Am I using find_displacement() correctly?