5

I have converted set of images to ndarray and stored it, now i have to convert them back to images without saving it to disk. I tried with " toimage() " function, but it is displaying only 1 image.

toimage(resizedlist.values()[0]).show()

resizedlist.values contains the ndarray of 49 images. Is there any way to display images randomly??

Thanks in advance!

2
  • 1
    What is it you want to do? Convert the ndarray's to images or plot the ndarray's as images? In the latter case imshow will do what you want. Commented Mar 24, 2014 at 5:54
  • @ ebarr I want to plotting ndarray as image. Commented Mar 24, 2014 at 5:57

1 Answer 1

12

To plot an ndarray as an image you can use matplotlib:

import numpy as np
import matplotlib.pyplot as plt

random = np.random.normal(0,1,size=[100,100])
plt.imshow(random,aspect="auto")
plt.show()

If your image data is stored RGBA, imshow will plot the image with the correct colours etc.

For reference, all this information can be found here:

http://matplotlib.org/1.3.1/users/image_tutorial.html

Sign up to request clarification or add additional context in comments.

1 Comment

Is there any way to display/plot an ndarray as images which is stored in a dictionary. Because, i have stored the images as ndarray in a dictionary, it is storing properly, but when it comes for display the same, it is not displaying anything.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.