├── LICENSE ├── Makefile ├── README.md ├── chessfind.cpp ├── chessgen.cpp ├── hid.h ├── hid_LINUX.c ├── hid_MACOSX.c ├── hid_WINDOWS.c ├── img ├── calibration_objects.png ├── img_0020.jpg ├── img_0042.jpg ├── lensplot_camera.jpg ├── lensplot_projector.png ├── slcontrol_gui.png ├── slcontrol_gui_simple.png ├── slscan_0000_x.png ├── slscan_0001_x.png ├── slscan_0002_x.png ├── slscan_0003_x.png ├── slscan_0004_x.png └── sltk_network_topo.png ├── listcreator.cpp ├── plotlens.cpp ├── plyalign.cpp ├── plymerge.cpp ├── plytrim.cpp ├── ports.h ├── sampledata ├── procam_2016_12_09.yaml ├── scan_0020 │ ├── 1481302049.551275_[00-10-00_00]_img.jpg │ ├── 1481302051.228189_[00-10-01_01]_img.jpg │ ├── 1481302053.097507_[00-09-00_02]_img.jpg │ ├── 1481302054.693405_[00-09-01_03]_img.jpg │ ├── 1481302056.432740_[00-08-00_04]_img.jpg │ ├── 1481302058.218591_[00-08-01_05]_img.jpg │ ├── 1481302059.821438_[00-07-00_06]_img.jpg │ ├── 1481302061.644733_[00-07-01_07]_img.jpg │ ├── 1481302063.349134_[00-06-00_08]_img.jpg │ ├── 1481302065.111192_[00-06-01_09]_img.jpg │ ├── 1481302066.921491_[00-05-00_10]_img.jpg │ ├── 1481302068.727864_[00-05-01_11]_img.jpg │ ├── 1481302070.440745_[00-04-00_12]_img.jpg │ ├── 1481302072.160886_[00-04-01_13]_img.jpg │ ├── 1481302073.928258_[00-03-00_14]_img.jpg │ ├── 1481302075.812690_[00-03-01_15]_img.jpg │ ├── 1481302077.992064_[00-02-00_16]_img.jpg │ ├── 1481302080.107783_[00-02-01_17]_img.jpg │ ├── 1481302082.201916_[00-01-00_18]_img.jpg │ ├── 1481302084.359588_[00-01-01_19]_img.jpg │ ├── 1481302086.477428_[00-00-00_20]_img.jpg │ ├── 1481302088.519775_[00-00-01_21]_img.jpg │ ├── 1481302090.241762_[01-10-00_22]_img.jpg │ ├── 1481302091.783343_[01-10-01_23]_img.jpg │ ├── 1481302093.856558_[01-09-00_24]_img.jpg │ ├── 1481302095.419883_[01-09-01_25]_img.jpg │ ├── 1481302097.134070_[01-08-00_26]_img.jpg │ ├── 1481302098.811209_[01-08-01_27]_img.jpg │ ├── 1481302100.474787_[01-07-00_28]_img.jpg │ ├── 1481302101.993313_[01-07-01_29]_img.jpg │ ├── 1481302103.591916_[01-06-00_30]_img.jpg │ ├── 1481302105.259782_[01-06-01_31]_img.jpg │ ├── 1481302106.943372_[01-05-00_32]_img.jpg │ ├── 1481302108.550672_[01-05-01_33]_img.jpg │ ├── 1481302110.310776_[01-04-00_34]_img.jpg │ ├── 1481302112.068761_[01-04-01_35]_img.jpg │ ├── 1481302114.069967_[01-03-00_36]_img.jpg │ ├── 1481302115.951540_[01-03-01_37]_img.jpg │ ├── 1481302118.111106_[01-02-00_38]_img.jpg │ ├── 1481302120.067323_[01-02-01_39]_img.jpg │ ├── 1481302122.272422_[01-01-00_40]_img.jpg │ ├── 1481302124.524852_[01-01-01_41]_img.jpg │ ├── 1481302126.814440_[01-00-00_42]_img.jpg │ ├── 1481302128.658200_[01-00-01_43]_img.jpg │ └── list.yaml ├── scan_0020_cloud.ply ├── scan_0020_rgb.png ├── scan_0020_x.png ├── scan_0020_y.png ├── scan_0021 │ ├── 1481302134.569065_[00-10-00_00]_img.jpg │ ├── 1481302136.260798_[00-10-01_01]_img.jpg │ ├── 1481302137.958477_[00-09-00_02]_img.jpg │ ├── 1481302139.667311_[00-09-01_03]_img.jpg │ ├── 1481302141.382543_[00-08-00_04]_img.jpg │ ├── 1481302142.909362_[00-08-01_05]_img.jpg │ ├── 1481302144.507198_[00-07-00_06]_img.jpg │ ├── 1481302146.247567_[00-07-01_07]_img.jpg │ ├── 1481302147.954800_[00-06-00_08]_img.jpg │ ├── 1481302149.510018_[00-06-01_09]_img.jpg │ ├── 1481302151.089475_[00-05-00_10]_img.jpg │ ├── 1481302152.776329_[00-05-01_11]_img.jpg │ ├── 1481302154.489242_[00-04-00_12]_img.jpg │ ├── 1481302156.228349_[00-04-01_13]_img.jpg │ ├── 1481302158.227796_[00-03-00_14]_img.jpg │ ├── 1481302160.113026_[00-03-01_15]_img.jpg │ ├── 1481302162.296677_[00-02-00_16]_img.jpg │ ├── 1481302164.419688_[00-02-01_17]_img.jpg │ ├── 1481302166.686413_[00-01-00_18]_img.jpg │ ├── 1481302168.889501_[00-01-01_19]_img.jpg │ ├── 1481302171.227893_[00-00-00_20]_img.jpg │ ├── 1481302173.311780_[00-00-01_21]_img.jpg │ ├── 1481302175.124420_[01-10-00_22]_img.jpg │ ├── 1481302176.999838_[01-10-01_23]_img.jpg │ ├── 1481302179.068261_[01-09-00_24]_img.jpg │ ├── 1481302180.736684_[01-09-01_25]_img.jpg │ ├── 1481302182.607842_[01-08-00_26]_img.jpg │ ├── 1481302184.409653_[01-08-01_27]_img.jpg │ ├── 1481302186.183244_[01-07-00_28]_img.jpg │ ├── 1481302188.097698_[01-07-01_29]_img.jpg │ ├── 1481302189.663182_[01-06-00_30]_img.jpg │ ├── 1481302191.427853_[01-06-01_31]_img.jpg │ ├── 1481302193.053982_[01-05-00_32]_img.jpg │ ├── 1481302194.826318_[01-05-01_33]_img.jpg │ ├── 1481302196.498860_[01-04-00_34]_img.jpg │ ├── 1481302198.243962_[01-04-01_35]_img.jpg │ ├── 1481302200.161184_[01-03-00_36]_img.jpg │ ├── 1481302202.135805_[01-03-01_37]_img.jpg │ ├── 1481302204.286687_[01-02-00_38]_img.jpg │ ├── 1481302206.559777_[01-02-01_39]_img.jpg │ ├── 1481302208.680940_[01-01-00_40]_img.jpg │ ├── 1481302210.667195_[01-01-01_41]_img.jpg │ ├── 1481302213.082432_[01-00-00_42]_img.jpg │ ├── 1481302214.992067_[01-00-01_43]_img.jpg │ └── list.yaml ├── scan_0021_cloud.ply ├── scan_0021_rgb.png ├── scan_0021_x.png ├── scan_0021_y.png └── slcrunch_log.txt ├── sl_util.cpp ├── sl_util.h ├── slcalibrate.cpp ├── slcapture.py ├── slcontrol ├── sketch.properties └── slcontrol.pde ├── slcrunch.cpp ├── sldisp.cpp ├── slpy.py ├── slturn.cpp ├── teensy_turntable └── teensy_turntable.ino ├── util.cpp └── util.h /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 John De Witt 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | # chessfind.cpp 3 | # chessgen.cpp 4 | # listcreator.cpp 5 | # plotlens.cpp 6 | # plyalign.cpp 7 | # plytrim.cpp 8 | # slcalibrate.cpp 9 | # slcrunch.cpp 10 | # sldisp.cpp 11 | # slturn.cpp 12 | 13 | #OS = LINUX 14 | #OS = MACOSX 15 | #OS = WINDOWS 16 | 17 | CC=g++ 18 | CFLAGS=#-Wall -O3 19 | CLIB=-lstdc++ 20 | LDFLAGS= 21 | SOURCES= 22 | FLAGS_FLANN=`pkg-config --libs --cflags flann` 23 | FLAGS_OPENCV=`pkg-config --libs --cflags opencv` 24 | FLAGS_BOOST=-lboost_system 25 | FLAGS_VTK=-I/usr/local/Cellar/vtk/7.0.0_6/include/vtk-7.0 -L/usr/local/Cellar/vtk/7.0.0_6/lib 26 | PCL_V=1.8 27 | PCL_MODULES=pcl_common-$(PCL_V) pcl_io-$(PCL_V) pcl_kdtree-$(PCL_V) pcl_registration-$(PCL_V) pcl_segmentation-$(PCL_V) pcl_visualization-$(PCL_V) pcl_search-$(PCL_V) 28 | FLAGS_PCL=`pkg-config --libs --cflags $(PCL_MODULES)` 29 | FLAGS_EIGEN=`pkg-config --libs --cflags eigen3` 30 | FLAGS_OSC=`pkg-config --libs --cflags liblo` 31 | FLAGS_SDL=`sdl2-config --static-libs --cflags` 32 | 33 | FLAGS_GL= 34 | 35 | ifeq ($(OS),Windows_NT) 36 | 37 | else 38 | UNAME_S := $(shell uname -s) 39 | ifeq ($(UNAME_S),Linux) 40 | FLAGS_GL=-lGL -lGLU -lglut 41 | SYSARG=-lusb 42 | HID=hid_LINUX.c 43 | endif 44 | ifeq ($(UNAME_S),Darwin) 45 | #CC="clang++" 46 | #CLIB="-std=c++11" 47 | #CLIB="-std=c++0x" 48 | FLAGS_GL=-framework OpenGL 49 | OSXSDK=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk 50 | SYSARG=-isysroot $(OSXSDK) -framework IOKit -framework CoreFoundation 51 | HID=hid_MACOSX.c 52 | endif 53 | endif 54 | 55 | main_tools: sldisp slcrunch slcalibrate plotlens chessgen chessfind listcreator 56 | ply_tools: plyalign plytrim plymerge 57 | 58 | all: main_tools 59 | 60 | bin: 61 | @mkdir -p bin 62 | 63 | slturn: bin slturn.cpp hid.o 64 | $(CC) $(CFLAGS) $(CLIB) $(SYSARG) $(HID) $(FLAGS_OSC) slturn.cpp -o bin/slturn 65 | 66 | sldisp: bin sldisp.cpp util.o 67 | $(CC) $(CFLAGS) $(CLIB) sldisp.cpp util.cpp -o bin/sldisp $(FLAGS_SDL) $(FLAGS_OSC) $(FLAGS_GL) 68 | 69 | slcrunch: bin slcrunch.cpp util.o sl_util.o 70 | $(CC) slcrunch.cpp util.cpp sl_util.cpp -o bin/slcrunch $(CFLAGS) $(CLIB) $(FLAGS_OPENCV) 71 | 72 | slcalibrate: bin slcalibrate.cpp util.o 73 | $(CC) slcalibrate.cpp util.cpp -o bin/slcalibrate $(CFLAGS) $(CLIB) $(FLAGS_OPENCV) 74 | 75 | plotlens: bin plotlens.cpp util.o sl_util.o 76 | $(CC) plotlens.cpp util.cpp sl_util.cpp -o bin/plotlens $(CFLAGS) $(CLIB) $(FLAGS_OPENCV) 77 | 78 | plyalign: bin plyalign.cpp util.o sl_util.o 79 | $(CC) plyalign.cpp util.cpp sl_util.cpp -o bin/plyalign $(CFLAGS) $(CLIB) $(FLAGS_VTK) $(FLAGS_EIGEN) $(FLAGS_PCL) $(FLAGS_OPENCV) $(FLAGS_FLANN) $(FLAGS_BOOST) 80 | 81 | plytrim: bin plytrim.cpp util.o sl_util.o 82 | $(CC) plytrim.cpp util.cpp sl_util.cpp -o bin/plytrim $(CFLAGS) $(CLIB) $(FLAGS_VTK) $(FLAGS_EIGEN) $(FLAGS_PCL) $(FLAGS_OPENCV) $(FLAGS_FLANN) $(FLAGS_BOOST) 83 | 84 | plymerge: bin plymerge.cpp util.o sl_util.o 85 | $(CC) plymerge.cpp util.cpp sl_util.cpp -o bin/plymerge $(CFLAGS) $(CLIB) $(FLAGS_EIGEN) $(FLAGS_PCL) $(FLAGS_OPENCV) $(FLAGS_FLANN) $(FLAGS_BOOST) 86 | 87 | chessgen: bin chessgen.cpp util.o 88 | $(CC) chessgen.cpp util.cpp -o bin/chessgen $(CFLAGS) $(CLIB) $(FLAGS_OPENCV) 89 | 90 | chessfind: bin chessfind.cpp util.o 91 | $(CC) chessfind.cpp util.cpp -o bin/chessfind $(CFLAGS) $(CLIB) $(FLAGS_OPENCV) 92 | 93 | listcreator: bin listcreator.cpp 94 | $(CC) listcreator.cpp -o bin/listcreator $(CFLAGS) $(CLIB) $(FLAGS_OPENCV) 95 | 96 | #hid.o: hid_$(OS).c hid.h 97 | hid.o: $(HID) hid.h 98 | $(CC) $(CFLAGS) -c -o $@ $< 99 | 100 | util.o: util.cpp util.h 101 | $(CC) -c -o util.o util.cpp 102 | 103 | sl_util.o: sl_util.cpp sl_util.h 104 | $(CC) -c -o sl_util.o sl_util.cpp 105 | 106 | clean: 107 | rm -f util.o sl_util.o 108 | rm -f bin/slturn bin/sldisp bin/slcrunch bin/slcalibrate bin/plotlens bin/plyalign bin/plytrim bin/chessgen bin/chessfind bin/listcreator 109 | rmdir bin 110 | 111 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 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 | 25 | ## Synopsis 26 | 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 35 | 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 40 | 41 | ## sldisp 42 | 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 51 | 52 | ## slcrunch 53 | 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. 55 | 56 | ## slcalibrate 57 | 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. 59 | 60 | ## chessgen 61 | 62 | 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. 63 | 64 | ## plotlens 65 | 66 | This program creates an image visualizing image distortion using calibration data input. Helpful for understanding quality of calibration data. 67 | 68 | ## plyalign 69 | 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. 75 | 76 | ## plytrim 77 | 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. 79 | 80 | ## listcreator 81 | 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. 83 | 84 | ## Prerequisites 85 | 86 | Need installed: 87 | opencv2 pcl2 liblo sdl2 flann boost 88 | 89 | ## Building 90 | 91 | 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 92 | 93 | mjpg-streamer is used to ingest camera data 94 | Some programs link with OpenCV, an open source image processing library 95 | slcrunch calls the exiftool program for reading image metadata. 96 | sldisp links with SDL2, a user interface library. More information at 97 | Some programs with liblo, an Open Sound Control library for packet communication. 98 | 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 102 | 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. 104 | 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 110 | 111 | 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. 112 | 113 | Typical projector calibration consists of a camera-projector setup, with sldisp showing structured light patterns on the projector. guppy_cap is used to capture image sequences of a flat chess calibration pattern, which are processed into camera-chess-projector correspondence data with slcrunch Once you've collected enough different viewpoints of the chess pattern, the correspondence data is passed to slcalibrate. Calibration output includes camera matrix, camera distortion, projector matrix, projector distortion, etc. Separate calibration of lens and projector is strongly recomended. 114 | 115 | Calibration output can be visualized using plotlens to see a color mapped distortion image. 116 | 117 | slcalibrate can take previous calibration files for camera or projector, to reuse intrinsic calibration data. Used for camera-projector registration. 118 | 119 | 120 | ## RPI example hardware 121 | 122 | 123 | -------------------------------------------------------------------------------- /chessfind.cpp: -------------------------------------------------------------------------------- 1 | #include "opencv2/core/core.hpp" 2 | #include "opencv2/calib3d/calib3d.hpp" 3 | #include "opencv2/imgproc/imgproc.hpp" 4 | #include "opencv2/highgui/highgui.hpp" 5 | //#include 6 | 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | using namespace cv; 13 | using namespace std; 14 | 15 | // specify board width and height 16 | // specify output image size 17 | // specify (optional) pixel size of squares 18 | 19 | static void help(){ 20 | printf("This is a chessboard pattern detector.\n" 21 | "Usage: chessfind \n" 22 | " -x # the number of inner corners on the horizontal dimension\n" 23 | " -y # the number of inner corners on the vertical dimension\n" 24 | " -s # the square edge length in preferred units\n" 25 | " -save # enable saving of the pattern\n" 26 | " -show # enable display of the pattern\n" 27 | "\n" ); 28 | } 29 | 30 | int main(int argc, char** argv){ 31 | 32 | Size boardSize,imageSize; 33 | int sqrSize = -1; 34 | bool save_image = false; 35 | bool show_image = false; 36 | 37 | 38 | imageSize = Size(1024,768); 39 | // parse arguments 40 | if( argc < 2 ) 41 | { 42 | help(); 43 | return 0; 44 | } 45 | 46 | for(int i=1;i 6 | 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | using namespace cv; 13 | using namespace std; 14 | 15 | // specify board width and height 16 | // specify output image size 17 | // specify (optional) pixel size of squares 18 | 19 | static void help(){ 20 | printf("This is a chessboard pattern generator.\n" 21 | "Usage: chessgen