CHDK scripts for Canon SD1000/IXUS70

Don't forget you can use zoom to change increment when setting script parameters values (+1, +10, +100, …).

Unless said otherwise, these scripts have only been tested on SD1000_IXUS70. If you have tested successfully one of them on other cameras, tell me in the discussion area at the bottom of the page and I will update the descriptions.

Bracketing

Night bracketing

When shooting live subject or without a tripod by night, you don't necessarily know if the best way is to use flash or not, and high ISO or not. This script takes successively three shots with low ISO, flash, and high ISO, so that you can choose afterward which one is the best one. High ISO also enables dark frame substraction for noise reduction, whatever the exposure time is (it really reduces noise due to high ISO).

File: photo/bracket-night.bas -

rem Author: cyril42e <cyril42e@gmail.com>
rem Camera: SD1000_IXUS70 and DIGIC III cameras
rem Camera: For DIGIC II cameras, change set/get_prop 143->16, 149->21
rem Description: Takes successively three shots at low iso, with flash, and high iso with noise reduction, so that the best shot can be kept afterward
 
@title Night bracketting (ISO+flash)
@param a Take LowIso
@default a 1
@param b Take Flash
@default b 1
@param c Take HighIso
@default c 1
 
rem save flash, iso
get_prop 143 f
get_prop 149 i
n=get_raw_nr
 
rem set flash off, iso auto normal
set_prop 143 2
set_prop 149 0
rem shoot
if a=1 then
	print "shooting low iso"
	shoot
endif
 
if b=1 then
	rem set flash on
	set_prop 143 1
	rem shoot
	print "shooting flash"
	shoot
	rem set flash off
	set_prop 143 2
endif
 
rem shoot
if c=1 then
	rem set iso auto hi and noise reduction on
	set_prop 149 1
	set_raw_nr 2
	print "shooting high iso"
	shoot
endif
 
rem restore flash, iso and nr
:restore
set_prop 143 f
set_prop 149 i
set_raw_nr n
 
end

EV Bracketing

  • Internal modification of EV shift/compensation.
  • Exposure time can be greater than 1“ to ensure sufficient exposure (uses night-shot script)
  • Temporarily enables RAW

File: photo/bracket-ev.bas -

rem Author: cyril42e <cyril42e@gmail.com>
rem Camera: SD1000_IXUS70 and DIGIC III cameras
rem Camera: For DIGIC II cameras, replace get/set_prop 207->26, 206->205
rem Description: EV Bracketing
 
@title EV Bracketing
@param a Range (1/3 EV, even)
@default a 12
@param b Number of shots (odd)
@default b 3
 
rem check input and save
if a<2 then b=2
if a%2 = 1 then a = a+1
if b<3 then b=3
if b%2 = 0 then b = b+1
get_prop 207 o
r=get_raw
set_raw 1
rem step
c=a/(b-1)
rem go to first ev
f = -(a/2) - c
rem shoot
for n=1 to b
	f = f+c
	e = f*32
	set_prop 207 e
	print "shot",n,"of",b,"at",f,"/3 EV"
 
	rem prepare the shot : shoot_half and wait ready
	press "shoot_half"
	do
		get_prop 206 g
	until g=1
	sleep 50
 
	get_tv96 t
	if t=0 then 
		gosub "adjust_exposure"
		shoot
	else
		shoot
		release "shoot_half"
	endif
 
next n
 
rem restore
:restore
set_prop 207 o
set_raw r
 
end
 
 
:adjust_exposure
	rem read bv (luminance), sv (iso speed), av (aperture), and ev shift
	get_bv96 B
	get_sv96 S
	get_av96 A
	rem set tv (exposure time) : tv = bv + sv - av (- ev) (apex)
	t=B+S-A-e
	set_tv96_direct t
	sleep 100
	release "shoot_half"
	return

Focus Bracketing

  • dynamically computes the steps using the DOF calculator

File: photo/bracket-focus.bas -

rem Author: cyril42e <cyril42e@gmail.com>
rem Camera: SD1000_IXUS70 and DIGIC III cameras
rem Camera: For DIGIC II cameras, replace get/set_prop 206->205
rem Description: Focus bracketing computing dynamically the steps with regards to the DOF. 
rem If not infinite, the range is applied around the detected focus distance
 
@title Focus Bracketing
@param a Range (cm, -1=infty) 
@default a -1
@param m Min Dist (cm)
@default m 1
 
if m<1 then m=1
m=m*10
 
rem compute extreme limits
if a=-1 then
	b=m
	get_hyp_dist c
else
	press "shoot_half"
	do
		get_prop 206 z
	until z=1
	get_focus z
	release "shoot_half"
	a=a*5
	b=z-a
	c=z+a
	if b<m then b=m endif
endif
print b,"->",c,"mm"
 
