PNG文件包含无效签名

时间:2017-02-28 06:15:37

标签: python image-processing computer-vision

我正在进行全景图像拼接和imread功能我得到格式错误:PNG文件有无效签名。我用谷歌搜索但我没有找到任何东西。你能解释我错误的原因吗?

编辑:baseInputPath + path =输入/ PanoramaImage30 / image1.png

baseInputPath='Input/'
baseOutputPath='Output/'

def imread(path='in.png'):
    '''reads a PNG RGB image at baseInputPath+path and return a numpy array organized along Y, X, channel.
    The values are encoded as float and are linearized (i.e. gamma is decoded)'''
    global baseInputPath
    print baseInputPath+path
    reader=png.Reader(baseInputPath+path)
    im=reader.asFloat()
    a=numpy.vstack(im[2])
    if im[3]['greyscale']:
        raise NameError( 'Expected an RGB image, given a greyscale one')        
    x, y=im[0], im[1]
    a.resize(y, x, 3)
    a**=2.2
    return a

1 个答案:

答案 0 :(得分:0)

在开始时我将jpeg文件转换为png,因此文件已损坏。现在重新转换它并成功完成。