16

Is it possible to view numpy array as image while debugging in PyCharm?

I tried to enter

PIL.Image.fromarray(my_data, 'RGB').show()

into watches, but got

PIL is not defined

error. This is probably because PIL was not imported in current module.

Any other way appreciated. May be can write my own viewer or something?

1
  • Why not just install PIL? Commented Aug 17, 2017 at 11:36

3 Answers 3

22

I've just created OpenCV Image Viewer Plugin, which displays image while debugging just on click. You can install it to any JetBrains IDE, which support Python (directly or via plugin).

https://plugins.jetbrains.com/plugin/14371-opencv-image-viewer

enter image description here

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

3 Comments

god bless u dude
It's seems cannot use to PIL.Image? Or there is the same tool to PIL.Image?
Unfortunately, it doesn't support PIL Images for now.
4

I was able to import packages with semicolon, and was able to show image with expression like below:

import matplotlib; matplotlib.pyplot.imshow(mydata)

2 Comments

AttributeError: module 'matplotlib' has no attribute 'pyplot'
Sometimes it is necessary to call matplotlib.pyplot.show(). Overall: import matplotlib; matplotlib.pyplot.imshow(mydata); matplotlib.pyplot.show()
0

As an alternative there is PixelLens for PyCharm which apart from Numpy also supports Pillow, Tensorflow and PyTorch image data:

https://plugins.jetbrains.com/plugin/25039-pixellens

Comments

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.