rem shoot
w=0
f=b;
while w<>-1
	set_focus f
	print "shoot at",f,"mm"
	shoot
	get_near_limit u
	get_focus v
	get_far_limit w
	d=w-u
	e=v/10
	if d<e then d=e
	f=v+d
wend
 
end
 
 

Intervalometers

Built-in Intervalometer

Canon SD1000/IXUS70 has a built-in time lapse movie feature. However the interval can only be 1s or 2s. There are time lapse scripts, but they often are too slow for intervals shorter than 1s. Actually the built-in time lapse feature can deal with any interval, given in the property case #265. This script just changes this property.

File: photo/interval-builtin.bas -

rem Author: cyril42e <cyril42e@gmail.com>
rem Camera: SD1000_IXUS70 (and maybe other DIGIC III cameras with built-in time lapse video feature)
rem Description: Allows custom built-in time-lapse movie interval
 
@title Time lapse interval
@param a interval_ms
@default a 500
 
rem set the interval
set_prop 165 a
sleep 200
rem read the interval and display it for verification
get_prop 165 b
print "val: ",b,"ms"
 
end

Accurate Intervalometer

A lot of intervalometers use the sleep command, but this is not precise and it does not take into account the time necessary to shoot (up to several seconds with metering). This script uses the get_tick_count command so is a lot more reliable.

File: photo/interval-accurate.bas -

