I'm working on panoramic image stitching and in imread function i got format error:PNG file has invalid signature.I googled it but i did not find anything.Can you explain me reason of error?
EDIT: baseInputPath+path=Input/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
在开始时我将jpeg文件转换为png,因此文件已损坏。现在重新转换它并成功处理。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.