'How to show image that's been given as 1-D array
So I have a file with 6 different people, each person having 2 photos (in different angles) thus there are 6 * 2 = 12 images (in B&W).
Each image is 140 (ht) x 120 (width)
When I read the file, all the info is read so I have 12 columns (corresponding to each image) and 16,800 rows (corresponding to the image size).
How do I plot the image on matplotlib ?
I tried extracting each column e.g. df.loc[:,0] and then reshaping it to (140,120). But plotting it gives some abstract art looking output instead of the face. am I doing something wrong?
Solution 1:[1]
I've solved it. I think it was a bug/glitch.
So I tried with plt.imshow() and plt.show() but it did not work. I then tried various methods plt.plot() <- which was giving me the weird colour output.
Eventually, going back to plt.imshow() somehow worked
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | h21 |
