Created
October 5, 2019 09:13
-
-
Save joelbarmettlerUZH/0644ea335e06a16524d15c7d403bae5b to your computer and use it in GitHub Desktop.
Load image as numpy array
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def load_image_into_numpy_array(image): | |
(im_width, im_height) = image.size | |
return np.array(image.getdata()).reshape( | |
(im_height, im_width, 3)).astype(np.uint8) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment