Canon Camera Hackers Manual page 182

Camera hackers manual berthold daum
Table of Contents

Advertisement

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.
5.7 Example scripts
173

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents