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
Alternate Python bindings for the Open Asset Import Library (ASSIMP)

Impasse A simple Python wrapper for assimp using cffi to access the library. Requires Python = 3.7. It's a fork of PyAssimp, Assimp's official Python

Salad Dais 3 Sep 26, 2022
Qrgenerator - A qr generator app using python3

qrgenerator by Mal4D Hi welcome into qr code generator using python by Mal4d Lin

Mal4D 1 Jan 09, 2022
👷 Build images with images

👷 Build images with images. About Tiler is a tool to create an image using all kinds of other smaller images (tiles). It is different from other mosa

5.5k Jan 03, 2023
Open source software for image correlation, distance and analysis

Douglas-Quaid Project Open source software for image correlation, distance and analysis. Strongly related to : Carl-Hauser Problem statement (@CIRCL)

Dominik Dancs 2 May 01, 2022
This Web App lets you convert your Normal Image to a SKETCHED one within a minute

This Web App lets you convert your Normal Image to a SKETCHED one within a minute

Avinash M 25 Nov 10, 2022
Make GIFs from time-stacked xarray.DataArrays (time, [optional band], y, x), dead-simple.

GeoGIF Make GIFs from time-stacked xarray.DataArrays (time, [optional band], y, x), dead-simple. from geogif import gif, dgif gif(data_array) dgif(das

Gabe Joseph 47 Dec 22, 2022
Glyph-graph - A simple, yet versatile, package for graphing equations on a 2-dimensional text canvas

Glyth Graph Revision for 0.01 A simple, yet versatile, package for graphing equations on a 2-dimensional text canvas List of contents: Brief Introduct

Ivan 2 Oct 21, 2022
Snowfall - helpful image handling utils - abstracts various file and opencv and pil features into result oriented functions

snowfall helpful image handling utils - abstracts various file and opencv and pil features into result oriented functions usage examples: from image_h

Less Wright 2 Jan 09, 2022
Image Processing HighPass Filter With Python

Image_Processing_HighPassFilter High Pass Filter take the high frequency and ignore the low frequency High Pass Filter can be use to sharpening an ima

Felix Pratamasan 1 Dec 27, 2021
Python class that generates pixel art from images

Python class that generates pixel art from images

Richard Nagyfi 1.4k Dec 29, 2022
A python program to generate ANSI art from images and videos

ANSI Art Generator A python program that creates ASCII art (with true color support if enabled) from images and videos Dependencies The program runs u

Pratyush Kumar 12 Nov 08, 2022
Utilities for SteamVR on Linux

This project contains scripts to improve the functionally of SteamVR on Linux:

86 Dec 29, 2022
Advance Image Steganography

Chaya Advance Image Steganography Using LSB-LPS + AES-256-GCM + FLIF Right To Privacy! United Nations Declaration of Human Rights (UDHR) 1948, Article

XeroHack 113 Dec 02, 2022
Python Script to generate posters out of the images in directory.

Poster-Maker Python Script to generate posters out of the images in directory. This version is very basic ligthweight code to combine organize images

1 Feb 02, 2022
ImageStrike是一款用于CTF中图片隐写的综合利用工具

🎈 简介 ImageStrike是一款使用PyQT5开发,用于CTF中图片隐写的综合利用工具

zR00t1 133 Dec 27, 2022
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
Simple mathematical operations on image, point and surface layers.

napari-math This package provides a GUI interfrace for simple mathematical operations on image, point and surface layers. addition subtraction multipl

Zach Marin 2 Jan 18, 2022
SALaD (Semi-Automatic Landslide Detection) is a landslide mapping system

SALaD (Semi-Automatic Landslide Detection) is a landslide mapping system. SALaD utilizes Object-based Image Analysis and Random Forest to map landslides.

NASA 14 Jan 04, 2023
Imutils - A series of convenience functions to make basic image processing operations such as translation, rotation, resizing, skeletonization, and displaying Matplotlib images easier with OpenCV and Python.

imutils A series of convenience functions to make basic image processing functions such as translation, rotation, resizing, skeletonization, and displ

PyImageSearch 4.3k Jan 01, 2023
Tweet2Image - Convert tweets to Instagram-friendly images.

Convert tweets to Instagram-friendly images. How to use If you want to use this repository as a submodule, don't forget to put the fonts d

Janu Lingeswaran 1 Mar 11, 2022