导航

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

    odwv

    @odwv

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

    odwv 关注

    odwv 发布的帖子

    • 寻找矩形的函数无法使用roi,怎么处理?

      加上roi的话,openmv会和电脑断开连接

      img = sensor.snapshot().lens_corr(1.8)
      for r in img.find_rects(threshold = 10000):
      
      发布在 OpenMV Cam
      O
      odwv
    • 代码运行时,图象十分卡顿,怎么处理?

      一个用于形状及颜色识别和物块分拣的程序,运行时画面很卡

      # Untitled - By: 41312 - 周四 1月 21 2021
      
      import pyb
      import sensor, image, time,pyb
      from pyb import Servo
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565) # grayscale is faster
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False)
      sensor.set_auto_whitebal(False)
      clock = time.clock()
      
      L = 2500
      M = 1500
      R = 500
      s1 = Servo(1)#上料
      s2 = Servo(2)#左右分拣
      s3 = Servo(3)#向下分拣
      theresholds = (0, 100, -74, -21, -124, 127)#颜色阈值
      
      s1.pulse_width(L)#Initialize
      def shangliao() :                   #上料
          s1.pulse_width(M)
          pyb.delay(500)
          s1.pulse_width(L)
          pyb.delay(500)
      
      def xiafenjian():                   #控制圆盘
          s3.pulse_width(M)
          pyb.delay(500)
          s3.pulse_width(60)
      
      def zuofenjian():                   #左分拣
          s2.pulse_width(L)
          pyb.delay(500)
          s2.pulse_width(M)
      
      def youfenjian():                   #右分拣
          s2.pulse_width(R)
          pyb.delay(500)
          s2.pulse_width(M)
      
      def ShiBieColor():                  #识别颜色
          pass
      def circlefind() :                  #识别圆形
          #lens_corr(1.8)畸变矫正
          n=0
          m=0
          img = sensor.snapshot().lens_corr(1.8)
          for c in img.find_circles(threshold = 3200, x_margin = 10, y_margin = 10, r_margin = 10,
          r_min = 2, r_max = 100, r_step = 2):
              area = (c.x()-c.r(),c.y()-c.r(),2*c.r(),2*c.r())
              statistics = img.get_statistics(roi=area)
              print(statistics)
              #(0,100,0,120,0,120)是红色的阈值,所以当区域内的众数(也就是最多的颜色),范围在这个阈值内,就说明是红色的圆。
                     #l_mode(),a_mode(),b_mode()是L通道,A通道,B通道的众数。
              if 0<statistics.l_mode()<100 and 0<statistics.a_mode()<127 and 0<statistics.b_mode()<127:#if the circle is red
                  img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))
              
                  n+=1
              else:
                  m+=1
              if n>=3 :
      
                  return 1
              if m>=3 :
                  return 0
      
      def rectfind() :                    #识别矩形
          n=0
          c=0
          img = sensor.snapshot().lens_corr(1.8)
          for r in img.find_rects(threshold = 25000):
              area = (r.rect())
              statistics = img.get_statistics(roi=area)
              print(statistics)
              if 0<statistics.l_mode()<100 and 0<statistics.a_mode()<127 and 0<statistics.b_mode()<127:#if the retangle is red
              
                  img.draw_rectangle(r.rect(),color =(0,0,0))
              
                  n+=1
              else :
                  c+=1
              if n>=3 :
      
                  return 1
              if c>=3 :
                  return 0
      
      def shibie() :
          c = circlefind()
          r = rectfind()
          if c==1 :
              return 1
          elif r==1 :
              return 2
          else:
              return 3
      
      
      
      while(True):
      
          clock.tick()
          shangliao()
          pyb.delay(200)
          Value = shibie()
          if(Value == 1) :
              xiafenjian()
          elif(Value == 2):
              zuofenjian()
          else:
              youfenjian
          pyb.delay(1500)
      
      
      发布在 OpenMV Cam
      O
      odwv
    • 使用畸变矫正后,图象显示还是鱼眼状,是什么情况?

      使用畸变矫正后,图象显示还是鱼眼状,是什么情况?

      发布在 OpenMV Cam
      O
      odwv
    • RE: 舵机在正常情况下能够转160°左右,但是用openmv只能转60°左右,为什么?

      @kidswong999 0_1611838062628_03ca9bea-c7f8-4d72-a579-ea64fb061782-image.png
      使用这个函数会出现图示错误

      发布在 OpenMV Cam
      O
      odwv
    • RE: 舵机在正常情况下能够转160°左右,但是用openmv只能转60°左右,为什么?

      这个视频里也没讲怎么设置脉宽啊,使用s1.pluse_width()最小也不能转到零度是怎么回事。s1.pluse_width()能使舵机转170度左右但是s1.angle()不能是为什么。还有教程里用的time.sleep不能用是怎么回事

      发布在 OpenMV Cam
      O
      odwv
    • 舵机在正常情况下能够转160°左右,但是用openmv只能转60°左右,为什么?
      import time
      import pyb
      from pyb import Servo
      s1 = Servo(1)
      while(1):
          s1.angle(-180)
          pyb.delay(2000)
          s1.angle(180)
          pyb.delay(2000)
      
      发布在 OpenMV Cam
      O
      odwv