Build your own infrared camera

Operating the Camera

The camera displays a preview image with two buttons overlaid on the touch display (Figure 7). The left-hand button leads to the settings menu that also allows you to shut down the camera. The right-hand button lets you display all images you have captured. The remainder of the touch display serves as a quasi-button, in that it functions as the shutter. Thus, the way to take a picture is to select the image you want to capture and then touch the display. You will need to hold the camera as still as possible when taking a picture because of a slight shutter delay. In the original Adafruit software, this delay amounted to several seconds for the first image.

Figure 7: A touch of the finger on the touch display creates photographs. The symbol to the lower right opens the gallery. The one on the left opens the settings.

Technically speaking, the preview image consists of continuously captured and updated photos. The current generation of the display renders in the CPU. Therefore, the Python camera program continuously captures images in an endless loop that is used to update the display constantly.

It can be helpful to poke around in the Settings menu and familiarize yourself with what you can do there. For example, in addition to the size of an image, you can determine storage location, effects, and, in my customized modified version of the software, the white balance [10]. The special memory location Dropbox can send the images to the cloud immediately after they are captured. To set up this feature, you should configure an upload script as described in the Adafruit documentation.

In spite of the improvements I made, the modified control software remains rudimentary. This means that the scope of functions actually available on the camera cannot be fully utilized. However, extensions for the software can be implemented without too much effort, as I have done [10], thanks to Python and the program framework provided by Adafruit. It would make sense, for example, to think about implementing the storage of raw sensor data [11].

Finishing Process

The automatic cloud upload feature appears to be merely a gimmick – unless you are willing to wait after capturing an image for the software to load some 5MB via a mobile phone you have connected. It makes more sense to download images onto your home computer as you would with a normal camera and then edit the images there. With an integrated WiFi dongle, you don't need to play around with a memory card. The following command offers a simple way to load the images onto a Linux computer:

$ rsync -av --remove-source-files pi@<picam>:/home/pi/Photos/

You can replace the computer name <picam> with the IP address or the hostname of the camera. Once transmission is successful, the command immediately deletes the images from the camera.

The infrared images made by the Rasp Pi camera appear to be almost black and white and are washed out somewhat. This is because the NoIR module has not been optimized for use with IR photography [12]. Although the band elimination filter is absent, the focal length has not been modified. Users who want more satisfactory results can unscrew the lens a little.

As described at the outset, IR images contain color data, at least when you are using a filter that has a blocking frequency under 750nm. However, the color channels in a Rasp Pi camera differ only slightly from one another. Even so, you can get creative with an image by loading the photo into GIMP, selecting Colors | Levels, and separately modifying the area using the small triangle on each channel (Figure 8).

Figure 8: GIMP lets you optimize the color values of the image channel by channel.

After making this first corrective action, you can exchange the red and blue channels via the channel mixer (Figure 9). The program exchanges both channels completely. To make this process easier, copy the contents of Listing 5 into a file like swap-red-blue in the directory ~/.gimp-2.8/channel-mixer. By going to Tools | Color Tools | Hue-Saturation, you can increase or decrease the intensity of individual colors.

Listing 5

Channel Mixer Config File

# Channel Mixer Configuration File
RED: 0.000 0.000 1.000
GREEN: 0.000 1.000 0.000
BLUE: 1.000 0.000 0.000
BLACK: 1.000 0.000 0.000
Figure 9: Exchanging channels in the channel mixer: You can exchange the blue and red channels of the infrared image to achieve different effects.

Many additional techniques exist for improving an image. For example, you can increase contrast or sharpening. You can also transform the images into black and white. All you need to do is use GIMP to remove the last color remnants via Tools | Color Tools | Desaturate.

All in all, you can achieve some surprising results with a Rasp Pi camera and some image editing. You will find that even very expensive infrared cameras produce images with a softer mood, so you should not worry if this also happens with your Rasp Pi camera and its less sophisticated lenses and sensors.

Buy this article as PDF

Express-Checkout as PDF

Pages: 6

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • New Products

    What's new in the SBC, IoT, and maker realm

  • Working with the Raspberry Pi camera module

    The amazing Raspberry Pi camera module opens into a whole new world of useful projects. We'll show you how to use the Pi camera for time-lapse photography, and we'll even help you set up a motion-detecting surveillance camera.

  • Extensions for the Raspberry Pi

    The resourcefulness of private and commercial users has led to the creation of many practical and novel extensions for the Raspberry Pi. We provide an overview of some useful supplementary circuit boards.

  • Snapshot

    The remarkable Raspberry Pi has spawned a myriad of supporting projects – Android apps, program libraries, specialized Linux distributions, and an assortment of hardware accessories. The rapid changes within these projects is testament to the excitement and enthusiasm that developers around the world have given to the Raspberry Pi.

  • Building a video-enabled nest box

    We show you how to build a completely wired nest box that charts the movements of nesting birds and delivers photo images of hatchlings.