Computational Xmas Tree lights!

Overview

Computational Xmas Tree

This repo contains the code for the computational illumination of a Christmas Tree!

It is based on the work by Matt Parker from @standupmaths, and his video "I wired my tree with 500 LED lights and calculated their 3D coordinates".

This version contains an original LED 3D calibration routine developed by @range-et based on Matt's explanations on the video, Grasshopper + C# scripts to generate animated light sequences developed by @garciadelcastillo, and python scripts for the Raspberry Pi to load and run them on the tree.

The main difference is that Matt's approach uses custom Python scripts with sequences ran directly on the RPi, whereas this workflow "bakes" the animations to CSV files that can then be ran from the RPi. The advantage of this approach is that the CSV sequences can be parsed on any graphics environment and displayed/simulated without needing to compile Python code. The downside is that the coordinates of the LEDs need to be known a priori before generating the CSV file (CSV files become tree-specific).

Jose Luis did a video series on ParametricCamp explaining (most of) this workflow: https://youtu.be/ma4JF6b4Dqk

Usage

Calibration

If you set a physical Christmas tree with lights, you can get an estimate of their 3D position using the following:

  1. Run imageCapture.py from a Raspberry Pi with a webcam and connected to the tree. The script will take one image per LED for angle 0: $ sudo python3 imageCapture.py
  2. Repeat this process by physically rotating the tree 45, 90, 135, 180, 225, 270 & 315 degrees, and correspondingly updating the MASTERDIR variable in the script. A sample dataset is provided.
  3. Run mapper.ipynb to process all the images and generate the coordinates of the tree. This may take some time!
  4. Run adjuster.ipynb to correct some of the outliers.

A version of the final outcome from our test tree is provided in file coords_adjusted.txt. If you don't have a tree yourself, feel free to use these as the starting point.

Questions, suggestions and PRs can be directed to @range-et!

Sequencing

Once 3D coordinates are available, the following C# Scripts can be used as inspiration to generate sequences:

  1. (optional) The Grasshopper files use a version of the tree coordinates where X and Y are normalized between -1 and 1, and Z is proportionally scaled from 0 to whatever. Additionally, the coordinates are in CSV format. Use the xmas_tree_coord_normalizer.gh script to translate between the two syntaxes.
  2. The xmas_tree_sequences_3d.gh and xmas_tree_sequences_no_3d.gh contain scripts to generate a few animated sequences, both spatially-aware (tree-specific) and not respectively.
  3. (optional) If you only want to simulate already baked sequences, use xmas_tree_simulation.gh

Execution

A few scripts, based on Matt's original code, are provided to load the CSV sequences and run them on the tree.

  1. Copy the content of the execution folder to the RPi, as well as a few of the CSV sequences.
  2. To run a sequence: $ sudo python3 run.py light-sequence.csv
  3. To run all the sequences in a folder: $ sudo python3 run-folder.py seq-folder/ 3 30. The optional number 3 indicates that each sequence will be looped 3 times before moving on to the next, and the optional 30 indicates that sequences will be blended over 30 frames.
  4. If you stop a sequence and want to turn off the tree, run $ sudo python3 flush.py
  5. If you need to fine calibrate the tree, you can turn on specific lights by ID running $ sudo python3 turnon.py 0 99 199 299 399 499.

Contributions

This repo is just a snapshot of the work we did in the Fall 2021 edition of the GSD-6338 course. Unfortunately, we do not have the resources to maintain, manage or extend it beyond what is available. If you want to ask questions, discuss standards, contribute new code, features and add new sexy goodness, please refer to Matt's repo or start your own fork. Crediting is always welcome, thank you!

Credits

Thanks to the superstar roster of TAs Indrajeet, Amelia and Jessica for putting together the tree and writing the foundational calibration code.

Big 💯 to all the students who gave it a try to write sequences for the tree!

Project led by Jose Luis Garcia del Castillo y Lopez as part of our work at GSD-6338: Introduction to Computational Design at the Harvard University Graduate School of Design.

Original idea by Matt Parker from @standupmaths.

Owner
GSD6338
Projects from the course GSD-6338: Introduction to Computational Design, at the Harvard Graduate School of Design
GSD6338
:rocket: A minimalist comic reader

Pynocchio A minimalist comic reader Features | Installation | Contributing | Credits This screenshots contains a page of the webcomic Pepper&Carrot by

