Apr
07

Read an Image with python

  • If you want to read an image, you will need the ‘image’ package:
    • import Image
  • read the image:
    • Image.open(filename)
  • convert the Image to grey scale:
    • Image.open(filename).convert('L')
  • convert the image to array:
    • numpy.asarray(Image.open(filename).convert('L'))

Notice:

  • Here is a introduction to “Image” package
  • opencv, pillow are the python image library

Written by connygy. Posted in Codes, python

Trackback from your site.

Leave a comment