Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To upload an image to reside in the Sages DATA directory for this particular worksheet you just select "upload" from the Data menu. It can be local or on your PC

Here is a correct version which should work when you have uploaded the picture.

import pylab; import numpy

img=pylab.imread(DATA + 'NbW-STEM.jpg')

print "Image dtype: %s"%(img.dtype)
print "Image size: %6d"%(img.size)
print "Image shape: %3dx%3d"%(img.shape[0],img.shape[1])
print "Max value %1.2f at pixel %6d"%(img.max(),img.argmax())
print "Min value %1.2f at pixel %6d"%(img.min(),img.argmin())
print "Variance: %1.5f\nStandard deviation: %1.5f"%(img.var(),img.std())