180
C H A P T E R 5
Scripting
5.7.4 Exposure control
The smaller Canon cameras are not equipped with diaphragms. The conse-
quence is that the
Aperture value
( Av) cannot be changed. Therefore, these
cameras do not have a shutter priority program where you preset a shutter
time and the aperture is adapted.
The following script solves that problem in a different way. It modifies
the speed of the sensor (aka the ISO value) to adapt the exposure to a pre-
set shutter value. The shutter value can be preset through the CHDK
Over-
rides
(section 4.3.1). The script presented here switches the ND filter out. In
bright conditions, you should use a rather fast shutter speed instead.
The script is written in
Lua
. The header defines a single parameter,
s
,
used to specify the maximum acceptable ISO speed. If the scene is too dark
for that ISO value and the preset shutter speed, the script will reduce the
shutter speed rather than increasing the ISO speed above that limit.
As in previous examples, function
idiv()
and the
pcall()
expression
are used to provide portability to a PC-based debug environment (section
5.8):
--[[
@title Shutter priority
@param s maxISO 1=50...8=6400
@default s 4
--]]
function idiv(a,b)
return (a-(a % b))/b
end
pcall(function()
require("chdklib")
end
)
The variable
minIso
defines the
Sv96
value for the minimum acceptable
ISO value (usually ISO 50). Should the scene be too bright for such a value,
the script will increase the shutter speed rather than go below that value.
The following table,
corr
, contains correction values for shutter speeds
of 1/1000 sec or shorter. Often, such short shutter speeds are not really
precise. If desired, camera owners can calibrate their cameras by making
test shots at 1/1000, 1/2000, 1/4000, and so on. The resulting values go
into table
corr
. In function
compute_corr()
, the script reads values from
that table and interpolates between those values for shutter speeds that
do not exactly match the defined points:
Содержание 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 ...