Wednesday, October 24, 2018

Viewing the Intensity matrix of an image

  1. from skimage import io, viewer
  2. img = io.imread('test.jpg', as_grey=True) # load the image as grayscale
  3. print 'image matrix size: ', img.shape # print the size of image
  4. print '\n First 5 columns and rows of the image matrix: \n', img[:5,:5]*255
  5. viewer.ImageViewer(img).show() # plot the image

No comments:

Post a Comment