Below is my Code. It is a server program that receives stream of bitmaps from the client and I want to display the bitmap in real time. However, the "frame.set_data(im)" is the bottle neck of my code and I only get 5 FPS. Disabling that line, I get aroung 15fps for receiving images. (the display is disabled ofcourse without set_data()).
I looked for other answers, and I know I have to perform blitting to fast things up with MatPlotLib. However, I have no idea how to perform blitting with bitmaps. Could someone help me fast things up?
import matplotlib
matplotlib.use('TKAgg')
import matplotlib.pyplot as plt
while 1:
# Decode and Save Image
imgdata = base64.b64decode(data)
stream = io.BytesIO(imgdata)
# Display realtime gameplay
im = plt.imread(stream,"bmp")
if frame is None:
print "Start Rendering.."
frame = plt.imshow(im)
plt.show()
else:
frame.set_data(im)
plt.pause(0.00000001)