5.7 Example scripts
169
The function
adapt()
is used to compute the threshold (sensitivity) de-
pending on the scene brightness value measured by the camera. We get
this value with the CHDK function
get_bv96()
. The following formula is
heuristic and was found acceptable during trials. It may be changed if re-
quired. The resulting threshold value in variable
w
is then clipped between
12 and 36 and returned. If the incoming threshold has a positive value, it is
simply returned—no dynamic shareholding is wanted in this case:
function focus()
if u <= 0 or f < 0 then
press("shoot_half")
end
if u > 0 then set_focus(u * 10) end
repeat until get_shooting()
end
Function
focus()
is used for prefocusing or for immediate focusing. It
works by pressing the shutter button halfway. This is also done in the case
of dynamic shareholding (
f<0
) because the shutter button must be half-
pressed to determine the scene brightness. If a fixed subject distance is
specified (
u>0
), this distance is set. After all these preparations, the func-
tion waits until the camera is ready to shoot:
function series(duration)
press("shoot_full")
sleep(duration)
release("shoot_full")
end
function video(duration)
click("shoot_full")
sleep(duration)
click("shoot_full")
end
Triggering a time series or a video clip works a bit differently from taking a
photo. For a time series, the shutter button must be pressed, then after a
while released again. For a video clip, the shutter button must be clicked
(pressed and released), and after a while it must be clicked again:
Summary of Contents for Camera
Page 1: ......
Page 2: ...The Canon Camera Hackers Manual ...
Page 3: ......
Page 4: ...Berthold Daum The Canon Camera Hackers Manual Teach Your Camera New Tricks ...
Page 19: ...10 CH APTER 2 Cameras and Operating Systems ...
Page 25: ...16 CH APTER 3 ...
Page 85: ...76 CH APTER 4 Teach Your Camera New Tricks ...
Page 213: ...204 CH APTER 6 ...
Page 253: ...244 AP PENDIX ...