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



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





    • # 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())
      
      


    • This post is deleted!


    • 你代码的问题是什么?



    • 录制下来的视频不能播放



    • 你的代码不对,请运行我链接里面的代码。



    • 您的代码里面只有录制视频,想要实现的功能是寻线的同时还要录制视频,在我播放这段视频的时候应该出现巡线的过程,视频中有巡线时出现的边框啊之类的一些东西,请问可以实现吗?谢谢。