我正在尝试使用插值来去除图像中的色差。我的代码生成以下错误:TypeError:unshable type:'努比·恩达雷'. 以下是我的代码-任何帮助将不胜感激。谢谢-阿雷伊 这是输入解释
#splitting an image into its separe bands
source = im.split()
Cfixed = source[2]
Cwarp = source[1]
#take the image minus a ew-wide edge
roi = [ew+1, xdim-ew, ew+1, ydim-ew];
roi_pad = [roi[0]-ew, roi[1]+ew, roi[2]-ew, roi[3]+ew];
for k in range(0,centers_x.size):
cx = centers_x[k]
cy = centers_y[k]
wz = warps[k]
import scipy as sp
from scipy import interpolate
def warpRegion(Cwarp, roi_pad, (cx, cy, wz)):
#Unpack region indices
sx, ex, sy, ey = roi_pad
xramp, yramp = np.mgrid[sx:ex+1, sy:ey+1]
shapeofgrid=xramp.shape
print 'shape of x grid'+str(shapeofgrid)
xrampc = xramp - cx;
yrampc = yramp - cy;
xramp1 = 1/wz*xrampc;
yramp1 = 1/wz*yrampc;
xrampf = xrampc.flatten()
yrampf = yrampc.flatten()
xramp1f = xramp1.flatten()
yramp1f = yramp1.flatten()
reg_w = sp.interpolate.interp2d(yrampf,xrampf,Cwarp, yramp1f, xramp1f,'cubic');
我建议使用PIL。(Python图像库)
http://www.pythonware.com/products/pil/
一种方法是: 生成每个象限/样本区域的顶层颜色列表,并对列表进行哈希处理
错误消息的一种可能的解释是,您正试图将NumPy数组用作dict键或set元素。查看错误发生的位置,并研究该行中引用的每个变量的类型。如果需要帮助,请发布一个可运行的示例和异常的完整回溯。在
相关问题 更多 >
编程相关推荐