我使用for循环为图像中的diff片段计算了一系列阈值。你知道吗
>>crdf
[(11, 6),
(11, 7),
(11, 11),
(12, 16),
(10, 9),
(21, 26),
(15, 15),
(12, 17),
(12, 12),
(14, 10),
(20, 26)
]
>>for i in range(0,4):
>> print(threshold_otsu(img[crdf[i]],16))
-14.606459
-15.792943
-15.547393
-16.170353
如何计算这些阈值(输出值)的平均值并使用python将其存储在变量中?你知道吗
您可以
modify
您的代码如下所示,请注意for loop
部分和after the for loop
。本质上,for循环中的所有数字都被附加到一个数组中,为了计算,我们计算for循环之后该数组中数字的平均值:我不知道你是如何用
threshold_otsu()
计算出来的,但最终如果out of the for loop
你会得到这4个值,它们会被加到arrayOfNumbers
你会遇到这样的情况:有很多方法可以做到这一点:
使用numpy:
不使用numpy:
相关问题 更多 >
编程相关推荐