0

I am using ubuntu 14.04 server and I capturing some depth data from my infrared camera.

depth = get_depth()
print np.shape(depth)

The output is (480, 640). Basically it contains depth values in the form of (x,y) coordinates.

I want to save this data as a heatmap in a jpeg picture, and then create a MJPEG video out of it. However, when I try to do

import pylab as pl
depth = get_depth()
pl.pcolor(data)  

It gives me

_tkinter.TclError: no display name and no $DISPLAY environment variable

I simple want to use savefig("filename.jpg") and dont want to use X server to see the plot.

How should I implement this? or is there any other python library which can generate heatmaps and save as JPEG files.

kosta
  • 4,302
  • 10
  • 50
  • 104
  • Have you tried `import matplotlib.pyplot as pl`? I think that pylab tries to open windows and display plots as they are done, where as pyplot requires a call to `pl.show()`. – KevinG Jun 21 '15 at 15:33
  • It gives the same error with `matplotlib.pyplot` – kosta Jun 21 '15 at 23:57

1 Answers1

1

Matplotlib defaults to an x-using backend, but you can set a noninteractive backend by modifying rcParams:

import matplotlib
matplotlib.rcParams['backend'] = "Agg"
S E Clark
  • 423
  • 4
  • 15