导航

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

    惠斯 发布的帖子

    • 我出现这个问题,请问这要怎么解决?

      0_1562695592328_QQ图片20190710020617.png

      代码如下:

      THRESHOLD = (5, 70, -23, 15, -57, 0) # Grayscale threshold for dark things...
      import sensor, image, time
      from pyb import LED
      from pyb import UART
      from pid import PID
      rho_pid = PID(p=0.4, i=0)
      theta_pid = PID(p=0.001, i=0)
      
      LED(1).on()
      LED(2).on()
      LED(3).on()
          
      sensor.reset()
      #sensor.set_vflip(True)
      #sensor.set_hmirror(True)
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQQVGA) # 80x60 (4,800 pixels) - O(N^2) max = 2,3040,000.
      #sensor.set_windowing([0,20,80,40])
      sensor.skip_frames(time = 2000)     # WARNING: If you use QQVGA it may take seconds
      clock = time.clock()  # to process a frame sometimes.
      uart = UART(3, 115200)
      
      while(True):
          clock.tick()
          img = sensor.snapshot().binary([THRESHOLD])
          line = img.get_regression([(100,100,0,0,0,0)], robust = True)
          if (line):
              rho_err = abs(line.rho())-img.width()/2
              if line.theta()>90:
                  theta_err = line.theta()-180
              else:
                  theta_err = line.theta()
              img.draw_line(line.line(), color = 127)
              print(rho_err,line.magnitude(),rho_err)
              if line.magnitude()>8:
                  #if -40<b_err<40 and -30<t_err<30:
                  rho_output = rho_pid.get_pid(rho_err,1)
                  theta_output = theta_pid.get_pid(theta_err,1)
                  output = rho_output+theta_output
                 # output_str="[%d,%d]" % (50+output,50-outpu)
                  uart.write(output)
                  #car.run(50+output, 50-output)
              else:
                  #output_str="[%d,%d]" % (0,0)
                  uart.write("100")
                  #car.run(0,0)
          else:
              #output_str="[%d,%d]" % (50,-50)
              uart.write("99")
              #car.run(50,-50)
              pass
          #print(clock.fps())
      
      
      发布在 OpenMV Cam
      惠
      惠斯
    • 摄像头问题

      运行hello world 图像总是偏红怎么办?

      发布在 OpenMV Cam
      惠
      惠斯
    • 通信问题

      openmv要接受2这个信号,怎么写代码?

      发布在 OpenMV Cam
      惠
      惠斯
    • RE: 怎么能减小灰度图与彩图之间的切换频率?

      @kidswong999 怎么还是不能把彩图转变成灰度图啊

      发布在 OpenMV Cam
      惠
      惠斯
    • RE: 模板识别和颜色识别能串起来一起用吗

      import time, sensor, image
      from image import SEARCH_EX, SEARCH_DS

      Reset sensor

      sensor.reset()

      Set sensor settings

      sensor.set_contrast(1)
      sensor.set_gainceiling(16)

      Max resolution for template matching with SEARCH_EX is QQVGA

      sensor.set_framesize(sensor.QQVGA)

      You can set windowing to reduce the search image.

      #sensor.set_windowing(((640-80)//2, (480-60)//2, 80, 60))
      sensor.set_pixformat(sensor.GRAYSCALE)

      Load template.

      Template should be a small (eg. 32x32 pixels) grayscale image.

      template0 = image.Image("/0.pgm")
      template1 = image.Image("/1.pgm")
      template2 = image.Image("/2.pgm")
      template3 = image.Image("/3.pgm")
      template4 = image.Image("/4.pgm")
      template5 = image.Image("/5.pgm")
      template6 = image.Image("/6.pgm")
      template7 = image.Image("/7.pgm")
      template8 = image.Image("/8.pgm")
      template9 = image.Image("/9.pgm")

      clock = time.clock()

      Run template matching

      while (True):
      clock.tick()
      img = sensor.snapshot()

      # find_template(template, threshold, [roi, step, search])
      # ROI: The region of interest tuple (x, y, w, h).
      # Step: The loop step used (y+=step, x+=step) use a bigger step to make it faster.
      # Search is either image.SEARCH_EX for exhaustive search or image.SEARCH_DS for diamond search
      #
      # Note1: ROI has to be smaller than the image and bigger than the template.
      # Note2: In diamond search, step and ROI are both ignored.
      r0 = img.find_template(template0, 0.70, step=4, search=SEARCH_EX)
      if r0:
          print('0')
      r1 = img.find_template(template1, 0.70, step=4, search=SEARCH_EX) 
      if r1:
          print('1')
      r2 = img.find_template(template2, 0.70, step=4, search=SEARCH_EX)
      if r2:
          print('2')
      r3 = img.find_template(template3, 0.70, step=4, search=SEARCH_EX) 
      if r3:
          print('3')
      r4 = img.find_template(template4, 0.70, step=4, search=SEARCH_EX)
      if r4:
          print('4')
      r5 = img.find_template(template5, 0.70, step=4, search=SEARCH_EX) 
      if r5:
          print('5')
      r6 = img.find_template(template6, 0.70, step=4, search=SEARCH_EX)
      if r6:
          print('6')
      r7 = img.find_template(template7, 0.70, step=4, search=SEARCH_EX) 
      if r7:
          print('7')
      r8 = img.find_template(template8, 0.70, step=4, search=SEARCH_EX) 
      if r8:
          print('8')
      r9 = img.find_template(template9, 0.70, step=4, search=SEARCH_EX) 
      if r9:
          print('9')
      发布在 OpenMV Cam
      惠
      惠斯
    • RE: 模板识别和颜色识别能串起来一起用吗

      0_1533461120482_16.png
      import time, sensor, image
      from image import SEARCH_EX, SEARCH_DS

      Reset sensor

      sensor.reset()

      Set sensor settings

      sensor.set_contrast(1)
      sensor.set_gainceiling(16)

      Max resolution for template matching with SEARCH_EX is QQVGA

      sensor.set_framesize(sensor.QQVGA)

      You can set windowing to reduce the search image.

      #sensor.set_windowing(((640-80)//2, (480-60)//2, 80, 60))
      sensor.set_pixformat(sensor.GRAYSCALE)

      Load template.

      Template should be a small (eg. 32x32 pixels) grayscale image.

      template0 = image.Image("/0.pgm")
      template1 = image.Image("/1.pgm")
      template2 = image.Image("/2.pgm")
      template3 = image.Image("/3.pgm")
      template4 = image.Image("/4.pgm")
      template5 = image.Image("/5.pgm")
      template6 = image.Image("/6.pgm")
      template7 = image.Image("/7.pgm")
      template8 = image.Image("/8.pgm")
      template9 = image.Image("/9.pgm")

      clock = time.clock()

      Run template matching

      while (True):
      clock.tick()
      img = sensor.snapshot()

      # find_template(template, threshold, [roi, step, search])
      # ROI: The region of interest tuple (x, y, w, h).
      # Step: The loop step used (y+=step, x+=step) use a bigger step to make it faster.
      # Search is either image.SEARCH_EX for exhaustive search or image.SEARCH_DS for diamond search
      #
      # Note1: ROI has to be smaller than the image and bigger than the template.
      # Note2: In diamond search, step and ROI are both ignored.
      r0 = img.find_template(0, 0.70, step=4, search=SEARCH_EX)
      if r0:
          print('0')
      r1 = img.find_template(1, 0.70, step=4, search=SEARCH_EX) 
      if r1:
          print('1')
      r2 = img.find_template(2, 0.70, step=4, search=SEARCH_EX)
      if r2:
          print('2')
      r3 = img.find_template(3, 0.70, step=4, search=SEARCH_EX) 
      if r3:
          print('3')
      r4 = img.find_template(4, 0.70, step=4, search=SEARCH_EX)
      if r4:
          print('4')
      r5 = img.find_template(5, 0.70, step=4, search=SEARCH_EX) 
      if r5:
          print('5')
      r6 = img.find_template(6, 0.70, step=4, search=SEARCH_EX)
      if r6:
          print('6')
      r7 = img.find_template(7, 0.70, step=4, search=SEARCH_EX) 
      if r7:
          print('7')
      r8 = img.find_template(8, 0.70, step=4, search=SEARCH_EX) 
      if r8:
          print('8')
      r9 = img.find_template(9, 0.70, step=4, search=SEARCH_EX) 
      if r9:
          print('9')
      发布在 OpenMV Cam
      惠
      惠斯
    • 怎么能减小灰度图与彩图之间的切换频率?

      import sensor, image, math,pyb

      sensor.reset()
      sensor.set_framesize(sensor.QVGA)
      while(True):
      sensor.set_pixformat(sensor.GRAYSCALE)
      for i in range(10):
      img=sensor.snapshot()
      for j in range(100):
      x=(pyb.rng()%(2img.width()))-(img.width()//2)
      y=(pyb.rng()%(2
      img.height()))-(img.height()//2)
      img.set_pixel(x,y,255)
      sensor.set_pixformat(sensor.RGB565)
      for i in range(10):
      img=sensor.snapshot()
      for j in range(100):
      x=(pyb.rng()%(2img.width()))-(img.width()//2)
      y=(pyb.rng()%(2
      img.height()))-(img.height()//2)
      img.set_pixel(255,255,255)

      发布在 OpenMV Cam
      惠
      惠斯
    • 模板识别和颜色识别能串起来一起用吗

      另外想问一下,模板识别想识别0到9,但是它会报错,说是请降低像素,减少在运行的数量,降低像素还是不能解决。最后减少了3个数字它才能正常的运行,这怎么解决?

      发布在 OpenMV Cam
      惠
      惠斯
    • 数字识别问题

      0_1533371274647_15.png

      这怎么解决

      发布在 OpenMV Cam
      惠
      惠斯
    • 关于摄像头的问题

      刚识别完红色,继续识别其他东西,结果整个画面偏红,这怎么办?(运行的是示例中的single_color_rgb565_blob_tracking.py)

      发布在 OpenMV Cam
      惠
      惠斯
    • oserror:couldn't find the file?

      0_1533279467266_13.png

      发布在 OpenMV Cam
      惠
      惠斯
    • 这个怎么解决?

      0_1533276100538_12.png

      发布在 OpenMV Cam
      惠
      惠斯
    • openmv能识别手写数字吗?

      想用openmv识别手写数字,有大佬有相关代码吗?

      发布在 OpenMV Cam
      惠
      惠斯