rem Author: cyril42e <cyril42e@gmail.com> (based on Divalent's "accurate intervalometer" script)
rem Camera: SD1000_IXUS70 and DIGIC III cameras
rem Camera: for DIGIC II, change get/set_prop 218->24, 57->23, 102->6
rem Description: Accurate intervalometer that uses get_tick_count function
 
@title Accurate Intervalometer
@param a Number of shots (0=endless)
@default a 200
@param b Delay (min)
@default b 0
@param c Delay (sec)
@default c 0
@param e Interval (min)
@default e 0
@param f Interval (sec)
@default f 5
@param y PicSize (-1:468=keep,L,M123,S,PC,W)
@default y 3
@param z PicQual (-1:2=keep,SF,F,N)
@default z 2
 
rem == IF CHDK without "restore" management
rem print "stop this script using"
rem print "shoot_half key,"
rem print "not shoot_full"
rem == END
 
rem set picture size and qual
get_prop 218 Y
if y<>-1 and Y<>y then set_prop 218 y
get_prop 57 Z
if z<>-1 and Z<>z then set_prop 57 z
 
rem prepare variables
if a<1 then a=1
h=b*60000+c*1000
if h<0 then h=0
d=e*60000+f*1000
if d<1 then d=1
i=0
if a<=0 then
	a=100
	i=1
endif
 
rem wait and first shoot
sleep h
n=1
s=get_tick_count
if i then
	print "Shot", n
else
	print "Shot", n, "of", a
endif
click "shoot_full"
 
rem loop for all shoots
:loop
for n=2 to a
	s=s+d
	while get_tick_count < s
	rem == IF CHDK without "restore" management
rem		wait_click 50
rem		is_key k "shoot_half"
rem		if k=1 then goto "restore"
	rem == END
	wend
	if i then
		print "Shot", n
	else
		print "Shot", n, "of", a
	endif
  click "shoot_full"
next n
if i then goto "loop"
 
rem restore state
:restore
set_prop 218 Y
set_prop 57 Z
 
end
 

Continuous Intervalometer

Classic intervalometers cannot be faster than ~2s interval, except built-in intervalometer but which is limited to 640×480 resolution. This script uses the continuous mode to take pictures at any resolution with interval ~0.5 to 0.8s.

File: photo/interval-continuous.bas -

rem Author: cyril42e <cyril42e@gmail.com> (based on Divalent's "fast intervalometer" script)
rem Camera: SD1000_IXUS70
rem for DIGIC II, change get/set_prop 207->26, 206->205, 218->24, 57->23, 102->6
rem for other cameras than SD1000_IXUS70, adapt :set_mode function according to the GUI of the camera
rem Description: Uses continuous mode to do a fast intervalometer 
rem (but without control over interval, and without focus&exposure update between shots)
 
@title Continuous Intervalometer
@param a Duration (min)
@default a 2
@param b Duration (sec)
@default b 0
@param c Delay (min)
@default c 0
@param d Delay (sec)
@default d 2
@param y PicSize (-1:468=keep,L,M123,S,PC,W)
@default y 3
@param z PicQual (-1:2=keep,SF,F,N)
@default z 2
 
rem #####################
rem ## CONFIG
 
rem == IF CHDK without "restore" management
rem print "stop this script using"
rem print "set or shoot_half keys,"
rem print "not shoot_full"
rem == END
 
rem set picture size and qual
get_prop 218 Y
if y<>-1 and Y<>y then set_prop 218 y
get_prop 57 Z
if z<>-1 and Z<>z then set_prop 57 z
X=1
gosub "set_mode"
 
rem prepare variables
d=c*60000+d*1000
if d<2000 then d=2000
b=a*60000+b*1000
if b<2000 then b=2000
 
rem wait to start
sleep d
 
rem start shooting
press "shoot_half"
do
	get_prop 206 f
until f=1
press "shoot_full"
 
rem and wait
v=get_tick_count + b
while get_tick_count < v
	rem == IF CHDK without "restore" management
rem  wait_click 50
rem 	is_key k "shoot_half"
rem 	if k=1 then goto "restore"
	rem == END
	rem test continuous has failed
	get_prop 206 f
	if f <> 1 then
		release "shoot_full"
		release "shoot_half"
		press "shoot_half"
		do
			get_prop 206 f
		until f=1
		press "shoot_full"
	endif
wend
 
rem restore state
:restore
release "shoot_full"
release "shoot_half"
set_prop 218 Y
set_prop 57 Z
X=g
gosub "set_mode"
 
end
 
 
rem set mode to X
:set_mode
	get_prop 102 e
	g=e
	i=0
	while e<>X and i<6
		click "down"
		i=i+1
		get_prop 102 e
	wend
	if g<>X then click "set"
	if e<>X then goto "set_mode"
	return

Misc

Night shot

My Casio S600 has a very good night mode, that uses very long exposure time with low ISO. It allows to take beautiful shots by night with a tripod. Canon SD1000 never set exposure time greater than 1” in automatic mode, and in in manual mode you have to try several times to find the good exposure time.

This script:

  • asks the camera the exposure settings it suggests (will keep ISO and aperture)
  • recomputes exposure time so that exposure is correct (up to the limit of the camera, often 65“, and taking into account exposure shift/compensation)
  • waits a 2” delay so that the camera is well stabilized on its tripod when the shot is taken
  • shoots

Tips:

  • You can control with the “Dark frame” entry of the “RAW” menu if you want to let the camera automatically proceed to dark frame substraction for each frame, or if you want to do it manually.

File: photo/night-shot.bas -

rem Author: cyril42e <cyril42e@gmail.com>
rem Camera: SD1000_IXUS70 and DIGIC III cameras
rem Camera: For DIGIC II, replace set/get_prop 207->26, 206->205
rem Description: Auto sets long exposure (> 1") for night shots with tripod, with 2s delay
 
@title Long exposure night shot
 
rem prepare the shot : shoot_half and wait ready
press "shoot_half"
do
	get_prop 206 c
until c=1
rem read bv (luminance), sv (iso speed), av (aperture), and ev shift
get_bv96 b
get_sv96 s
get_av96 a
get_prop 207 e
rem set tv (exposure time) : tv = bv + sv - av (- ev) (apex)
get_tv96 t
print "old tv96:",t
t=b+s-a-e
print "new tv96:",t
set_tv96_direct t
sleep 100
release "shoot_half"
 
rem wait additional 2s and shoot with new exposure
sleep 2000
f=get_tick_count
shoot
g=get_tick_count-f
print "shot length",g,"ms"
 
end

Open shutter

This script aims at having the shutter opened the most possible time, eg to shot lightning. Exposition is computed with night-shot.bas script so that background exposure is ok. Dark frame substraction is canceled, but you can shot in RAW, shot one dark frame, and substract afterwards.

This script:

  • sets automatically continuous mode on the SD1000 using the GUI (as I wasn't able to write the propcase),
  • sets automatically the desired picture size on DIGIC III cameras
  • disables black frame subtraction
  • computes the appropriate long exposure so that the background is well exposed (up to the limit of the camera, often 65“)
  • shoots continuously for a given time (if continuous shooting is interrupted, it is detected and restarted). You can interrupt pressing shoot_half button.
  • restores the modified settings

File: photo/open-shutter.bas -

rem Author: cyril42e <cyril42e@gmail.com>
rem Camera: SD1000_IXUS70
rem Camera: For DIGIC II, replace set/get_prop 207->26, 206->205, 218->24, 57->23, 102->6
rem Description: Continuously take long exposure shots 
rem (combination of interval-continuous.bas and night-shot.bas with dark frame subtraction removal)
 
@title Open Shutter
@param a Delay (min)
@default a 0
@param b Delay (sec)
@default b 2
@param c Duration (min)
@default c 2
@param d Duration (sec)
@default d 0
 
rem #####################
rem ## CONFIG
 
rem == IF CHDK without "restore" management
print "stop this script using"
print "shoot_half keys,"
print "not shoot_full"
rem == END
 
n=get_raw_nr
set_raw_nr 1
Z=1
gosub "set_mode"
 
 
rem #####################
rem ## COMPUTE EXP
rem prepare the shot : shoot_half
press "shoot_half"
rem wait ready to shot
do
	get_prop 206 C
until C=1
rem read bv (luminance), sv (iso speed), av (aperture), and ev (exposure shift)
get_bv96 B
get_sv96 S
get_av96 A
get_prop 207 E
rem set tv (exposure time) : tv = bv + sv - av (- ev) (apex)
T=B+S-A-E
set_tv96_direct T
sleep 100
rem release
release "shoot_half"
 
rem convert to ms
d=c*60000+d*1000
if d<2000 then d=2000
b=a*60000+b*1000
if b<2000 then b=2000
 
 
rem #####################
rem ## WAIT DELAY AND SHOOT
sleep b
 
rem first get camera to lock in focus and exposure
press "shoot_half"
do
	get_prop 206 f
until f=1
sleep 100
 
rem shoot continous
press "shoot_full"
v=get_tick_count + d
while get_tick_count < v
	rem == IF CHDK without "restore" management
rem  wait_click 50
rem 	is_key k "shoot_half"
rem 	if k=1 then goto "restore"
	rem == END
	rem test continuous has failed
	get_prop 206 f
	if f<> 1 then
		release "shoot_full"
		release "shoot_half"
		press "shoot_half"
		do
			get_prop 206 f
		until f=1
		press "shoot_full"
	endif
wend
 
rem restore
:restore
release "shoot_full"
release "shoot_half"
Z=g
gosub "set_mode"
set_raw_nr n
 
end
 
rem set mode to Z
:set_mode
	get_prop 102 e
	g=e
	i=0
	while e<>Z and i<6
		click "down"
		i=i+1
		get_prop 102 e
	wend
	if g<>Z then click "set"
	if e<>Z then goto "set_mode"
	return

Motion shot

  • takes one shot, or a burst of shots, or a movie after movement is detected

File: photo/motion-shot.bas -

rem Author: cyril42e <cyril42e@gmail.com>
rem Camera: SD1000_IXUS70 and DIGIC III cameras
rem Camera: For DIGIC II, replace set/get_prop 206->205, 102->6
rem for other cameras than SD1000_IXUS70, adapt :set_mode function according to the GUI of the camera
rem Description: Triggers a shot when movement is detected. Auto focus/exposure is done each shot, but you can lock them before
 
@title Motion Shot
@param a Columns
@default a 8
@param b Rows
@default b 6
@param c Threshold (0-255)
@default c 10
@param d Compare Interval (ms)
@default d 20
@param e Pix-Step (speed vs accur)
@default e 10
@param f Action1 (2^=sht/lg/dmp/prss)
@default f 1
@param g Action2 (1:3=shot,cont,mov)
@default g 0
@param h Movie/Burst length (s)
@default h 10
@param i Draw Grid (0/1)
@default i 0
@param j Timeout (s)
@default j 120
@param k Delay (ms)
@default k 1500
@param l Measure (0:5=UYVRGB)
@default l 1
@param m Region (0:2=no/inc/exc)
@default m 0
@param n Region Left
@default n 1
@param o Region Right
@default o 1
@param p Region Top
@default p 1
@param q Region Bottom
@default q 1
 
rem set continuous
if g=1 then
	X=1
	gosub "set_mode"
endif
 
rem prepare variables
j=j*1000
h=h*1000
if g=1 or g=2 then v=1 else v=0 endif
if g=2 or g=3 or (f|8) then w=1 else w=0 endif
s=0
 
while 1
	get_prop 206 t
	if g<>3 then
		press "shoot_half"
		do
			get_prop 206 z
		until z=1
	endif
	r=0
	md_detect_motion a, b, l, j, d, c, i, r, m, n, p, o, q, f, e, 100
	if r>0 and v then press "shoot_full"
	if r>0 and g=3 then click "print"
	u=get_tick_count
	if r>0 then 
		print "shot",s
		s=s+1
	endif
	if w then gosub "wait_end_record"
	if t then
		sleep 1000
	else
		do
			get_prop 206 z
		until z=1
	endif
	release "shoot_full"
	release "shoot_half"
wend
 
rem restore
:restore
if g=1 then
	X=G
	gosub "set_mode"
endif
 
end
 
 
:wait_end_record
	r=0
	md_detect_motion a, b, l, (h-get_tick_count+u), d, c, i, r, o, n, p, m, q, 0, e, k
	if r>0 then
		u=get_tick_count
		goto wait_end_record
	else
		if g=3 then 
			click "print"
		else
			release "shoot_full"
		endif
	endif
	return
 
 
rem set mode to X
:set_mode
	get_prop 102 E
	G=E
	I=0
	while E<>X and I<6
		click "down"
		I=I+1
		get_prop 102 E
	wend
	if G<>X then click "set"
	if E<>X then goto "set_mode"
	return
photo/chdk-scripts.txt · Last modified: 2013/09/19 16:40 (external edit)
CC Attribution-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0