Range Image Generator 

Mike Patterson

March 15, 2005

CPE – 570Q 



This program takes in a sequence of 2D images acquired from a structured light scanner I’ve been developing and generates a dense 3D point cloud.  The depth is derived from the weighted difference in x between a pixel in the projected slide and its corresponding pixel in the camera image, a naïve but effective method.  Correspondence is found by generating a lookup table from the projected slides – a temporal, binary encoding of each pixel position.  The lookup key is then generated for each pixel position from the camera images and used to find the corresponding pixel in the projector’s image space.



Download final.zip (56.2 MB).


usage:           Final -pPATH -uXXXXXXXX -b# -w# <-f# -l# || -s#> [additional flags]


example:      Final -ptiger -f1 -l1 -u0079837F -w29 -b30 -e.png




specify the all black reference image (# is the image file number)




specify the extension of the source images (.bmp is the default) where (EXT = .bmp).  Note the explicit use of the period.




specify the first image set to use (# is the image set number)




specify the last image set to use (# is the image set number)




write the opened image sets to the mri folder in the following format (x, y and z are floats; r, g and b are unsigned chars):




                height width


                x y z r g b


                                             <---- Blank lines indicate invalid pixel


                x y z r g b










specify where the image sets for the object are stored. For example, -ptiger , refers to "data/tiger".




specify one image set to use (# is the zero based set number)




specify which images in an image set to use for depth calculation. XXXXXXXX represents 32 bit flags in hex where an asserted bit means use the corresponding slide and object image.


   000000A5 uses slides {1, 3, 6, 8} and object images {0, 2, 5, 7}


   0079837F yields fast/good results with the included data set.




specify the all white reference image (# is the zero based file number)


Check out the shortcuts "Final 01", "Final 01-02" and "Final Use and Show ALL" for examples.  WARNING: "Final Use and Show ALL" takes a while to load.


Object Image Sets (numbered starting from zero)

Paths to image sets are relative to the "data" directory. The format of the file name must be as follows (all zero based):


   0SSSSIIII  (a zero followed by a four-digit, zero-padded set number followed by a four-digit, zero-padded image number)


   000030010  (eleventh image of the fourth set)


Any extension is specified with the -e flag above and any DevIL supported, 24 bit image should work.


Slides  (numbered starting from one)

The slide images must be placed in the "data/slides" directory and named as follows:


where ### is a zero-padded number starting at 001.  Any extension is specified with the -e flag above and any DevIL supported, 24 bit image should work.



Must be of the dimensions 1024 x 768 x 3 bytes.


General Controls:




start/stop rotation around y axis


rotate point cloud left


rotate point cloud right


rotate object positively around y axis


rotate object negatively around y axis


translate object along negative x axis


translate object along positive x axis


translate object along negative z axis


translate object along positive z axis


reset rotation


reset object translations


toggle AABB