July 17, 2014 0

convert png image read using PIL to numpy array

By in python

Beware that conversion of an image with a non-standard format using np.array(Image.open(‘imagefile.png’)) can result in strange behavior.

If eg the loaded image have a mode of LA the resulting numpy array are not initiated correctly. Use PIL Image convert function to get a format that you can convert (I expect single and triple channel image to work)

Tags: , , ,


Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/mgis.dk/about/wp-includes/class-wp-comment-query.php on line 399

Leave a Reply