导航

    • 登录
    • 搜索
    • 版块
    • 产品
    • 教程
    • 论坛
    • 淘宝
    1. 主页
    2. 2zqg
    3. 楼层
    2
    • 举报资料
    • 资料
    • 关注
    • 粉丝
    • 屏蔽
    • 帖子
    • 楼层
    • 最佳
    • 群组

    2zqg 发布的帖子

    • 测距时的Lm是什么意思?

      0_1565187964268_2699e9e6-e6c9-4efc-baa3-6c33b0cf0ae3-image.png 这里用颜色来测距时,Lm是什么意思,实际长度?那例程中的length也是实际长度啊,Lm=色块长加宽除以2又是什么意思呀?

      # Measure the distance
      #
      # This example shows off how to measure the distance through the size in imgage
      # This example in particular looks for yellow pingpong ball.
      
      import sensor, image, time
      
      # For color tracking to work really well you should ideally be in a very, very,
      # very, controlled enviroment where the lighting is constant...
      yellow_threshold   = ( 56,   83,    5,   57,   63,   80)
      # You may need to tweak the above settings for tracking green things...
      # Select an area in the Framebuffer to copy the color settings.
      
      sensor.reset() # Initialize the camera sensor.
      sensor.set_pixformat(sensor.RGB565) # use RGB565.
      sensor.set_framesize(sensor.QQVGA) # use QQVGA for speed.
      sensor.skip_frames(10) # Let new settings take affect.
      sensor.set_auto_whitebal(False) # turn this off.
      clock = time.clock() # Tracks FPS.
      
      K=5000#the value should be measured
      
      while(True):
          clock.tick() # Track elapsed milliseconds between snapshots().
          img = sensor.snapshot() # Take a picture and return the image.
      
          blobs = img.find_blobs([yellow_threshold])
          if len(blobs) == 1:
              # Draw a rect around the blob.
              b = blobs[0]
              img.draw_rectangle(b[0:4]) # rect
              img.draw_cross(b[5], b[6]) # cx, cy
              Lm = (b[2]+b[3])/2
              length = K/Lm
              print(length)
      
          #print(clock.fps()) # Note: Your OpenMV Cam runs about half as fast while
          # connected to your computer. The FPS should increase once disconnected.
      
      
      发布在 OpenMV Cam
      2
      2zqg
    • 关于自动模板匹配问题

      想写个自动截取图片保存然后进行模板匹配的程序,但保存图片之后python的一些更改图片大小、转换图片格式等的程序代码在OpenMV中不能用了,有什么办法可以解决这些问题吗,或者有办法做到自动的模板匹配吗?

      发布在 OpenMV Cam
      2
      2zqg
    • RE: 关于OpenMV文件写入的问题

      @kidswong999 感谢

      发布在 OpenMV Cam
      2
      2zqg
    • RE: 关于OpenMV文件写入的问题

      @kidswong999 谢提醒,close了😂 但改为写入字符串就又出现了了不知名错误……0_1564662247648_56b8ffa5-e4a9-46f3-81c9-9b9150b560fa-image.png

      发布在 OpenMV Cam
      2
      2zqg
    • RE: 关于OpenMV文件写入的问题

      @kidswong999 麻烦了

      发布在 OpenMV Cam
      2
      2zqg
    • RE: 关于OpenMV文件写入的问题
      
      import sensor, image, time, math, pyb
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA) # we run out of memory if the resolution is much bigger...
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False)  # must turn this off to prevent image washout...
      sensor.set_auto_whitebal(False)  # must turn this off to prevent image washout...
      clock = time.clock()
      
      tag_families = 0
      tag_families |= image.TAG16H5 # comment out to disable this family
      tag_families |= image.TAG25H7 # comment out to disable this family
      tag_families |= image.TAG25H9 # comment out to disable this family
      tag_families |= image.TAG36H10 # comment out to disable this family
      tag_families |= image.TAG36H11 # comment out to disable this family (default family)
      tag_families |= image.ARTOOLKIT # comment out to disable this family
      
      def family_name(tag):
          if(tag.family() == image.TAG16H5):
              return "TAG16H5"
          if(tag.family() == image.TAG25H7):
              return "TAG25H7"
          if(tag.family() == image.TAG25H9):
              return "TAG25H9"
          if(tag.family() == image.TAG36H10):
              return "TAG36H10"
          if(tag.family() == image.TAG36H11):
              return "TAG36H11"
          if(tag.family() == image.ARTOOLKIT):
              return "ARTOOLKIT"
      
      while(True):
          clock.tick()
          img = sensor.snapshot()
          f = open("test.txt")
          for tag in img.find_apriltags(families=tag_families): # defaults to TAG36H11 without "families".
              img.draw_rectangle(tag.rect(), color = (255, 0, 0))
              img.draw_cross(tag.cx(), tag.cy(), color = (0, 255, 0))
              print_args = (family_name(tag), tag.id(), (180 * tag.rotation()) / math.pi)
              #print("Tag Family %s, Tag ID %d, rotation %f (degrees)" % print_args)
              id = tag.id()
              f.write(id)        
          #print(clock.fps())
      
      
      发布在 OpenMV Cam
      2
      2zqg
    • 关于OpenMV文件写入的问题

      想把识别到的简单数据直接写入一个文本文件,但报错0_1564620942061_8RSF5_)0BBNZOXKV$DN8_K2.png

      while(True):
          clock.tick()
          img = sensor.snapshot()
          f = open("test.txt")
          for tag in img.find_apriltags(families=tag_families): # defaults to TAG36H11 without "families".
              img.draw_rectangle(tag.rect(), color = (255, 0, 0))
              img.draw_cross(tag.cx(), tag.cy(), color = (0, 255, 0))
              print_args = (family_name(tag), tag.id(), (180 * tag.rotation()) / math.pi)
              id = tag.id()
              f.write(id)
      
      发布在 OpenMV Cam
      2
      2zqg