导航

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

    vfgn

    @vfgn

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

    vfgn 关注

    vfgn 发布的帖子

    • IMU拓展板的零偏问题

      IMU拓展板,加速度计和陀螺仪的零偏是多少,还是在输出的时候已经包含进去了

      发布在 OpenMV Cam
      V
      vfgn
    • openmv逐行和逐列进行扫描像素点

      openmv可以实现指定逐行和逐列进行扫描像素点吗,或者是从指定的位置开始自定义扫描

      发布在 OpenMV Cam
      V
      vfgn
    • RE: 二值化观察闪烁的LED,但像素不停取反,怎么办?

      @kidswong999 这是自己截的图,主要原因是黑色和白色反复颠倒,焦距也在一直变,是哪里的问题

      发布在 OpenMV Cam
      V
      vfgn
    • 二值化观察闪烁的LED,但像素不停取反,怎么办?
      import pyb,sensor, image, time
      
      sensor.reset()
      sensor.set_framesize(sensor.QQVGA)
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.set_auto_whitebal(False)
      
      low_threshold = (0, 80)
      high_threshold = (180, 255)
      
      
      # 灰度二值化
      
      while(True):
          # 测试低阈值
          for i in range(100):
              img = sensor.snapshot()
              img.binary([low_threshold])
              #img.binary(thresholds, invert=False)此函数将在thresholds内的
              #图像部分的全部像素变为1白,将在阈值外的部分全部像素变为0黑。invert将图像
              #的0 1(黑 白)进行反转,默认为false不反转。
      
          # 测试高阈值
          for i in range(100):
              img = sensor.snapshot()
              img.binary([high_threshold])
          #测试不是低阈值
          for i in range(100):
              img = sensor.snapshot()
              img.binary([low_threshold], invert = 1)
          # Test not high threshold
          #测试不是高阈值
          for i in range(100):
              img = sensor.snapshot()
              img.binary([high_threshold], invert = 1)
      
      
      #腐蚀膨胀
      #设置阈值
      grayscale_thres = (230, 255)
      rgb565_thres = (70, 100, -128, 127, -128, 127)
      
      while(True):
      
          sensor.set_pixformat(sensor.GRAYSCALE)
          for i in range(20):
              img = sensor.snapshot()
              img.binary([grayscale_thres])
              img.dilate(2)
              #对图像边缘进行膨胀,膨胀函数image.dilate(size, threshold=Auto),size为
              #kernal的大小,使边缘膨胀。threshold用来设置去除相邻点的个数,threshold数值
              #越大,边缘越膨胀;
              #数值越小,边缘膨胀的小。
          for i in range(20):
              img = sensor.snapshot()
              #先对图像进行分割,二值化,将在阈值内的区域变为白色,阈值外区域变为黑色
              img.binary([grayscale_thres])
              #对图像边缘进行侵蚀,侵蚀函数erode(size, threshold=Auto),size为
              #kernal的大小,去除边缘相邻处多余的点。threshold用来设置去除相邻点的个数,
              #threshold数值越大,被侵蚀掉的边缘点越多,边缘旁边白色杂点少;数值越小,
              #被侵蚀掉的边缘点越少,边缘旁边的白色杂点越多。
              img.erode(2)
          sensor.set_pixformat(sensor.RGB565)
          for i in range(20):
              img = sensor.snapshot()
              img.binary([rgb565_thres])
              img.erode(30)
          for i in range(20):
              img = sensor.snapshot()
              img.binary([rgb565_thres])
              img.dilate(2)
      
      
      sensor.skip_frames(time = 2000)
      clock = time.clock()
      while(True):
          clock.tick()
      
          img = sensor.snapshot().lens_corr(strength = 1.8, zoom = 1.0)
      
          print(clock.fps())
      
      

      1_1693298665655_QQ图片20230829164408.png 0_1693298665654_QQ图片20230829164403.png

      发布在 OpenMV Cam
      V
      vfgn