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



    • 代码:
      blobs_threshold = [(240, 255)]
      blobs_pixels_threshold = 300
      blobs_area_threshold = 600
      blob_list = img.find_blobs(threshold = blobs_threshold,pixels_threshold = blobs_pixels_threshold, area_threshold = blobs_area_threshold, merge=True)

      报错信息:
      TypeError: function missing 1 required positional arguments

      以上,为涉及到的代码部分,希望能得到解决,已经看过相关例程。



    • 需要全部的代码文本,否则我没办法测试。



    • 代碼:

      # Untitled - By: goushi - Thu Jul 11 2024
      
      import sensor, image, time
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      blobs_threshold = [(240, 255)]
      blobs_pixels_threshold = 300
      blobs_area_threshold = 600
      clock = time.clock()
      
      while(True):
          clock.tick()
          img = sensor.snapshot().lens_corr(1.8)
          blob_list = img.find_blobs(threshold = blobs_threshold,pixels_threshold = blobs_pixels_threshold, area_threshold = blobs_area_threshold, merge=True)    
          for blob in blob_list:
              img.draw_rectangle(blob.rect())
              img.draw_cross(blob.cx(), blob.cy())
          print(clock.fps())
      

      報錯信息:

      Traceback (most recent call last):
        File "<stdin>", line 17, in <module>
      TypeError: function missing 1 required positional arguments
      


    • 少了代碼 我再重發一下

      # Untitled - By: goushi - Thu Jul 11 2024
      
      import sensor, image, time
      
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      gray_binary_threshold = [(50, 80)]# 边缘检测算法的阈值控制
      blobs_threshold = [(240, 255)]
      blobs_pixels_threshold = 300
      blobs_area_threshold = 600
      clock = time.clock()
      
      while(True):
          clock.tick()
          img = sensor.snapshot().lens_corr(1.8)
          img.to_grayscale()
          # 转化为二值化黑白图
          img.to_bitmap(thresholds = gray_binary_threshold, invert = False)
          blob_list = img.find_blobs(threshold = blobs_threshold,pixels_threshold = blobs_pixels_threshold, area_threshold = blobs_area_threshold, merge=True)    
          for blob in blob_list:
              img.draw_rectangle(blob.rect())
              img.draw_cross(blob.cx(), blob.cy())
          print(clock.fps())
      

      報錯信息:

      Traceback (most recent call last):
        File "<stdin>", line 21, in <module>
      TypeError: function missing 1 required positional arguments
      


    • @kidswong999 感謝回復,已附上全部代碼,期待您的回復。



    • 21行,改为:blob_list = img.find_blobs(blobs_threshold, pixels_threshold = blobs_pixels_threshold, area_threshold = blobs_area_threshold, merge=True)