系统迁移中,暂时无法访问,所有数据会迁移到新的网站。
OpenMV VSCode 扩展发布了,在插件市场直接搜索OpenMV就可以安装
如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修。
发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
每一个新的提问,单独发一个新帖子
帖子需要目的,你要做什么?
如果涉及代码,需要报错提示与全部代码文本,请注意不要贴代码图片
必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
为什么max_blob没有识别到颜色时显示没有定义,而运行开始时识别到相应颜色就没事?
-
# Blob Detection Example # # This example shows off how to use the find_blobs function to find color # blobs in the image. This example in particular looks for dark green objects. import sensor, image, time from pyb import UART sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QQVGA) sensor.skip_frames(10) sensor.set_auto_whitebal(False) clock = time.clock() uart = UART(3,19200,timeout_char=1000) green_threshold = (17, 96, -17, 40, 88, 19) size_threshold = 2000 def find_max(blobs): max_size=0 max_blob=None for blob in blobs: if blob[2]*blob[3] > max_size: max_blob=blob max_size = blob[2]*blob[3] return max_blob while(True): clock.tick() # Track elapsed milliseconds between snapshots(). img = sensor.snapshot() # Take a picture and return the image. blobs = img.find_blobs([green_threshold]) if blobs: max_blob = find_max(blobs) img.draw_rectangle(max_blob[0:4]) # rect img.draw_cross(max_blob[5], max_blob[6]) # cx, cy if max_blob: #此处max_blob显示没定义 pan_error = max_blob.cx()-img.width()/2 if max_blob == None: print('旋转') uart.write('$ZY!') time.sleep_ms(100)
-
在
if blobs:
上面添加max_blob=None
-
此回复已被删除!