logo

openMV 关于find_displacement的问题,不可迭代是怎么回事?

2018-10-17 22:39
P
976327901
import sensor, image, time

sensor.reset() # Initialize the camera sensor.
sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
sensor.set_framesize(sensor.B64X64) # or B40x30 or B64x64
clock = time.clock() # Tracks FPS.

old = sensor.snapshot()
#先获取一张图片

while(True):
    clock.tick() # Track elapsed milliseconds between snapshots().
    img = sensor.snapshot() # Take a picture and return the image.

    [delta_x, delta_y, response] = old.find_displacement(img)
    #delta_x delta_y分别表示 x y 方向上,这一帧图像相比上帧图像移动的像素数目。

    old = img.copy()

    print("%0.1f X\t%0.1f Y\t%0.2f QoR\t%0.2f FPS" % \
        (delta_x, delta_y, response, clock.fps()))
2018-10-18 10:49
I
网红小智智 星瞳科技

你这个代码语法就不对。

http://book.openmv.cc/example/22-Optical-Flow/absolute-translation.html

2018-10-18 17:27
P
976327901

@kidswong999 链接文本 (http://kaizhi-xu.com/post/openmvli-cheng-jiang-jie/openmvli-cheng-jiang-jie-50)我在这个网站看到的,不是你写的吗?