From: oyster <lep...@gm...> - 2015-04-17 01:22:06
|
Two 8bpp(Gimp, xnview say so) graylevel png files can be downloaded The first (ramp-gray.png) which gives right array shape is http://bbs.blendercn.org/data/attachment/forum/201504/17/090627ejhixti8vdthdnnn.png The second one (python-gray.png) which gives 'wrong' array shape, at least to me, is http://bbs.blendercn.org/data/attachment/forum/201504/16/222351w3952n3o9968m9a5.png [code] from pylab import * imgRampPng=imread('ramp-gray.png') print (imgRampPng.shape) #(1, 255), that is right print (imgRampPng.min(),imgRampPng.max()) #(0.0, 0.99607843) print () imgGrayPng=imread('python-gray.png') print (imgGrayPng.shape) #(128, 128, 3), *but I suppose it should be (128, 128)* print (imgGrayPng.min(),imgGrayPng.max()) #(0.0, 0.98823529) print () Ch1=imgGrayPng[:,:,0] Ch2=imgGrayPng[:,:,1] Ch3=imgGrayPng[:,:,2] print (Ch1.min(), Ch1.max()) #(0.0, 0.98823529) print (Ch2.min(), Ch2.max()) #(0.0, 0.98823529) print (Ch3.min(), Ch3.max()) #(0.0, 0.98823529) #that is to say, Ch1/2/3 hold same data print () [/code] |