logo

如何写一个找最大的圆的函数

2018-05-03 15:32
M
_15529663967

def find_max_blob(blobs):

max_size = 0

for blob in blobs:

if blob.pixels() > max_size:

max_blob = blob

max_size = blob.pixels()

return max_blob

上面是一个找最大色块的函数 可以实现

参照上面的函数 写一个找最大的圆的函数 出现报错

def find_max_circle(circles):

max_size = 0

for circle in circles:

if circle.r() > max_size

max_circle = circle

max_size = circle.r()

return max_circle

95a471d7-fdff-4e5b-86bd-ec97ee3668b1.JPG
2018-05-03 15:51
I
网红小智智 星瞳科技

你的if后面没有冒号。

2018-05-03 16:41
M
_15529663967

sorry 粗心了 感谢