Saturday, April 12, 2008

Feature: CHDK: A Shot of Power for Your PowerShot


======================================================================
        The IMAGING RESOURCE DIGITAL PHOTOGRAPHY NEWSLETTER
======================================================================
 Volume 10, Number 8                                  11 April 2008
----------------------------------------------------------------------
     Copyright 2008, The Imaging Resource. All rights reserved.
----------------------------------------------------------------------
 
We've often wondered why digicams only get firmware updates to fix embarrassing problems that should have been caught in the prototype. Why aren't there any firmware updates that actually add cool new features?

A few Canon PowerShot owners must have been thinking the same thing. Lucky for the rest of us, they also write software. And the really fortunate part is they've started an open-source software project (free to use, free to modify) called the Canon Hacker's Development Kit to update PowerShots with, well, cool new features.

All you need is a PowerShot that uses a DIGIC II or DIGIC III processor and an SD card.

One of CHDK's coolest features, however, is how it works. You just load it on your memory card and activate it when you want to use it. It isn't technically a firmware update at all -- it just acts like one.

It only changes the code in the camera's memory (which disappears when you turn the power off), not the actual firmware burned into the camera's programmable memory chip. So you can't hurt the camera and you can always return the camera to its original behavior just as if nothing ever happened. Cool.

So what cool new features are we talking about? How about 1) a live histogram, 2) a battery status display, 3) a Raw file format and 4) the ability to run scripts written in a version of BASIC? For starters. There are other tweaks (like faster shutter speeds up to 1/10,000 second, depth of focus display, auto bracketing, higher compression Movie mode, long exposures up to 65 seconds, ability to use the USB port to trigger the shutter), too. More about those later.

It's all made possible by the ability of these guys to write new code for the DIGIC microprocessor in the camera.

INSTALLATION

Format an SD card in the camera to wipe it clean in a format the camera understands.

The first trick is to determine the current firmware version of your camera. There are different CHDK downloads for different cameras and firmware revisions.

