星瞳实验室APP,快速收到回复
  • 我们只解决官方正版的OpenMV的问题(STM32),其他的分支有很多兼容问题,我们无法解决。
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • TypeError:'displacement' object is not iterable



    • 0_1554881209959_~H5PFPV{Y{$6YJD16P`95G9.jpg



    • 如果涉及代码,需要报错提示与全部代码文本,请注意不要贴代码图片



    • # Optical Flow Example
      #
      # Your OpenMV Cam can use optical flow to determine the displacement between
      # two images. This allows your OpenMV Cam to track movement like how your laser
      # mouse tracks movement. By tacking the difference between successive images
      # you can determine instaneous displacement with your OpenMV Cam too!
      
      import sensor, image, time
      
      sensor.reset() # Initialize the camera sensor.
      sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.GRAYSCALE
      sensor.set_framesize(sensor.B64x32) # or B40x30 or B64x64
      clock = time.clock() # Tracks FPS.
      
      # NOTE: The find_displacement function works by taking the 2D FFTs of the old
      # and new images and compares them using phase correlation. Your OpenMV Cam
      # only has enough memory to work on two 64x64 FFTs (or 128x32, 32x128, or etc).
      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)
      
          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()))