导航

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

    tree_18

    @tree_18

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

    tree_18 关注

    tree_18 发布的帖子

    • 拍摄语句后面的if与else是什么意思?

      鲁棒线性回归例程

      这个例子展示了如何在OpenMV Cam上使用get_regression()方法来获得

      ROI的线性回归。 使用这种方法,你可以轻松地建立一个机器人,它可以

      跟踪所有指向相同的总方向但实际上没有连接的线。 在线路上使用

      find_blobs(),以便更好地过滤选项和控制。

      #我们在这个脚本中使用get_regression()的robust = True参数,该脚本使用更稳健的算法计算线性回归...但是可能慢得多。 鲁棒算法在图像上运行O(N ^ 2)时间。 所以,你需要限制像素的数量来使这个算法工作,它可能实际需要秒的时间给你一个结果...非常小心!

      THRESHOLD = (0, 100) # Grayscale threshold for dark things...
      BINARY_VISIBLE = True # 首先二值化,所以你可以看到什么线性回归正在
      # 运行...虽然可能会降低FPS。
      import sensor, image, time

      sensor.reset()
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.set_framesize(sensor.QQQVGA) # 80x60 (4,800 pixels) - O(N^2) max = 2,3040,000.
      sensor.skip_frames(time = 2000) # WARNING: If you use QQVGA it may take seconds
      clock = time.clock() # to process a frame sometimes.

      while(True):
      clock.tick()
      img = sensor.snapshot().binary([THRESHOLD]) if BINARY_VISIBLE else sensor.snapshot()

      # 返回类似于由find_lines()和find_line_segments()返回的线对象。 
      # 你有x1(),y1(),x2(),y2(),length(),
      # theta()(以度为单位的旋转),rho()和magnitude()。
      #
      # magnitude() 表示线性回归的工作情况。这对于鲁棒的线性回归意味着不同
      # 的东西。一般来说,值越大越好...
      line = img.get_regression([(255,255) if BINARY_VISIBLE else THRESHOLD], robust = True)
      
      if (line): img.draw_line(line.line(), color = 127)
      print("FPS %f, mag = %s" % (clock.fps(), str(line.magnitude()) if (line) else "N/A"))
      

      About negative rho values:

      A [theta+0:-rho] tuple is the same as [theta+180:+rho].

      0_1566633384889_捕获.JPG

      红线处的执行对前面有什么影响吗?

      发布在 OpenMV Cam
      T
      tree_18
    • RE: 怎样实现Python与c的转化以及调用?

      @kidswong999 他的意思是在python中调用C语言的函数或文件

      发布在 OpenMV Cam
      T
      tree_18
    • 广角摄像头会增加分辨率吗?

      装上广角摄像头是物理上增大视野,一张图片的分辨率还是一样是吗?

      发布在 OpenMV Cam
      T
      tree_18
    • openmv dfu枚举的过程会有怎样的现象?

      我的openmv变砖了,跟着ide的提示去做,断开连接后连接boot和rst ,然后重新连接等待dfu枚举,那么dfu枚举过程中会有怎样的现象?我不知道怎样才算枚举完成直接按了确定,然后一直在编程中。。。。0_1566034879507_捕获.JPG

      发布在 OpenMV Cam
      T
      tree_18
    • RE: 颜色识别时摄像头总是偏红色怎么办?

      @kidswong999 恩恩,运行了,这样没解决呀🤔

      发布在 OpenMV Cam
      T
      tree_18
    • 颜色识别时摄像头总是偏红色怎么办?
      
      import sensor, image, time, sys
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False) # must be turned off for color tracking
      sensor.set_auto_whitebal(False) # must be turned off for color tracking
      
      #sensor.set_auto_exposure(False, 500)#这里设置曝光时间
      
      Max_dict={'R':0,'G':0,'B':0}
      def find_max(blobs):
          max_size=0
          for blob in blobs:
              if blob.pixels() > max_size:
                  max_blob=blob
                  max_size = blob.pixels()
          return max_blob
      
      thresholds = [(100, 0, -32, 6, -128, 127), # 红色
                    (58, 100, -2, 127, -11, 21),# 绿色
                    (100, 9, -49, 19, 12, 67)]  # 蓝色
      
      clock = time.clock()
      
      
      Curr_number=0
      while(Curr_number<20):
          clock.tick()
          img = sensor.snapshot()
          for i in range(3):
              blobs = img.find_blobs([thresholds[i]], pixels_threshold=30, area_threshold=30, merge=True)
              if blobs:
                  max_blob_sum=find_max(blobs).pixels()
                  if i==0:
                      Max_dict['R']=max_blob_sum
                  elif i==1:
                      Max_dict['G']=max_blob_sum
                  elif i==2:
                      Max_dict['B']=max_blob_sum
                  '''
                  for blob in blobs:
                      if blob.code():
                          img.draw_cross(blob.cx(), blob.cy())
                          img.draw_rectangle(blob.rect())
                  '''
          Curr_number+=1
      
          print(clock.fps())
      #(Max_dict, key=Max_dict.get()  #出错 未解决
      print(Max_dict)
      print(max(Max_dict, key=lambda k: Max_dict[k]))
      
      

      我已经关闭了白平衡之类的东西了。我下面垫的是纯正的A4白纸,很明显偏红!
      0_1563977371298_op3.JPG
      0_1563977406784_op4.JPG

      发布在 OpenMV Cam
      T
      tree_18
    • python字典语法中的有些方法用不了的问题?
      # Untitled - By: TREE - 周三 7月 24 2019
      
      import sensor, image, time, sys
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      
      Max_dict={'R':0,'G':0,'B':0}
      def find_max(blobs):
          max_size=0
          for blob in blobs:
              if blob.pixels() > max_size:
                  max_blob=blob
                  max_size = blob.pixels()
          return max_blob
      
      thresholds = [(27, 67, 19, 91, 45, 76), # 红色
                    (58, 100, -2, 127, -11, 21),# 绿色
                    (0, 30, -20, 30, -40, 50)]  # 蓝色
      
      threshold = [50, 50, 0, 0, 0, 0] # Middle L, A, B values.
      clock = time.clock()
      
      
      Curr_number=0
      while(Curr_number<20):
       #   clock.tick()
          img = sensor.snapshot()
          for i in range(3):
              blobs = img.find_blobs([thresholds[i]], pixels_threshold=30, area_threshold=30, merge=True)
              if blobs:
                  max_blob_sum=find_max(blobs).pixels()
                  if i==0:
                      Max_dict['R']=max_blob_sum
                  elif i==1:
                      Max_dict['G']=max_blob_sum
                  elif i==2:
                      Max_dict['G']=max_blob_sum
                  for blob in blobs:
                      if blob.code():
                          img.draw_cross(blob.cx(), blob.cy())
                          img.draw_rectangle(blob.rect())
          Curr_number+=1
      
       #   print(clock.fps())
      max(Max_dict, key=Max_dict.get())
      
      

      我想把找到的最大色块的面积放在字典中,然后比较大小,最后得出最大的面积的颜色的键值。
      问题在于openmv好像没有字典语法的一些函数或者方法,是因为没import某些库吗?
      2_1563973754682_op2.jpg 1_1563973754682_op1.JPG 0_1563973754679_op.JPG

      get方法知识lcd库的,不是python字典语法的方法

      发布在 OpenMV Cam
      T
      tree_18