To do this on a PowerShot you create an empty file called ver.req (version request) in the root directory of your SD card. There are various ways to do this but the FAQ gives (http://chdk.wikia.com/wiki/FAQ) explicit instructions for Linux, Windows and Mac systems. Just make sure you don't create a text file.

Then turn on your camera in Playback mode (you can't switch to it, you have to start from it) and hold down the Set key while you press the Display key. You'll see a line like "Firmware Ver GM1E."

Once you know your model number and firmware version, visit the CHDK download page (http://chdk.wikia.com/wiki/Downloads) to find the builds available for your camera. If there isn't one, you can check the Developer's page of the project to see if one's under development (http://chdk.wikia.com/wiki/For_Developers).

Among the possible CHDK builds, there's a standard one with the basic features but there may also be a special build (http://chdk.wikia.com/wiki/CHDK#Special_Builds) that implements extended features like syncing two PowerShots to take a stereo image (http://stereo.jpn.org/eng/sdm/index.htm) or firing the shutter when motion is detected.

Once you've found a build, download it and copy it to your memory card. There are two small files (about 110K each) to each build: PS.fir and Diskboot.bin that should be copied to the root directory of your SD card. There may be other folders and files to copy, too (hiding even more goodies like scripts).

With the card in the camera, start up in Playback mode and press the Menu button. Find the Firm Update option and confirm with the OK button. Your PowerShot will reboot.

If you get a splash screen, the firmware enhancement has been successfully loaded. If the camera hangs or does not respond to the Power button, the CHDK version isn't compatible with your camera. Just open the battery door and remove the batteries to turn the camera off, stick them back in and restart. No harm done.

You can set up the card so CHDK loads automatically any time you start the camera by using the program itself to make the card bootable and then locking the card. That won't prevent images from being stored on the card. But it only works on cards up to 2-GB in size.

FEATURES

To access these features, once CHDK has been loaded into memory, you have to slip into Alt mode by pressing a special key (configurable in the Alt menu), usually the Print or Shortcut key. Once in Alt mode (a small ALT tag is displayed at the bottom of the screen), press the Menu key to see what you can do.

Alt mode itself is only necessary to configure your options (but you'll want to do that; even the live histogram has lots of options), starting a script and other shortcuts.

An illustrated and comprehensive list of the functions available in CHDK is available at http://chdk.wikia.com/wiki/CHDK_firmware_usage.

Here's a quick list of features (some available only in special builds):

- Raw file format. Capturing the raw data from the sensor without processing it in the camera let's you make decisions with your image editing software that are usually automated in the camera. These .CRW Raw files are not always recognized by other programs, but in a pinch you can use Adobe's free DNG Converter to change them into DNG files, which are generally supported.

- A live histogram. Based on Raw data from the sensor, the live histogram feature shows you if your highlights and shadows are properly exposed at the current shutter and aperture settings. You can use EV compensation to shift the histogram to one side or the other to improve the exposure.

- Zebra mode. In this mode, your preview will flash the shadows or highlights to indicate either insufficient or excessive exposure.

- A battery status display shows you how much power is left. Very handy as you learn about CHDK because, well, you'll be using your battery much more as you play around <g>.

- Loading a custom grid.

- The ability to run scripts written in UBASIC (see below).

- Faster shutter speeds (like 1/25,000 second).

- Long exposures (like 65 seconds).

- Depth of field calculator. When you press the Shutter button, the screen will display the depth of field and hyperfocal distance.

- Miscellaneous functions include a Calendar, Text Reader, games and more.

- Exposure bracketing. You can set both the number of shots to take and the difference in exposure between each. That lets you capture shadow detail in one, for example, midtones in the next and highlight detail in the last. Then, using any number of image editing programs, you can combine these images into one that displays a wider dynamic range than any single capture can show. You will need a tripod to do this.

- Focus bracketing. In Macro mode, depth of focus is usually very shallow. By taking a series of shots in which the focus is slightly altered, you can extend focus beyond what any single image can capture by using freeware to combine the images. You will need a tripod to do this, too.

- Higher compression Movie mode.

- Increased video recording time and length (to one hour or 2-GB).

- Interval Shooting. Take photos automatically at set intervals. Even with long exposures. You can combine the images into a time lapse video.

- The ability to use the USB port to trigger the shutter.

SCRIPTS

With CHDK running, you can automate your PowerShot with scripts written in UBASIC (http://chdk.wikia.com/wiki/UBASIC). There are a number of scripts you can download (http://tools.assembla.com/chdk/browser/branches/grand/script) to do things like bracketing exposures by number of exposures and step size, focus bracketing, intervalometer, zoom and shoot, zoom video, tele-macro mode, macro DOFstacker, HDR shooting and more.

When you've found a script you want to run, download it and copy it to your card in a folder named CHDK/SCRIPTS. Then, with CHDK running, enter the script menu, load your script and set the options before leaving the menu. In Alt mode, pressing the Shutter button starts the script (just like recording in Movie mode). Pressing the Shutter button again interrupts the script.

Want to write your own scripts? No problem, just visit the UBASIC Tutorial (http://chdk.wikia.com/wiki/UBASIC/TutorialScratchpad) to learn the language.

HELP

Besides the CHDK Wiki (http://chdk.wikia.com/wiki/CHDK), there's a forum (http://chdk.setepontos.com/index.php) where you can discuss everything from the specifics of a release to feature requests. There are sections with help on using the stable releases, creative uses of the program, script writing and shooting and processing Raw images.

In fact, the forum isn't a bad place to start your exploration of CHDK.

WARRANTY

Use at your own risk means just that but the CHDK site posts an interesting email from a Canon tech support rep which says, "After researching this software on the Internet it appears that CHDK doesn't make any actual changes to your camera. If you delete the CHDK software from your memory card or if you choose not to activate the CHDK software on the card (or remove and replace the batteries), then the camera will behave absolutely normally -- nothing has been (or ever is) changed, so the warranty is not affected."

That's the key point. CHDK is not firmware. It's simply software that loads into memory where the DIGIC processor can execute the code on demand.

But use it at your own risk. There are no doubt good reasons Canon itself chooses not to implement some of these features.

Of course, most of these models are probably out of warranty anyway, so the issue may be moot for you.

CONCLUSION

If nothing else, CHDK breathes new life in your old PowerShot. But it isn't just for old PowerShots, with support for a number of currently available models. By providing an architecture for extending the capabilities of your PowerShot, it can keep on breathing new life into your investment. You can even do it yourself, if you learn UBASIC. And you can't beat the price, either.

No comments: