174
C H A P T E R 5
Scripting
The variable
z
controls the display backlight. It is possible to switch the
backlight off while waiting for a movement, or completely until the script
is interrupted. By saving battery power, the camera can be used for longer
surveillance tasks.
Then motion detection starts. The result is written into variable
cells
that contain the number of grid cells where motion is detected. If motion
detection times out,
cells
contains the value
0
. When a motion is de-
tected, a shot can be taken. If immediate autofocus (
u==0
) is selected, the
subroutine
focus
is called again. Then the shot is performed by using the
command
press("shoot_full")
. Note that the command
press()
and
not the command
click()
is used so that the shutter button stays pressed.
In the case of series and video sequences, the subroutines
series
and
video
are called instead. Finally, a message is printed to the screen and the
image counter is incremented.
The backlight is switched on again, if desired. The script then pauses
optionally and releases the shutter button. During that pause, the camera
remains in review mode showing the image taken on the display. Then we
wait until the camera is ready to shoot again. In the case of a timeout
(
cells==0
), we perform the subroutine
wake
to stop the camera from pow-
ering down. The camera is now ready for the next cycle:
-- event
loop
shots = 0
print("Stop: Shutter Button")
while true do
if get_raw() then
if get_raw_count() == 0 then
break
end
else
if get_jpg_count() == 0 then
break
end
end
if (s > 0 and s < 3 and u ~= 0)
or f < 0 then
focus()
if u == 0 then
release("shoot_half")
end
end
if z <= 1 then
set_backlight(0)
end
Содержание Camera
Страница 1: ......
Страница 2: ...The Canon Camera Hackers Manual ...
Страница 3: ......
Страница 4: ...Berthold Daum The Canon Camera Hackers Manual Teach Your Camera New Tricks ...
Страница 19: ...10 CH APTER 2 Cameras and Operating Systems ...
Страница 25: ...16 CH APTER 3 ...
Страница 85: ...76 CH APTER 4 Teach Your Camera New Tricks ...
Страница 213: ...204 CH APTER 6 ...
Страница 253: ...244 AP PENDIX ...