我试图为sharpness check计算图像的渐变,但是下面的代码抛出了一个错误,尽管它应该是非常直接的
import os,sys
from PIL import Image
import numpy as np
B = Image.open("C:\\work\\tech\\blur\\blur.jpg")
By, Bx = np.gradient(B)
Bnorm = np.sqrt(Bx**2 + By**2)
Bsharpness = np.average(Bnorm)
print Bsharpness
错误
^{pr2}$documentation for np.gradient上写着
For two dimensional arrays, the return will be two arrays ordered by axis.
我检查了this question,但它不符合我的要求
目前没有回答
相关问题 更多 >
编程相关推荐