Tuesday, June 30, 2009

Timelapse photography using CHDK

I thought it could be fun to do some time-lapse photography now that I have a programmable camera. So I have quickly whipped up a small time-lapse script that works on my Ixus 750:
@title Timelapse
@param a Number of steps
@default a 30
@param b Period (seconds)
@default b 60

rem Sanity check.
if a<1 then let a=1
if b<5 then let b=5
let b=b*1000

rem Take the pictures!
for s=1 to a+1
rem Take a single picture.
print "Shoot", s, "of", a
press "shoot_half"
sleep 2500
press "shoot_full"
release "shoot_full"
release "shoot_half"
print "shot done"

rem Sleep until its time to take the next picture.
sleep b
next s

At the standard setting it takes thirty pictures in roughly 30 minutes.

CHDK oddities

The script I posted in my last post, the one that does exposure bracketing, used to work - I swear it did! But all of a sudden it decided to stop working, and I can't find an good explanation for that at all ;-)

But, instead of an explanation i offer you a fix. The following script _does_ work on my Ixus 750 camera (right now it does anyway):
@title EXP bracketing 
@param a Number of +/- steps
@default a 2
@param b Step size (1/3EV)
@default b 3

if a<1 then let a=2
if b<1 then let b=3

print "Preparing..."
for n=1 to a*b
click "left"
next n

for s=1 to a*2
print "Shoot", s, "of", a*2+1
press "shoot_half"
sleep 2500
press "shoot_full"
release "shoot_full"
release "shoot_half"
print "shot done"
sleep 5000
for n=1 to b
click "right"
next n
next s

print "Shoot", a*2+1, "of", a*2+1
press "shoot_half"
sleep 2500
press "shoot_full"
release "shoot_full"
release "shoot_half"
sleep 5000

print "Finalizing..."
for n=1 to a*b
click "left"
next n

Tuesday, June 9, 2009

CHDK on an Ixus 750

While on paternity leave I have been playing around with my Canon Ixus 750 digital camera. Primarily I have been doing macro (close-up) shots of insects etc., but I also wanted to experiment with other kinds of photography, e.g., High Dynamic Range images (HDR). In HDR you take pictures of the same scene at different exposure levels, and after that a computer program stacks these images to create the HDR image. When taking such pictures it is vital that you do not move the camera, which can be quite hard even if you have a stand for it. I was therefore looking for a software solution to HDR, that would automatically take 3 to 5 pictures at different exposure levels for me, so that Idid not need to touch the camera in between shots.

For that I installed CHDK on my Ixus 750 and I must say that I am impressed. Using the CHDK firmware extension a horde of new features are unlocked (for example the possibility to take RAW images instead of JPEGs). And most importantly CHDK is scriptable, so you may write your own scripts to control your camera.

Based on an example in the tutorial I quickly wrote an HDR script that works on an Ixus 750. When I activate this script my camera snaps five pictures at -2, 1, 0, +1, +2 exposure.
@title EXP bracketing 
@param a Number of +/- steps
@default a 2
@param b Step size (1/3EV)
@default b 3

if a<1 then let a=2
if b<1 then let b=3

sleep 1000

print "Preparing..."
rem click "erase"
for n=1 to a*b
click "left"
next n

click "shoot_half"
sleep 3000
for s=1 to a*2
print "Shoot", s, "of", a*2+1
click "shoot_full"
print "shot done"
sleep 5000
for n=1 to b
click "right"
next n
next s

print "Shoot", a*2+1, "of", a*2+1
click "shoot_full"
sleep 5000

print "Finalizing..."
for n=1 to a*b
click "left"
next n
rem click "erase"

end

In order to use this script the camera must be in manual mode and the exposure menu must be opened...