Skip to content

Commit 3b629e5

Browse files
committed
updated readme
1 parent fbdc7ed commit 3b629e5

File tree

1 file changed

+67
-15
lines changed

1 file changed

+67
-15
lines changed

README.md

Lines changed: 67 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,85 @@
1+
# SLTK
2+
3+
SLTK stands for Structured Light Took Kit. These are a collection of open source command line and GUI tools I have written with the intention of making operation of DIY structured light systems easier for myself. An effort has been made to separate the tools into logical units of work. It is possible to run the display program, the camera capture program, and the control program all on separate networked computers.
4+
5+
Here's an example of a sea shell generated from 74 aligned pointclouds captured using a raspberry pi v1 camera + sony mp-cl1 projector + arduino-based turntable (~5deg per turn): [https://sketchfab.com/models/5def256988594fae93ceb69b59fabbcc](https://sketchfab.com/models/5def256988594fae93ceb69b59fabbcc)
6+
7+
Two sets of raw+processed data from individual sea shell scans are available in the sampledata directory, along with the associated projector/camera calibration file.
8+
9+
## Uses
10+
11+
* Finding **intrinsic camera calibration**: 3x3 matrix + radial/tangential distortion coefficients
12+
* Finding **intrinsic projector calibration**: 3x3 matrix + radial/tangential distortion coefficients
13+
* Finding **extrinsic matrix** for a stereo camera + projector setup
14+
* Calculating **correspondence map** between camera and display pixels (screen or projector)
15+
* Generating **3D point clouds** from **correspondence data** and **intrinsic+extrinsic calibration data**
16+
* Rendering a **visualization of calibration data** with rainbow color map and isolines of distortion magnitude per pixel
17+
* **Displaying** timed structured light patterns via graphics adapter to display or projector
18+
* **Capturing** timed images of structured light patterns via camera input
19+
* **Automated rotation** of objects using a basic arduino stepper motor turntable
20+
* **Merging multiple point clouds** for generating a static background point set to allow automated cleanup
21+
* **Background subtraction** for cleaning up 3D point clouds by specifying a "background" point set
22+
* **Automated alignment** of 3D point clouds (requires background subtraction to remove static objects)
23+
* **Cultural Heritage Preservation**
24+
125
## Synopsis
226

3-
The main goal of structured light scanning is to calculate the dense correspondence between camera pixels and output pixels. By displaying black and white patterns to signal 0 and 1, a flat panel display or projector can simply "speak in binary" the pixel coordinates to the camera. Multiple patterns are shown to signal each bit of the per-pixel address code (e.g. x output pixel address equals 10 -> binary 1010 so white-black-white-black is displayed at that output device pixel). The process of decoding images of displayed black-white patterns is executed as a simple rule for all camera pixels (was pixel bright or not).
27+
This collection of programs is intended to be used to create dense 3D pointclouds of semi-matte objects.
28+
This toolkit requires hardware in order to scan objects. Hardware tried for development includes:
29+
30+
1) raspberry pi (v3 model b and zero)
31+
2) rpi camera (v1 and v2)
32+
3) flatscreen LCD monitor
33+
4) projector
34+
5) turntable
435

5-
Binary gray code structured light scanning involves displaying, capturing, and parsing sequences of black and white patterns. Uses include camera lens calibration and 3D point cloud reconstruction. By displaying specific patterns (on a display or projector) and capturing images of them, it is possible to calculate the correspondence between camera pixels and outut device pixels. More details available at https://en.wikipedia.org/wiki/Correspondence_problem https://en.wikipedia.org/wiki/Structured_Light_3D_Scanner
36+
## mjpeg-streamer [external tool]
37+
38+
This third party program (https://github.com/jacksonliam/mjpg-streamer) continuously captures images from a camera and streams them over the network. A fork is used in this case to specifically ensure support for the rpi camera, although it should be possible to use other cameras. Please see mjpg-streamer docs for more info.
39+
Requires: camera
640

741
## sldisp
842

9-
Tool for displaying binary gray code patterns using an output device (e.g. LCD screen, DLP projector). Receives pattern change instructions over network (default localhost). Pattern input is OSC packets /sl/iii (int,int,int) for (bit,axis,inverted) 0=false, 1=true
43+
Tool for generating structured light patterns. Supports binary gray code, sinusoid, and monochrome RGB pattern outputs. Receives OSC messages and updates output pattern.
44+
Requires: display device (e.g. LCD screen, DLP projector), slcapture
45+
46+
## slcapture.py
47+
48+
Main control program: streams images continuously from an mjpg-streamer server while triggering preset pattern sequences on an sldisp client.
49+
Each "scan" output is really just a directory of images, each taken while a specific structured light pattern is displayed. These scans are processed by slcrunch.
50+
Requires: mjpg-streamer, camera, sldisp, display device
1051

1152
## slcrunch
1253

13-
A tool for processing image sequences of binary gray code patterns into correspondence data or 3D point clouds. Takes a list of images as input. See listcreator for format of input file list.
54+
A tool for processing image sequences of e.g. binary gray code patterns into raw correspondence data or 3D point clouds. Requires *accurate* projector-camera calibration file in order to generate useful point clouds. Takes a list of images as input. See sampledata directory for list format.
1455

1556
## slcalibrate
1657

17-
A tool for camera and projector lens calibration, as well as camera-projector registration. For camera lens calibration, a flatscreen display is used to show patterns and only camera~display correspondence data is required. For projector-camera calibration, a camera, projector, and a flat printed chessboard pattern is needed (see slcrunch -help for details).
58+
A tool for camera and projector lens calibration, as well as camera-projector registration. For camera lens calibration, a flatscreen display is used to show binary gray code patterns and only camera~display correspondence data is required. For projector-camera calibration, a camera, projector, and a flat printed chessboard pattern is needed (see slcrunch -help for details). See wiki for more info.
1859

1960
## chessgen
2061

2162
A tool for generating images of chess patterns for lens calibration. Specify edge length in pixels, number of x/y inner corners, and x/y image output dimensions.
2263

2364
## plotlens
2465

25-
This program creates an image visualizing image distortion using calibration data input. Helpful for understanding calibration data.
66+
This program creates an image visualizing image distortion using calibration data input. Helpful for understanding quality of calibration data.
2667

2768
## plyalign
2869

29-
(WIP) Tool for automatically aligning multiply .PLY 3D pointcloud files. Specify .PLY files in sequential order, and repeated rotation from scan to scan is estimated.
70+
(WIP) Tool for automatically aligning multiple .PLY 3D pointcloud files. Specify .PLY files in sequential order, and repeated rotation from scan to scan is estimated.
71+
72+
## plymerge
73+
74+
Tool for merging multiple .PLY 3D pointcloud files. Combines all input files into one as-is with no alignment performed. Handy for making background subtraction files for speedy cleanup.
3075

3176
## plytrim
3277

33-
(WIP) Tool for trimming .PLY 3D pointcloud files. Specify center coordinates and dimensions of 3D axis-aligned bounding box.
78+
Tool for trimming .PLY 3D pointcloud files. Input a primary/reference pointcloud + distance X: all points in primary set within X units of any point in reference are removed. Output file only contains points in primary set which have no neighbors within X units in reference set.
3479

3580
## listcreator
3681

37-
This program creates a file containing a list of images in a sequence. Since image sequences need to be processed as a whole, image filename lists are used to pass them to slcrunch and slcalibrate. Capture programs should generate lists automatically, as in guppy_cap.cpp.
82+
This program creates a file containing a list of images in a sequence. Since image sequences need to be processed as a group, image filename lists are used to pass them to slcrunch and slcalibrate. Capture programs should generate lists automatically, as in slcapture.py. This tool is a manual fallback.
3883

3984
## Prerequisites
4085

@@ -45,16 +90,23 @@ opencv2 pcl2 liblo sdl2 flann boost
4590

4691
Built using: OpenCV(2.4.10), SDL2(2.0.3), liblo(0.28), exiftool(9.69), on Mac OS X 10.10.2, 10.11.6, 10.12
4792

48-
Some programs link with OpenCV, an open source image processing library <http://opencv.org/>.
93+
mjpg-streamer is used to ingest camera data <https://github.com/jacksonliam/mjpg-streamer>
94+
Some programs link with OpenCV, an open source image processing library <http://opencv.org/>
4995
slcrunch calls the exiftool program for reading image metadata. <http://www.sno.phy.queensu.ca/~phil/exiftool/>
50-
sldisp links with SDL2, a user interface library. More information at <https://www.libsdl.org/>.
96+
sldisp links with SDL2, a user interface library. More information at <https://www.libsdl.org/>
5197
Some programs with liblo, an Open Sound Control library for packet communication. <http://opensoundcontrol.org/implementations>
5298

53-
I have a basic Makefile; it should compile all the tools with "make" or individual ones with a target e.g. "make slcrunch".
99+
I have prepared a basic Makefile; it should compile all the tools with "make" or individual ones with a target e.g. "make slcrunch". Could use some work.
100+
101+
## Separation of tasks
54102

55-
## Use
103+
sltk is split up into standalone command line programs, each meant to handle a separate set of tasks in a structured light processing workflow.
56104

57-
sltk is comprised of various standalone command-line programs to handle separate tasks for structured light scanning. For capturing, sldisp is run on the computer connected to the output device (e.g. monitor, projector) in order to show structured light patterns. A corresponding capture program (e.g. slcapture.py) is run on the computer connected to the input device (e.g. firewire/usb camera). By default, both computers are the same and sldisp/guppy_cap communicate over localhost via OSC UDP packets.
105+
mjpg-streamer is run on a computer connected to a supported camera.
106+
sldisp is run on a computer connected to a flatscreen or projector.
107+
slcapture.py talks to the two programs above to display sequences of patterns and save images of each in a directory
108+
slcrunch processes a directory of images into a correspondence file, or into a 3D point cloud with appropriate calibration input file
109+
slcalibrate processes correspondence files and outputs calibration data for cameras and projectors
58110

59111
Typical lens calibration consists of a camera-monitor (flatscreen display) setup, with sldisp showing structured light patterns on the display. guppy_cap is used to capture image sequences, which are processed into camera-display correspondence data with slcrunch. Once you've collected enough different viewpoints of a flatscreen monitor, the correspondence data is passed to slcalibrate. Calibration output from slcalibrate includes camera matrix, camera distortion coefficients, and camera pixel dimensions.
60112

@@ -65,6 +117,6 @@ Calibration output can be visualized using plotlens to see a color mapped distor
65117
slcalibrate can take previous calibration files for camera or projector, to reuse intrinsic calibration data. Used for camera-projector registration.
66118

67119

68-
## RPI example
120+
## RPI example hardware
69121

70122

0 commit comments

Comments
 (0)