• 免费好用的星瞳AI云服务上线!简单标注,云端训练,支持OpenMV H7和OpenMV H7 Plus。可以替代edge impulse。 https://forum.singtown.com/topic/9519
  • 我们只解决官方正版的OpenMV的问题(STM32),其他的分支有很多兼容问题,我们无法解决。
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 请问为什么灰度图像的二值化后图像与RGB图像二值化后图像的大小不一?



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



    • 如果涉及代码,需要报错提示与全部代码文本,请注意不要贴代码图片



    • 并且提供具体的错误信息。错误现象。



    • 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)
      
      
      


    • 这个问题已解决。
      请更新固件到最新版本。3.4.1