导航

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

    17826808312 发布的帖子

    • 如何用边缘检测算法进行检测

      0_1565188910713_5e34c7529999a3258ccff002c13dffc.png
      这是我二值化以后的图像,请问可以用边缘检测算法检测出格子里面的圆吗,如果可以的话,应该怎么做呢

      发布在 OpenMV Cam
      1
      17826808312
    • 老师,我想获取二值化图像中某一块区域内所有白色像素点的个数的和,也就是像素点的总数

      回复: 请问如何统计二值化图像的白色像素点
      我看到可以用statistics来进行统计的,但是它只有灰度值的平均数、众数这些并没有我要的像素点的总数,请问还有其他方法吗?

      发布在 OpenMV Cam
      1
      17826808312
    • 摄像头反光太严重怎么办

      要识别的物体因为灯光原因,反光比较严重,如何去除图像中的反光

      发布在 OpenMV Cam
      1
      17826808312
    • 如何计算圆到openmv的距离

      老师,请问openmv识别到的圆可以通过返回的圆相对于镜头的坐标c.x()和c.y()来计算圆到镜头的距离吗?我知道apriltag标签是可以的,它有返回x,y,z三个方向上的坐标,但是圆只有x和y,没有z,想知道是否可以计算出距离呢?

      发布在 OpenMV Cam
      1
      17826808312
    • 如何把想要的roi区域用矩形框给框起来?

      老师理论上可以用画矩形的这个函数把我想要的roi区域给框起来吗?我试了下面这个报错了。。

      img.draw_rectangle(roi=(0,000,160,80), color = (0, 255, 0))
      
      发布在 OpenMV Cam
      1
      17826808312
    • RE: 如何截取需要的图像?

      @kidswong999 老师理论上可以用画矩形的这个函数把我想要的roi区域给框起来吗?我试了下面这个报错了。。

      img.draw_rectangle(roi=(0,000,160,80), color = (0, 255, 0))
      
      发布在 OpenMV Cam
      1
      17826808312
    • RE: 如何截取需要的图像?

      @kidswong999 老师你看一下,为什么我这边的ROI不起作用,是程序写得不对吗?

      import sensor, image, time, math
      ROI = [(50,100,50,80)]
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA) # we run out of memory if the resolution is much bigger...
      sensor.skip_frames(time = 2000)
      sensor.set_auto_gain(False)  # must turn this off to prevent image washout...
      sensor.set_auto_whitebal(False)  # must turn this off to prevent image washout...
      clock = time.clock()
      
      tag_families = 0
      tag_families |= image.TAG16H5 # comment out to disable this family
      tag_families |= image.TAG25H7 # comment out to disable this family
      tag_families |= image.TAG25H9 # comment out to disable this family
      tag_families |= image.TAG36H10 # comment out to disable this family
      tag_families |= image.TAG36H11 # comment out to disable this family (default family)
      tag_families |= image.ARTOOLKIT # comment out to disable this family
      
      def family_name(tag):
          if(tag.family() == image.TAG16H5):
              return "TAG16H5"
          if(tag.family() == image.TAG25H7):
              return "TAG25H7"
          if(tag.family() == image.TAG25H9):
              return "TAG25H9"
          if(tag.family() == image.TAG36H10):
              return "TAG36H10"
          if(tag.family() == image.TAG36H11):
              return "TAG36H11"
          if(tag.family() == image.ARTOOLKIT):
              return "ARTOOLKIT"
      
      for t in ROI:    
          while(True):
              clock.tick()
              img = sensor.snapshot()
              for tag in img.find_apriltags(families=tag_families): # defaults to TAG36H11 without "families".
                  img.draw_rectangle(tag.rect(), color = (255, 0, 0))
                  img.draw_cross(tag.cx(), tag.cy(), color = (0, 255, 0))
                  print_args = (family_name(tag), tag.id(), (180 * tag.rotation()) / math.pi)
                  print("Tag Family %s, Tag ID %d, rotation %f (degrees)" % print_args)
              print(clock.fps())
      
      
      发布在 OpenMV Cam
      1
      17826808312
    • RE: 如何截取需要的图像?

      @kidswong999 有获取矩形ROI区域的例程吗?

      发布在 OpenMV Cam
      1
      17826808312
    • RE: 如何截取需要的图像?

      有没有现有的例程啊?

      发布在 OpenMV Cam
      1
      17826808312
    • 如何截取需要的图像?

      老师问一下有没有什么方法能够只截取我下图中红色框中的图像,让openmv只对红框中的图像内容进行各种识别呢?是用roi还是其他什么?
      0_1562512602733_微信图片_20190707231301.jpg

      发布在 OpenMV Cam
      1
      17826808312
    • 代码不起作用是为什么?

      老师问一下,我这边代码最后一个else不起作用是为什么?

      import sensor, image, time
      from pyb import UART
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565) # grayscale is faster
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(time = 2000)
      clock = time.clock()
      
      uart = UART(4, 115200)
      
      while(True):
          clock.tick()
          if uart.any():
              a = uart.read().decode()
              b = int(a)-8
              img = sensor.snapshot().lens_corr(1.8)
              for c in img.find_circles(threshold = 3500, x_margin = 10, y_margin = 10, r_margin = 10,r_min = 2, r_max = 100, r_step = 2):
                  img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))
                  if c:
                      output_str="[%d]" % (b)
                      uart.write(output_str+'\r\n')
                  else:
                      output_str="[%d]" % (0)
                      uart.write(output_str+'\r\n')
      
      发布在 OpenMV Cam
      1
      17826808312
    • RE: 如何编写程序才能让openmv同时识别apriltag和圆形?

      @kidswong999 老师我改了缩进以后可以同时识别tag标签和圆形了,但是出来的图像一抖一抖的是为什么

      发布在 OpenMV Cam
      1
      17826808312
    • RE: 如何编写程序才能让openmv同时识别apriltag和圆形?

      老师我都是用一个tab缩进的,是这样缩进有问题吗

      发布在 OpenMV Cam
      1
      17826808312
    • 接收不到数据是为什么?

      为什么在识别圆形的程序后面加上一个串口接收数据的程序,我向openmv发送了66,77这两个数据,符合if中的条件判断,但串口调试助手上收不到我想要openmv发送的这个数据2呢?是程序有问题吗?

      import sensor, image, time
      from pyb import UART
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565) # grayscale is faster
      sensor.set_framesize(sensor.QQVGA)
      sensor.skip_frames(time = 2000)
      clock = time.clock()
      
      while(True):
          clock.tick()
          img = sensor.snapshot().lens_corr(1.8)
          for c in img.find_circles(threshold = 3500, x_margin = 10, y_margin = 10, r_margin = 10,r_min = 2, r_max = 100, r_step = 2):
              img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))
              uart = UART(3, 115200)
              if uart.any():
                  a = uart.read().decode().split(',')
                  x = int(a[0])
                  y = int(a[1])
                  if 50<x<100&50<y<100:
                      t = 2
                      output_str="[%d]" % (t)
                      uart.write(output_str+'\r\n')
      
      发布在 OpenMV Cam
      1
      17826808312
    • 如何编写程序才能让openmv同时识别apriltag和圆形?

      请问如何编写程序才能让openmv同时识别apriltag和圆形?我把识别圆形的程序放到识别apriltag的程序后面,在openmv的视野中没有apriltag只有圆形的情况下,发现识别不了圆形。

      import sensor, image, time, math
      from pyb import UART
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QQVGA) # we run out of memory if the resolution is much bigger...
      sensor.skip_frames(30)
      sensor.set_auto_gain(False)  # must turn this off to prevent image washout...
      sensor.set_auto_whitebal(False)  # must turn this off to prevent image washout...
      clock = time.clock()
      
      
      f_x = (2.8 / 3.984) * 160 # 默认值
      f_y = (2.8 / 2.952) * 120 # 默认值
      c_x = 160 * 0.5 # 默认值(image.w * 0.5)
      c_y = 120 * 0.5 # 默认值(image.h * 0.5)
      
      def degrees(radians):
          return (180 * radians) / math.pi
      
      while(True):
          clock.tick()
          img = sensor.snapshot()
          for tag in img.find_apriltags(families=image.TAG25H9, fx=f_x, fy=f_y, cx=c_x, cy=c_y): # 默认为TAG36H11
              img.draw_rectangle(tag.rect(), color = (255, 0, 0))
              img.draw_cross(tag.cx(), tag.cy(), color = (0, 255, 0))
              degress = tag.rotation()
              print_args = (tag.x_translation(), tag.y_translation(), tag.z_translation(), \
                  degrees(tag.x_rotation()), degrees(tag.y_rotation()), degrees(tag.z_rotation()))
              # 位置的单位是未知的,旋转的单位是角度
              #print("Tx: %f, Ty %f, Tz %f, Rx %f, Ry %f, Rz %f" % print_args)
              #print(tag.id(),degress)
              x = 0
              y = 0
              def tag_id(t):
                  global x
                  global y
                  if (t == 0):
                      x = 27.5
                      y = 27.5
                  elif (t == 1):
                      x = 127.5
                      y = 27.5
                  elif (t == 2):
                      x = 227.5
                      y = 27.5
              tag_id(tag.id())
              o = tag.x_translation()
              p = tag.y_translation()
              q = tag.z_translation()
              a = o*o + p*p + q*q
              k = 30
              b = k*math.sqrt(a)
              c = b*b-10*10
              d = math.sqrt(c)
              #print(d)
              α = tag.rotation()
              if 0 < α < math.pi/2:
                 m = x - d*math.sin(α)
                 n = y + d*math.cos(α)
              if 3*math.pi/2 < α < 2*math.pi:
                 m = x + d*math.sin(360-α)
                 n = y + d*math.cos(360-α)
              if math.pi/2 < α < math.pi:
                 m = x - d*math.sin(180-α)
                 n = y - d*math.cos(180-α)
              if math.pi < α < 3*math.pi/2:
                 m = x + d*math.sin(α-180)
                 n = y - d*math.cos(α-180)
              #print(m, n)
              uart = UART(3, 115200)
              #output_str="[%d%03d%03d%03d]" % (1,m,n,α)
              #uart.write(output_str+'\r\n')
              time.sleep(100)
              img = sensor.snapshot().lens_corr(1.8)
              for c in img.find_circles(threshold = 3500, x_margin = 10, y_margin = 10, r_margin = 10,r_min = 2, r_max = 100, r_step = 2):
                 img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))
                 print(c)
      
      发布在 OpenMV Cam
      1
      17826808312