Giter Club home page Giter Club logo

structuredlight's Introduction

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.

structuredlight's People

Contributors

elerac avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.