lepton
lepton copied to clipboard
Change palette in streamtest.py
Hi,
can you also show an example with changing the color palette for the stream?
Thanks a lot.
Best regards kami
Sorry this fell through the cracks. You can use a palette to colorize the image as follows. For example to use the rainbow palette.
At the top of the demo include the palette
from palettes import rainbow_palette
Then index the palette when building the image. Replace
if val > 255:
a[r, c] = [255, 255, 255]
else:
a[r, c] = [val, val, val]
with
if val > 255:
a[r, c] = rainbow_palette[255]
else:
a[r, c] = rainbow_palette[val]