导航

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

    phmi

    @phmi

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

    phmi 关注

    phmi 发布的帖子

    • RE: 请问为什么灰度图像的二值化后图像与RGB图像二值化后图像的大小不一?

      RGB图像代码:

      import sensor, image, time
      
      sensor.reset()
      sensor.set_framesize(sensor.QVGA)
      sensor.set_pixformat(sensor.RGB565)
      sensor.skip_frames(time = 2000)
      clock = time.clock()
      
      # Use the Tools -> Machine Vision -> Threshold Edtor to pick better thresholds.
      threshold_dark = (70, 100, -77, 76, 19, 74)
      gray_threshold = (80, 255)
      
      
      while(True):
          clock.tick()
          img = sensor.snapshot()
          img.binary([threshold_dark])
          # img.erode(100)
          # img.dilate(5)
          print(img)
      
      

      灰度值图像代码

      # Color Binary Filter Example
      #
      # This script shows off the binary image filter. You may pass binary any
      # number of thresholds to segment the image by.
      
      import sensor, image, time
      
      sensor.reset()
      sensor.set_framesize(sensor.QVGA)
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.skip_frames(time = 2000)
      sensor.set_auto_whitebal(True)  # 开启自动白平衡
      clock = time.clock()
      
      # Use the Tools -> Machine Vision -> Threshold Edtor to pick better thresholds.
      threshold_dark = (70, 100, -77, 76, 19, 74)
      threshold_light = (86, 100, -26, 8, -3, 45)
      gray_threshold = (80, 255)
      
      
      while(True):
          clock.tick()
          img = sensor.snapshot()
          img.binary([gray_threshold])
          # img.erode(100)
          # img.dilate(5)
          print(img)
      
      
      
      发布在 OpenMV Cam
      phmi
    • 请问为什么灰度图像的二值化后图像与RGB图像二值化后图像的大小不一?

      如图所示,当Image是灰度图的时候使用阈值二值化得到的图像只有一个图层,图像大小是正确的;但是当image为RGB的时候生成的图像就有两个图层,这导致RGB图像的二值化图像无法正常进行腐蚀和膨胀操作,求大神解答!
      1_1562050192555_RGB.png 0_1562050192551_GRAY.png

      发布在 OpenMV Cam
      phmi