logo

openMV中有关image.find_blobs()函数使用方法

2019-01-23 14:47
3
pwou

openMV中有关image.find_blobs(),我想在我给区域(roi)内进行颜色判别,但是roi区域应该如何写

3
pwou
8737d474-4819-441c-985e-536df9ea72e1.PNG
2019-01-23 15:02
I
网红小智智 星瞳科技

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

2019-01-23 15:18
3
pwou

@kidswong999 blobs = img.find_blobs([green_threshold],roi=(c.x()-c.r(),c.y()+c.r(),2*c.r(),2*c.r()))

这样写为什么不行

I
网红小智智 星瞳科技

你可以print出来看看`c.x()-c.r(),c.y()+c.r(),2*c.r(),2*c.r()`这是个啥。

可能是计算出了什么乱七八槽的东西。没准越界了啥的。

3
pwou

@kidswong999 【c.x()-c.r(),c.y()+c.r(),2*c.r(),2*c.r()】识别圆后返回的坐标值

3
pwou

@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])

I
网红小智智 星瞳科技

你没看到上面我写的吗?

- 首先你要有"roi="这几个字

- roi是一个list或者tuple,所以你不能[roi]这样写

所以你的代码要写img.find_blobs([green_threshold],roi = roi)

2019-01-23 16:02
3
pwou

@kidswong999 这样修改还是有错误

3
pwou
a244f265-daf0-45cb-983f-bde6a0d93733.PNG
I
网红小智智 星瞳科技

看上去你有一个中文的逗号。