Here's my code to one-time plot a bitmap stored as a numpy array:
bitmapf = np.array((ypixels, xpixels, 3)) # RGB for last channel
# ! bitmapf is populated
renormed255 = 255.0 * bitmapf / np.max(bitmapf)
# https://stackoverflow.com/questions/49271913/convert-numpy-array-to-rgb-image/49334548
from PIL import Image
img = Image.fromarray(renormed255.astype('uint8'), 'RGB')
img.show()
However, I have live data coming in from a websocket populating bitmapf.
EDIT: Live data is sparse, and put through an algorithm to light up pixels on the bitmap. x-axis is time, and only a 1 x pixelsY column is modified for every 20 or so packets recieved.
I wish to render it onscreen at 30Hz.
How to achieve this? (It's big, at least 1024x768).
Is it possible to optimize so only the dirty column is passed to the renderer?
UPDATE: I've tried implementing an opencv approach, but it won't render:
import cv2
import numpy as np
from time import sleep
bitmap = np.zeros((512,512,3),np.uint8)
for i in range(512):
sleep(.1)
bitmap[i,i,:] = 128
cv2.imshow("Color Image", bitmap)
cv2.waitKey(0)
cv2.destroyAllWindows()