This post is not a tutorial, not a guide. It is just a report on an approach that worked for me. I don’t include any code since I just took available scripts and then modified to adjust to my specific configuration.
But I hope this post can inspire or give confidence that it can be done…
- put LEDs in tree, more is better (always)
- 3D map the lights:
- find an area away from reflective walls, windows or cover those
- repeat 3 times, with tree rotated 120 degrees between each iteration:
- determine LED position one by one:
- take ‘dark’ image
- light single LED
- take LED image
- substract images and find brightest spot
- determine LED position one by one:
- calculate LED 3D positions:
- get rid of clearly wrong coordinates before the calculation (away from where the tree is in the images)
- based on GitHub - aaknitt/pixel_mapper: Semi-automatic mapping of RGB pixels in 3D space using computer vision
- find distances between pixels and throw out pixels where the distance is too large
- interpolate coordinates for pixels that couldn’t be calculated
- At this point, you can create a ‘ledmap’ ordering the pixel by height only. This works nice for most regular effects already!
- 2D ledmap:
- decide the primary viewing angle for the tree (this took me trial and error between the 120 degree rotations)
- reduce the 3D coordinates to 2D
- force the coordinates onto a grid using GitHub - YaleDHLab/pointgrid: Transform a 2D point distribution to a hex grid to avoid overplotting in data visualizations
- I found a fill factor of 0.5-0.6 to work nice for a christmas tree
- create a 2D ledmap
- watch hiphotic on your tree…