Structuredlight
Generate and Decode structured light. Binary, Gray, XOR, Ramp, Phase-Shifting, Stripe.
Install / Use
/learn @elerac/StructuredlightREADME
Structured Light
These programs generate and decode structured light.
Currently supports
Installation
pip install git+https://github.com/elerac/structuredlight
Usage
import structuredlight as sl
width = 640
height = 480
gray = sl.Gray()
imlist_pattern = gray.generate((width, height))
# Projecting patterns from a projector (or display) and capture images
imlist_captured = imlist_pattern
img_index = gray.decode(imlist_captured, thresh=127)
print(img_index)
# [[ 0 1 2 ... 637 638 639]
# [ 0 1 2 ... 637 638 639]
# ...
# [ 0 1 2 ... 637 638 639]]
Supported structured light
Binary code

binary = sl.Binary()
imlist = binary.generate((width, height))
img_index = binary.decode(imlist, thresh=127)
Gray code

gray = sl.Gray()
imlist = gray.generate((width, height))
img_index = gray.decode(imlist, thresh=127)
XOR code

xor = sl.XOR(index_last=-1)
imlist = xor.generate((width, height))
img_index = xor.decode(imlist, thresh=127)
Ramp code

ramp = sl.Ramp()
imlist = ramp.generate((width, height))
img_index = ramp.decode(imlist)
Phase-Shifting

phaseshifting = sl.PhaseShifting(num=3)
imlist = phaseshifting.generate((width, height))
img_index = phaseshifting.decode(imlist)
Single stripe

stripe = sl.Stripe()
imlist = stripe.generate((width, height))
img_index = stripe.decode(imlist)
Tips
How to binarize a grayscale image
Some of the code (Binary, Gray, XOR, ...) needs to binarize. This program provides three methods. See the wiki for details.
How to display images in full screen
When you use structured light, you'll need a full screen display from a projector or display. Here is a program to display the image in full screen.
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
85.3kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
342.5kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
