导航

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

    5w2a

    @5w2a

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

    5w2a 关注

    5w2a 发布的帖子

    • RE: 字体显示不出来,只有一个框框

      。。。。好的吧。谢谢!
      ’

      发布在 OpenMV Cam
      5
      5w2a
    • 字体显示不出来,只有一个框框
      # 在图像上使用morph函数来进行边缘检测。
      # 然后在进行阈值和核滤波
      # 最后进行特征点检测
      import sensor, image, time,lcd
      
      #设置核函数滤波,核内每个数值值域为[-128,127],核需为列表或元组
      kernel_size = 1 # kernel width = (size*2)+1, kernel height = (size*2)+1
      kernel = [-1, -1, -1,\
                -1, +8, -1,\
                -1, -1, -1]
      # 这个一个高通滤波器。见这里有更多的kernel
      # http://www.fmwconcepts.com/imagemagick/digital_image_filtering.pdf
      thresholds = [(100, 255)]   # grayscale thresholds设置阈值
      
      sensor.reset() # 初始化 sensor.
      sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565
      sensor.set_framesize(sensor.QVGA) # or sensor.QVGA (or others)
      sensor.skip_frames(10) # 让新的设置生效
      lcd.init()
      clock = time.clock() # 追踪FPS
      
      # 在OV7725 sensor上, 边缘检测可以通过设置sharpness/edge寄存器来增强。
      # 注意:这个会edge detection can be enhanced
      # significantly by setting the sharpness/edge registers.
      # Note: This will be implemented as a function later.
      if (sensor.get_id() == sensor.OV7725):
          sensor.__write_reg(0xAC, 0xDF)           #在address(int)向相机寄存器中写入value(int)
          sensor.__write_reg(0x8F, 0xFF)           #在address(int)上读取摄像头数据表
      
      kpts1 = image.load_descriptor("/desc.orb")
      
      while(True):
          clock.tick() # Track elapsed milliseconds between snapshots().
          img = sensor.snapshot() # Take a picture and return the image.
      
          img.morph(kernel_size, kernel)
          #morph(size, kernel, mul=Auto, add=0),morph变换,mul根据图像对比度
          #进行调整,mul使图像每个像素乘mul;add根据明暗度调整,使得每个像素值加上add值。
          #如果不设置则不对morph变换后的图像进行处理。
          img.binary(thresholds)
          #利用binary函数对图像进行分割
      
          # Erode pixels with less than 2 neighbors using a 3x3 image kernel
          img.erode(1, threshold = 2)
          #侵蚀函数erode(size, threshold=Auto),去除边缘相邻处多余的点。threshold
          #用来设置去除相邻点的个数,threshold数值越大,被侵蚀掉的边缘点越多,边缘旁边
          #白色杂点少;数值越小,被侵蚀掉的边缘点越少,边缘旁边的白色杂点越多。
      
          kpts2 = img.find_keypoints(max_keypoints=150, threshold=10, normalized=True)
          #如果检测到特征物体
          if (kpts2):
              #匹配当前找到的特征和最初的目标特征的相似度
              match = image.match_descriptor(kpts1, kpts2, threshold=85)
              #image.match_descriptor(descritor0, descriptor1, threshold=70, filter_outliers=False)。
              #本函数返回kptmatch对象。
              #threshold阈值设置匹配的准确度,用来过滤掉有歧义的匹配。这个值越小,准确度越高。阈值范围0~100,默认70
              #filter_outliers默认关闭。
      
              #match.count()是kpt1和kpt2的匹配的近似特征点数目。
              #如果大于10,证明两个特征相似,匹配成功。
              if (match.count()>25):
              # If we have at least n "good matches"
              # Draw bounding rectangle and cross.
              #在匹配到的目标特征中心画十字和矩形框。
                  img.draw_rectangle(match.rect())
                  img.draw_cross(match.cx(), match.cy(), size=10)
                  res=img.draw_string(100,100,'合格',color=255,scale=5,x_spacing=2)
                  lcd.display(res)
              else:
                  res=img.draw_string(100,120,'不合格',color=255,scale=5,x_spacing=2)
                  lcd.display(res)
                      #match.theta()是匹配到的特征物体相对目标物体的旋转角度。
              print(kpts2, "matched:%d dt:%d"%(match.count(), match.theta()))
                      #不建议draw_keypoints画出特征角点。
                      # NOTE: uncomment if you want to draw the keypoints
                      #img.draw_keypoints(kpts2, size=KEYPOINTS_SIZE, matched=True)
          print(clock.fps())
      
      
      
      

      0_1547040284717_字体.png

      发布在 OpenMV Cam
      5
      5w2a
    • 如何调整字体在lcd上的大小

      如何调整字体在lcd上的大小?只能是8×10像素?怎么放大?

      发布在 OpenMV Cam
      5
      5w2a
    • RE: 运动拍摄和特征点保存

      有一个例子是拍摄运动物体嘛,怎么结合使用?

      发布在 OpenMV Cam
      5
      5w2a
    • 运动拍摄和特征点保存

      怎么用运动拍摄后的图片进行特征点保存然后特征点检测?

      发布在 OpenMV Cam
      5
      5w2a
    • 特征点检测问题

      怎么用边缘检测后的图像进行特征点检测?

      发布在 OpenMV Cam
      5
      5w2a
    • RE: 请问一下,可以用边缘检测后再用模板匹配(或特征点检测)吗?

      @kidswong999 那个特征点检测是先进行特征点保存然后再匹配吗?

      发布在 OpenMV Cam
      5
      5w2a