I'm working with image processing which means I'm doing operations on large matrices. I'm trying to debug which means I need to explore the elements, but it's a real pain doing it with print statements. Is there some kind of python plugin that will let me view arrays in a GUI for the purpose of debugging?
-
1If you are doing image processing, why are you not showing the images, instead?loopbackbee– loopbackbee2014-05-28 16:25:57 +00:00Commented May 28, 2014 at 16:25
-
A number of the operations I do produce matrices of complex numbers or negative numbers - which aren't easily visualisable. I need access to the raw numbers themselves to check they make sense vs calculations by hand.cjm2671– cjm26712014-05-28 16:33:31 +00:00Commented May 28, 2014 at 16:33
Add a comment
|
2 Answers
yes just use the python debugger and put a break point
or use something like q
$ easy_install q
import q
my_array = numpy.arange(1000)
q.d() #open a terminal where you have access to my_array
you will see something like below
Python console opened by q.d() in <some_module>
>>> print my_array[5]
you can also use pill to generate an image from the array (not sure if it will work right without tweaking)
>>> import Image
>>> img = Image.fromarray(my_array, 'RGB')
>>> img.save('test.png')
1 Comment
cjm2671
q.d() was just the ticket! Thanks!
However, if you would like to display numpy array as an image, you can use OpenCV Image Viewer Plugin, which I've just released.
https://plugins.jetbrains.com/plugin/14371-opencv-image-viewer