Michell Stuttgart 73 Aug 02, 2022
Python Image Optimizer Script

Image-Optimizer Download and Install git clone https://github.com/stefankumpan/Image-Optimizer-Script.git cd Image-Optimizer-Script pip install -r req

Stefan Kumpan 0 Jul 15, 2021
Easily turn large sets of image urls to an image dataset. Can download, resize and package 100M urls in 20h on one machine.

img2dataset Easily turn large sets of image urls to an image dataset. Can download, resize and package 100M urls in 20h on one machine. Also supports

Romain Beaumont 1.4k Jan 01, 2023
A Python package implementing various CFA (Colour Filter Array) demosaicing algorithms and related utilities.

Colour - Demosaicing A Python package implementing various CFA (Colour Filter Array) demosaicing algorithms and related utilities. It is open source a

colour-science 218 Dec 04, 2022
Tools for making image cutouts from sets of TESS full frame images

Cutout tools for astronomical images Astrocut provides tools for making cutouts from sets of astronomical images with shared footprints. It is under a

Space Telescope Science Institute 20 Dec 16, 2022
cmdpxl: a totally practical command-line image editor

cmdpxl: a totally practical command-line image editor Features cmdpxl has many exciting functionalities, including Editing pixels one at a time! Savin

Jieruei Chang 475 Dec 23, 2022
Napari 3D Ortho Viewer - an ortho viewer for napari for 3D images

napari-3d-ortho-viewer Napari 3D Ortho Viewer - an ortho viewer for napari for 3D images This napari plugin was generated with Cookiecutter using @nap

niklas netter 5 Nov 28, 2022
This script is for photographers to do timeslice with one click.

One Click TimeSlice Tool What is this for This is for photographers who want to create TimeSlice pictures without installing PS plugins. Before using

Xi Zhao 13 Sep 23, 2022
Convert photos to paintings with python

Convert-photos-to-paintings Before the changes After the changes Before the changes After the changes This code is written in the Python programming l

Amir Hussein Sharifnezhad 3 May 31, 2022
A Gtk based Image Selector with Preview

gtk-image-selector This is an attempt to restore Gtk Image Chooser "lost functionality": displaying an image preview when selecting images... This is

Spiros Georgaras 2 Sep 28, 2022
Create a static HTML/CSS image gallery from a bunch of images.

gallerize Create a static HTML/CSS image gallery from a bunch of images.

Jochen Kupperschmidt 19 Aug 21, 2022
A small Python module for BMP image processing.

micropython-microbmp A small Python module for BMP image processing. It supports BMP image of 1/2/4/8/24-bit colour depth. Loading supports compressio

Quan Lin 4 Nov 02, 2022
Optimize/Compress images using python

Image Optimization Using Python steps to run the script run the command to install the required libraries pip install -r requirements.txt create a dir

Shekhar Gupta 1 Oct 15, 2021
A collection of python scripts which help you programatically create PNGs or GIFs

A collection of python scripts which help you programatically create PNGs or GIFs and their Metadata in bulk with custom rarity rates, upload them to OpenSea & list them for sale.

Tom 30 Dec 24, 2022
Multiparametric Image Analysis

Documentation The documentation is available on populse_mia's website here Installation From PyPI, for users By cloning the package, for developers Fr

Populse 9 Dec 14, 2022
An open source image editor which can manipulate an image in many ways!

Image Editor - An open source image editor which can manipulate an image in many ways! If you need any more modes in repo or I

TroJanzHEX 44 Nov 17, 2022
3D printer / slicing GUI built on top of the Uranium framework

Cura Ultimaker Cura is a state-of-the-art slicer application to prepare your 3D models for printing with a 3D printer. With hundreds of settings and h

Ultimaker 4.4k Jan 02, 2023
Command line utility for converting images to seamless tiles

img2texture Command line utility for converting images to seamless tiles. The resulting tiles can be used as textures in games, compositing and 3D mod

Artёm IG 24 Dec 26, 2022
HCaptcha solver using requests and an image recognition package!

HCaptcha solver using requests and an image recognition package! Report Bug · Request Feature Features Image recognition Requests base

dropout 6 Oct 22, 2021
A warping based image translation model focusing on upper body synthesis.

Pose2Img Upper body image synthesis from skeleton(Keypoints). Sub module in the ICCV-2021 paper "Speech Drives Templates: Co-Speech Gesture Synthesis

zhiyh 15 Nov 10, 2022