I’m working on a LED project which involves printed circuit boards where the LEDs are placed in an “irregular way”. They’re not following a cartesian grid nor a polar grid. Its more like an equally spaced curve follower. I want to be able to display animations on those circuit board and for that I’m looking for a strategy to process the intersection between my pixel map and a bitmap image.
Here’s an example of a low res image with the led pixel map on top of it (left).
I’m looking for a strategy or algorithm that would allow me to process the RGB value of each pixel (leds) based on the surrounding colors (bitmap image).
I have a strategy but I’m stuck at some point. Each led falls inside a square of the bitmap image and is surrounded by 8 other pixels, all with their own colour. I want to combine the RGB value of those 9 pixels by weighting them based on the distance between the LED and the centre of each bitmap pixel. (On the right of the image above) Right now, I have a python script that generates, for each led pixel, an 3x3 array that contains the distances with the centers surrounding it. It handles the cases where the led pixel is on the border or in the corner of the bitmap image (where there’s 6 or 4 surrounding pixels).
My problem is that I have no idea what would be the right way to combine distances and RGB values to get a single colour. Linear, polynomial, logarithmic … My goal being to be as close as possible to the original image and have smooth fading colours.
Any idea or keywords to broaden my search would be really appreciated.