Open dglaude opened 3 years ago
Thanks for the pointer, David. I'll take a look at your bitmap generation and see if I can figure out how to apply it :-)
I did spend some time on thermal camera "rendering", mostly working on the creation of a nice colour scale in a palette. This is where having 64 colours is more fun that less.
My trick is to compute the min and max temperature of the sensor and then map to 64 colours. The benefit is a better vision of the temperature variation, the negative is that red is not always the same color, so you have to help the user and display the min and max next to a color scale.
My code is on an array of 768 values (32*24) and finding the min/max or scaling those value was costly. Recently I used ulab to do that part of the math and it goes faster. Then a feature was added to Circuit Python to permit copy from an array directly to a bitmap too:
https://gist.github.com/dglaude/acb17b064a6554abdb5f07bcb59bbda5
There might need some adaptation needed, as the amg88 return a two dimentional array, but I guess ulab does support that too. I don't have your sensor, but I will see if I can fake it and write some matching code for doing what I did with my sensor.
From watching your code yesterday, the way to display the 64 values is challenging and likely not optimal. It created a lot of group and then fill them. AFAIK for working a lot with thermal display, they most simple is to make a very small paletted bitmap, and scale it in displayio. The palette would be you colour scale to translate temperature to colour and the bitmap will be exactly the size of what your sensor give you. I do something similar with 32x24 MLS sensor: https://github.com/dglaude/CircuitPython_MLX90640_PyGamer_Plus
You may want to work on that.
I guess you have done that following a learn guide from Adafruit. I know at least of one guide that does it that way, and maybe that is the only CP guide for that sensor. Since I am working with another sensor I did not challenge that way of working.