The Kinect is a peripheral for the Xbox 360 console that allows a user to interact with the Xbox 360 without touching a controller. A general description of the Kinect is that it is a depth camera. This means that you can place objects in front of it, and it will compute the distance from it to the objects, thus creating a depth image. Therefore, the Kinect can provide the locations of objects in an image relative to itself, and this information can be used in a variety of projects. Also, the Kinect contains many components that, with slight modifications, can be used for new purposes. As an example, this project will show how the Kinect can be used as an infrared (IR) camera.
For a detailed description of how the Kinect works and how it can be used in different projects, I recommend that you read Making Things See by Greg Borenstein (http://shop.oreilly.com/product/06369200…). The image in Step 1 shows the components of the Kinect that are necessary to understand this project. The IR projector shines a grid of IR dots on the objects in front of it. We are not able to see the dots, but the IR camera can detect them. Using the pattern of dots on each object, the Kinect is able to compute the depth image. The final component is an RGB camera that is similar to a standard webcam.
Step #1: Install the software necessary to connect the Kinect to your computerNext
- Follow the platform-specific instructions here to:
- Install Processing
- Install OpenNI, NITE, Sensor, and SensorKinect drivers
- Install SimpleOpenNI library for Processing
Step #2: Verify that the installation was successfulNext
- Start Processing and run the DepthImage and DepthInfrared examples.
- Provide power to your Kinect and connect it to your computer via the USB port.
- Go to File→Examples→Contributed Libraries→SimpleOpenNI→OpenNI.
- Double-click on the example that you wish to run (for example, DepthInfrared), and the example script will open.
- Click on the run button, and an image will appear on your screen. For the DepthInfrared script, a depth image will be on the left and an IR image will be on the right, as shown on the left.
Step #3: Block the IR projectorNext
- As can be seen in the previous step, the IR image produced by the DepthInfrared script contains a pattern of dots that we wish to remove.
- To do this, create a blindfold to cover the IR projector.
- Take two strips of duct tape, each longer than 9 inches, and place one such that it slightly overlaps the other. Then repeat using two more strips of duct tape.
- Take the two strips of double-wide duct tape and place them sticky sides together.
- Cut the resulting strip to 9 inches in length.
- Place Velco pads on one end of the strip, wrap the strip around the Kinect, covering the IR projector, and place the opposite Velco pads such that the strip is held tight, as shown on the left.
Step #4: Build the IR lampsNext
- Now that the IR projector has been blocked, there is no longer enough IR light for the IR camera to generate a good image.
- Therefore, external IR lighting needs to be added. The circuit diagram on the left shows one possible design for two IR lamps.
- Connect the DC power supply to the power jack and measure its voltage (VDC) using a multimeter. For my power supply, VDC = 15.6 V.
- Look up the typical forward voltage (VF) and maximum forward current (IF,max) of the LEDs. Mine were VF = 1.5 V and IF = 20 mA, respectively.
- Compute the resistance (R1=R2=R3=R4) necessary to limit the current through each series of six LEDs. I used 360 Ω resistors. R > ((VDC - (# of LEDs)*VF)/IF)
Step #5: Build the IR lamps (continued)Next
- On one half of a PCB, place six LEDs and one resistor. Solder wires connecting the LEDs, cathode to anode, and the resistor. Repeat for the other half of the PCB. Then solder a wire connecting the free anodes and another wire connecting the free end of the resistors.
- Solder a long, red wire to the connected anodes and a long, black wire to the connected resistors.
- (optional) Use Sugru to hold the long wires to the PCB in order to provide some strain relief.
- Poke holes in the bottom of a plastic cup, feed the wires through the hole, and press the PCB tightly into the cup. If the PCB does not fit tightly, use Sugru to hold it in place.
- Repeat the previous four steps for the second lamp.
Step #6: Build the lamp intensity controllerNext
- Use calipers to measure the sizes of the holes necessary to mount the two pots, switch, fuse holder, and power jack.
- Drill holes in the project enclosure and mount the hardware. Also, drill two small holes for the wires to enter. When planning on where to place each hole, keep in mind where each part will sit in the enclosure, in order to make sure that everything fits.
- You will need to open the hole for the power jack using a Dremel tool or with a knife.
- Place Sugru on the inside and outside of the enclosure to hold the jack in place.
Step #7: Build the lamp intensity controller (continued)Next
- Turn each pot to the position that will be the low setting and then use your multimeter’s continuity tester to find the two pins that will be used in the circuit (the tester will beep).
- Also, use the continuity tester to determine which two pins on the switch are connected when the switch is up and which are connected when the switch is down.
- Solder short wires connecting the parts within the enclosure, according to the circuit diagram.
- Solder two long, red wires to the pots and two long, black wires to the switch, and then poke them through the two small holes.
- Screw on the enclosure's lid and place a fuse in the fuse holder.
- Twist the wires exiting the lamps together with the wires entering the controller (red-to-red, black-to-black), solder if necessary, then cover the exposed wires with electrical tape.
Step #8: Mount the Kinect and lampsNext
- Place the Kinect on a surface, pointed at the object that you wish to image.
- (optional) Connect the Kinect to the tripod connector and then to a tripod. Connect the tripod to a ring stand, and position it in front of the imaging surface.
- Mount the lamps in an orientation such that the imaging surface will be illuminated.
- (optional) Connect the lamps to the ring stand and hold them in position with the clamps, hinges, and tape.
- Plug the wall-adapter power supply into an outlet and then connect it to the lamp intensity controller via the power jack.
Step #9: Perform the experimentNext
- Take a piece of construction paper and draw one object on the left side and another on the right side, using a charcoal pencil.
- Color over the left object with the phthalo blue pastel and color over the right object with the Prussian blue pastel.
- Place the paper in front of the camera.
- Open Processing, create scripts rgb_save.pde and ir_save.pde (code is provided in the attached code.pdf), modify the code such that the files and path names are appropriate for your computer, run rgb_save.pde, and then run ir_save.pde.
- Turn on the lamps by flipping the switch, and then adjust the intensity using the knobs on the controller. You will not be able to see the IR light emitted by the LEDs, so use the IR video captured by the camera to determine the desired intensity. You will need to run the two scripts again, after adjusting the lamps.
- The resulting image, shown on the left, should show a color image at the top and an IR video at the bottom. The results show that the two pigments look similar in the color portion of the spectrum, but very different in the IR portion.
- For a detailed description of the science behind this experiment, I recommend that you read the papers by Delaney et al. listed in the references.
Step #10: ReferencesNext
- Simple-openni Wiki (last accessed 20 April 2012). *** The examples included with the toolbox are particularly helpful.
- Borenstein, Greg, Making Things See, O’Reilly Media, Inc., 978-1-449-30707-3, January 2012.
- Reas, Casey and Ben Fry, Getting Started with Processing, O’Reilly Media, Inc., 978-1-449-37980-3, June 2010.
- Blake, Joshua, "Kinect Hacking", Make:, Volume 29, 124-133, http://makeprojects.com/Wiki/29#Section_... (last accessed 20 April 2012).
- Delaney, John K., Elizabeth Walmsley, Barbara H. Berrie, and Colin F. Fletcher, “Multispectral Imaging of Paintings in the Infrared to Detect and Map Blue Pigments”, (Sackler NAS Colloquium) Scientific Examination of Art: Modern Techniques in Conservation and Analysis, Proceedings of the National Academy of Sciences, 120-136, http://www.nap.edu/catalog/11413.html (last accessed 20 April 2012), 0-309-54961-2, 2005.
- Delaney, John K., Jason G. Zeibel, Mathieu Thoury, Roy Littleton, Kathryn M. Morales, Michael Palmer, E. René de la Rie, “Visible and Infrared Reflectance Imaging Spectroscopy of Paintings: Pigment Mapping and Improved Infrared Reflectography”, Q3A: Optics for Arts, Architecture, and Archaeology II, edited by Luca Pezzati and Renzo Salimbeni, Proc. of SPIE Vol. 7391, 2009.
Step #11: Acknowledgments
- The author wishes to thank Dr. Murray Loew, of George Washington University, and Dr. John Delaney and Dr. E. Melanie Gifford, of the National Gallery of Art, Washington, D.C., for their feedback regarding the experimental setup.
- The author also wishes to acknowledge the scholarship support that he received from the Achievement Rewards for College Scientists (ARCS) Foundation.
NOTE: Once you have successfully installed the software for connecting the Kinect to your computer, the only required steps for completing this project are: 1) block the IR projector, 2) build and mount a replacement IR light source (with a center wavelength near 830 nm), and 3) experiment. The details of my apparatus and experiment are provided, but I encourage you to modify the details based on the parts and equipment that you have available and based on the things that you wish to image. Happy building!