导航

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

    wygd

    @wygd

    0
    声望
    4
    楼层
    575
    资料浏览
    0
    粉丝
    0
    关注
    注册时间 最后登录

    wygd 关注

    wygd 发布的帖子

    • RE: 如何在寻线的时候把识别过程录制下来

      录制下来的视频不能播放

      发布在 OpenMV Cam
      W
      wygd
    • RE: 如何在寻线的时候把识别过程录制下来
      # Image Writer Example
      #
      # USE THIS EXAMPLE WITH A USD CARD! Reset the camera after recording to see the file.
      #
      # This example shows how to use the Image Writer object to record snapshots of what your
      # OpenMV Cam sees for later analysis using the Image Reader object. Images written to disk
      # by the Image Writer object are stored in a simple file format readable by your OpenMV Cam.
      THRESHOLD = (0, 35, -16, 13, -15, 23)
      import sensor, image, pyb, time
      from pyb import UART
      
      record_time = 10000 # 10 seconds in milliseconds
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQQVGA)
      sensor.skip_frames(time = 2000)
      clock = time.clock()
      
      uart = UART(3, 9600)
      img_writer = image.ImageWriter("/stream.bin")
      
      # Red LED on means we are capturing frames.
      red_led = pyb.LED(1)
      red_led.off()
      
      start = pyb.millis()
      while pyb.elapsed_millis(start) < record_time:
          clock.tick()
          #img = sensor.snapshot()
          # Modify the image if you feel like here...
          img = sensor.snapshot().binary([THRESHOLD])
          line = img.get_regression([(100,100,0,0,0,0)], robust = True)
          if (line):
              img.draw_line(line.line(), color = 127)
              if line.theta()>90:
                  theta_err = 270 - line.theta()
              else:
                  theta_err = 90 - line.theta()
              #print(line.magnitude(),line.theta(),line.rho())
              img_data = bytearray([theta_err])
              uart.write(img_data+'\r\n')
              #led3.on()
              print(theta_err,line.theta())
              #print(clock.fps())
          img_writer.add_frame(img)
          print(clock.fps())
      
      img_writer.close()
      
      # Blue LED on means we are done.
      red_led.off()
      blue_led = pyb.LED(3)
      blue_led.on()
      #blue_led.off()
      
      print("Done")
      while(True):
          clock.tick()
      #img = sensor.snapshot()
      # Modify the image if you feel like here...
          img = sensor.snapshot().binary([THRESHOLD])
          line = img.get_regression([(100,100,0,0,0,0)], robust = True)
          if (line):
              img.draw_line(line.line(), color = 127)
              if line.theta()>90:
                  theta_err = 270 - line.theta()
              else:
                  theta_err = 90 - line.theta()
          #print(line.magnitude(),line.theta(),line.rho())
              img_data = bytearray([theta_err])
              uart.write(img_data+'\r\n')
          #led3.on()
              print(theta_err,line.theta())
      
      
      发布在 OpenMV Cam
      W
      wygd
    • 如何在寻线的时候把识别过程录制下来

      在做寻线小车时候,想把识别直线的过程录制下来,方便调参数,应该怎么添加录像。

      发布在 OpenMV Cam
      W
      wygd