openMV中有关image.find_blobs(),我想在我给区域(roi)内进行颜色判别,但是roi区域应该如何写
https://docs.singtown.com/micropython/zh/latest/openmvcam/library/omv.image.html#image.find_blobs
这个是文档。
比如:
img.find_blobs([green_threshold], roi = [0,0,50,50])
@kidswong999 blobs = img.find_blobs([green_threshold],roi=(c.x()-c.r(),c.y()+c.r(),2*c.r(),2*c.r()))
这样写为什么不行
你可以print出来看看`c.x()-c.r(),c.y()+c.r(),2*c.r(),2*c.r()`这是个啥。
可能是计算出了什么乱七八槽的东西。没准越界了啥的。
@kidswong999 【c.x()-c.r(),c.y()+c.r(),2*c.r(),2*c.r()】识别圆后返回的坐标值
@kidswong999 for c in img.find_circles(threshold = 3500, x_margin = 10, y_margin = 10, r_margin = 10,r_min = 2, r_max = 100, r_step = 2):
img.draw_circle(c.x(), c.y(), c.r(), color = (255, 0, 0))
roi=(c.x()-c.r(),c.y()+c.r(),2*c.r(),2*c.r())
blobs = img.find_blobs([green_threshold],[roi])
你没看到上面我写的吗?
- 首先你要有"roi="这几个字
- roi是一个list或者tuple,所以你不能[roi]这样写
所以你的代码要写img.find_blobs([green_threshold],roi = roi)
@kidswong999 这样修改还是有错误
看上去你有一个中文的逗号。