Python3中的NP.max函数错误

Python3中的NP.max函数错误,python,numpy,opencv,Python,Numpy,Opencv,我正在学习使用OpenCV代码从 错误来自np.max edgeImg = np.max( np.array([ edgedetect(blurred[:,:, 0]), edgedetect(blurred[:,:, 1]), edgedetect(blurred[:,:, 2]) ]), axis=0 ) 当我从np.max更改为np.max时,错误如下: Traceback (most recent call last): File "deteksipinggir-sobel.py",

我正在学习使用OpenCV代码从

错误来自np.max

edgeImg = np.max( np.array([ edgedetect(blurred[:,:, 0]), edgedetect(blurred[:,:, 1]), edgedetect(blurred[:,:, 2]) ]), axis=0 )
当我从np.max更改为np.max时,错误如下:

Traceback (most recent call last):
File "deteksipinggir-sobel.py", line 77, in <module>
segment('078.jpg')
File "deteksipinggir-sobel.py", line 49, in segment
np.array([edgedetect(blurred[:, :, 0]), edgedetect(blurred[:, :, 1]), edgedetect(blurred[:, :, 2])]), axis=0)
ValueError: invalid number of arguments
Traceback (most recent call last):
File "deteksipinggir-sobel.py", line 77, in <module>
segment('078.jpg')
File "deteksipinggir-sobel.py", line 49, in segment
np.array([edgedetect(blurred[:, :, 0]), edgedetect(blurred[:, :, 1]), edgedetect(blurred[:, :, 2])]), axis=0)
File "E:\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py", line 2272, in amax
out=out, **kwargs)
File "E:\Anaconda3\lib\site-packages\numpy\core\_methods.py", line 26, in _amax
return umr_maximum(a, axis, None, out, keepdims)
TypeError: '>=' not supported between instances of 'NoneType' and 'NoneType'
回溯(最近一次呼叫最后一次):
文件“deteksipinggir sobel.py”,第77行,在
段('078.jpg')
文件“deteksipinggir sobel.py”,第49行,分段
数组([edgedetect(模糊[:,:,0]),edgedetect(模糊[:,:,1]),edgedetect(模糊[:,:,2])),轴=0)
ValueError:参数数无效
当我从np.max更改为np.amax时,错误如下:

Traceback (most recent call last):
File "deteksipinggir-sobel.py", line 77, in <module>
segment('078.jpg')
File "deteksipinggir-sobel.py", line 49, in segment
np.array([edgedetect(blurred[:, :, 0]), edgedetect(blurred[:, :, 1]), edgedetect(blurred[:, :, 2])]), axis=0)
ValueError: invalid number of arguments
Traceback (most recent call last):
File "deteksipinggir-sobel.py", line 77, in <module>
segment('078.jpg')
File "deteksipinggir-sobel.py", line 49, in segment
np.array([edgedetect(blurred[:, :, 0]), edgedetect(blurred[:, :, 1]), edgedetect(blurred[:, :, 2])]), axis=0)
File "E:\Anaconda3\lib\site-packages\numpy\core\fromnumeric.py", line 2272, in amax
out=out, **kwargs)
File "E:\Anaconda3\lib\site-packages\numpy\core\_methods.py", line 26, in _amax
return umr_maximum(a, axis, None, out, keepdims)
TypeError: '>=' not supported between instances of 'NoneType' and 'NoneType'
回溯(最近一次呼叫最后一次):
文件“deteksipinggir sobel.py”,第77行,在
段('078.jpg')
文件“deteksipinggir sobel.py”,第49行,分段
数组([edgedetect(模糊[:,:,0]),edgedetect(模糊[:,:,1]),edgedetect(模糊[:,:,2])),轴=0)
文件“E:\Anaconda3\lib\site packages\numpy\core\fromneric.py”,第2272行,在amax中
out=out,**kwargs)
文件“E:\Anaconda3\lib\site packages\numpy\core\\u methods.py”,第26行,在amax中
返回umr_最大值(a、轴、无、输出、保持)
TypeError:“>=”在“非类型”和“非类型”的实例之间不受支持

我正在使用python 3,请帮助,谢谢。

来自numpy文档:
numpy。最大值要求两个输入数组作为参数:

numpy.maximum(arr1, arr2)
numpy.max
只需要一个输入数组作为参数:

numpy.max(arr1)

确保您提供了
numpy.max
至少两个数组作为参数。

来自numpy文档:
numpy.max
需要两个输入数组作为参数:

numpy.maximum(arr1, arr2)
numpy.max
只需要一个输入数组作为参数:

numpy.max(arr1)

请确保您提供了
numpy.max
至少两个数组作为参数。

您指向我们的网站上的edgedetect例程有一个根本问题:没有返回语句。您是否可以确认您使用了此代码,因为如果您这样做,您的问题已被识别。
np.max(a,b,c)=>np.max((a,b,c))
您指向我们的网站上的edgedetect例程有一个基本问题:没有返回语句。请确认您使用了此代码,因为如果您使用了,您的问题已被识别。
np.max(a,b,c)=>np.max((a,b,c))