• 星瞳AI VISION软件内测!可以离线标注,训练,并生成OpenMV的模型。可以替代edge impulse https://forum.singtown.com/topic/8206
  • 我们只解决官方正版的OpenMV的问题(STM32),其他的分支有很多兼容问题,我们无法解决。
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 为什么.find_blob函数设置pixel_threshold参数为4000依然会识别到pixels为2317的色块?



    • 
      import sensor, image, time
      
      sensor.reset()
      sensor.set_pixformat(sensor.GRAYSCALE)
      sensor.set_framesize(sensor.QVGA)
      sensor.skip_frames(time = 2000)
      sensor.set_auto_whitebal(False)
      
      clock = time.clock()
      
      while(True):
          clock.tick()
          img = sensor.snapshot().lens_corr(1.8)
          thr = img.histogram().get_threshold()
      #    print('threshold',thr[0])
      #    img.binary([(thr[0],255)])
          img = img.binary([(0,thr[0])])
          blob0 = img.find_blobs([(255,255)],pixel_threshold = 4000)
          print(blob0)
          lin = img.get_regression([(thr[0],255)], roi = (70,0,180,240))
      #    if (blob0):
      #    img.draw_rectangle((277, 0, 43, 69), color = 127)
          if (lin):
               img.draw_line(lin.line(), color = 127)
               print(lin)
      

      识别到的图像如下:
      0_1660320047187_QQ图片20220812235945.png

      打印出来的结果如下:
      [{"x":100, "y":0, "w":85, "h":240, "pixels":16918, "cx":146, "cy":112, "rotation":1.518160, "code":1, "count":1, "perimeter":744, "roundness":0.091413},
      {"x":268, "y":0, "w":52, "h":69, "pixels":2353, "cx":300, "cy":28, "rotation":1.209709, "code":1, "count":1, "perimeter":375, "roundness":0.503028},
      {"x":315, "y":69, "w":5, "h":3, "pixels":10, "cx":318, "cy":70, "rotation":2.727168, "code":1, "count":1, "perimeter":10, "roundness":0.332269},
      {"x":181, "y":83, "w":2, "h":21, "pixels":35, "cx":182, "cy":93, "rotation":1.556911, "code":1, "count":1, "perimeter":42, "roundness":0.014494}]
      {"x1":140, "y1":0, "x2":153, "y2":239, "length":239, "magnitude":2, "theta":177, "rho":-140}
      [{"x":100, "y":0, "w":85, "h":240, "pixels":16919, "cx":146, "cy":112, "rotation":1.517971, "code":1, "count":1, "perimeter":741, "roundness":0.091471},
      {"x":268, "y":0, "w":52, "h":69, "pixels":2317, "cx":300, "cy":27, "rotation":1.202760, "code":1, "count":1, "perimeter":418, "roundness":0.512365},
      {"x":181, "y":83, "w":2, "h":20, "pixels":33, "cx":182, "cy":92, "rotation":1.562700, "code":1, "count":1, "perimeter":40, "roundness":0.015920}]
      {"x1":140, "y1":0, "x2":153, "y2":239, "length":239, "magnitude":2, "theta":177, "rho":-140}

      非常感谢各路大神指导



    • pixel_threshold 改为 pixels_threshold



    • @kidswong999 谢谢