导航

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

    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
    • RE: 如何识别最大的色块,并返回最大色块的颜色?

      代码总是返回三种颜色合成色块的集合,code返回的数不是1、2、4..而是5、7等等的集合,该怎么修改呢?

      发布在 OpenMV Cam
      T
      tree_18
    • 如何识别最大的色块,并返回最大色块的颜色?
      import sensor, image, time
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      
      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), # 红色
                    (27, 90, -3, -28, 31, 125),# 绿色
                    (0, 30, -20, 30, -40, 50)]  # 蓝色
      
      threshold = [50, 50, 0, 0, 0, 0] # Middle L, A, B values.
      clock = time.clock()
      
      while(True):
       #   clock.tick()
          img = sensor.snapshot()
         # for blob in img.find_blobs(thresholds, pixels_threshold=10, area_threshold=10):
          blobs = img.find_blobs(thresholds, pixels_threshold=20, area_threshold=20, merge=True)
          if blobs:
              max_blob=find_max(blobs )
              print(max_blob.code())
              for blob in blobs:
                  if blob.code():
                      img.draw_cross(blob.cx(), blob.cy())
                      img.draw_rectangle(blob.rect())
      

      我的代码是这样的,识别红绿蓝,并返回最大色块的颜色,请问blob.code()返回的是各个颜色的标号吗,默认值是多少?

      发布在 OpenMV Cam
      T
      tree_18
    • object ‘int’ is not a tuple or list?
      
      import sensor, image, time
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      
      thresholds = [(27, 67, 19, 91, 45, 76), # 红色
                    (27, 90, -3, -28, 31, 125),# 绿色
                    (0, 30, -20, 30, -40, 50)]  # 蓝色
      
      clock = time.clock()
      
      while(True):
          clock.tick()
          img = sensor.snapshot()
          blobs = img.find_blobs(thresholds[0], pixels_threshold=10, area_threshold=10)
          if blobs.count():
              max_blob=find_max(blobs)
              print(max_blob.code())
          print(clock.fps())
      
      

      好像在 blobs = img.find_blobs(thresholds[0], pixels_threshold=10, area_threshold=10)这行出的错

      发布在 OpenMV Cam
      T
      tree_18
    • 单片机串口大量的发送数据给openmv会出现超时none的现象?

      我在单片机的while(1)中只干一件事,反复的发送字符给openmv,那么openmv会处理不了这样大量的数据而超时返回none马?

      发布在 OpenMV Cam
      T
      tree_18
    • openmv巡线程序如何快速得到直线角度?

      0_1525077839149_寻迹1.PNG

      教程给出的程序 从初始画面(图一)到输出直线角度(图二)要经历十几秒。有什么方法可以让他从初始画面快速(几秒内)就输出直线角度?

      发布在 OpenMV Cam
      T
      tree_18
    • openmv如何识别特定的人体姿势?用到哪方面知识?

      openmv如何识别出坐姿不端正的情况呢?需要用到例程中的哪方面的知识?特征检测?
      不追求准确度,有什么快速的识别方法吗?

      发布在 OpenMV Cam
      T
      tree_18
    • python里有不会堵塞程序的延时函数吗?

      比如说 我想每1秒打印一个a 但在这1秒里希望程序接着执行 只是说每过1秒就打印a 不会堵塞函数。

      发布在 OpenMV Cam
      T
      tree_18
    • 怎样使用同目录下的py文件?

      0_1524303262184_PID2.PNG 0_1524303264511_PID.PNG

      这里提示报错 我放在同个目录下了

      发布在 OpenMV Cam
      T
      tree_18
    • RE: 如何得到此类效果图

      恩恩 其实我是想知道怎么得到画圈的那个窗口 意思是说在哪里打开红圈所示的窗口

      发布在 OpenMV Cam
      T
      tree_18