5.7 Example scripts
173
if l > a then l = a end
if l < 1 then l = 1 end
if j > l then j = l end
if j < 1 then j = 1 end
--Inhibit zero threshold
if f == 0 then f = -1 end
We now retrieve the drive mode from the camera. This is done by using the
commands
get_drive_mode()
to detect
Continuous Mode
(
1
) and
get_
mode()
to detect
Video Mode
. After this piece of code is executed, we have
the following values in variable
s
:
0
debug,
1
single shot,
2
series,
3
video
-- check for drive mode
if s ~= 0 then
s = 1
if get_drive_mode() == 1 then
s = 2
end
local _, video = get_mode()
if video then s = 3 end
end
Variable
grid
is set to 1 if a mask is used (
i>0
), indicating that the grid is to
be shown on the display. Finally, the variables
p
and
d
are converted to mil-
liseconds:
-- scale and adapt parameters
if i > 0 then grid = 1 else grid = 0 end
p = p * 100
d = d * 1000
Now we are ready to start the event loop. At the very beginning, we check
to see whether there is still space left on the memory card. If not, we break
the loop and stop. If so, we print a short message about how to stop the
script. The variable
shots
is a counter for performed shots.
Each time the event loop cycles, the camera is newly set up. If prefocus or
a fixed distance is selected, the subroutine
focus()
is called to perform the
focusing. The same is true when dynamic thresholding is selected, because
the half-press of the shutter button performed in subroutine
focus()
is
needed to measure the brightness of the scene. The threshold is then
computed in subroutine
adapt()
. In the case of immediate focus (
u==0
), we
release the shutter button half-press to be able to use it again immediately
before the shot.
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 ...