Canon Camera Hackers Manual page 175

Camera hackers manual berthold daum
Table of Contents

Advertisement

166
C H A P T E R 5
Scripting
An additional command allows for a finer analysis of the detected motion:
md_get_cell_diff i,j,k
k = md_get_cell_diff(i,j)
Here, the variable k will contain the change in the i-th cell and the j-th row.
The value of k will range from 0 to 255. This command could be used, for
example, after the command md_detect_motion in order to take a shot
when the detected motion has stopped.
The script
The following script example, written in Lua, is a universal script for motion
detection. Of course, on the Internet—and in particular, on the CHDK web-
site—you will find many similar scripts, and I've drawn some inspiration
from a number of them. All of these scripts are based on the powerful
CHDK command md_detect_motion, which we have discussed above. This
command alone has a dozen parameters. Add additional parameters for
prefocusing and timing, and you end up with 15+ parameters.
This is anything but practical when working in the field—even when
working with parameter sets as explained in section 5.1. In the field, it is
better to have a selection of clearly named and predefined programs for
different scene types, such as " Lightning", "Fast Motion", "Small Objects",
" Macro", etc., that you simply select from a list.
This is exactly what the following script provides. The most commonly
used scene programs are already predefined, but you can easily add addi-
tional scene programs by extending the script. When running the script,
simply select the required scene program using the RIGHT,
SET
keys. By selecting the scene program named "Parameters", you will still
be able to control the script via individual parameters.
Now let's see how this script is constructed. First, the parameters are
defined in the usual way. We have chosen the parameter names so that
they match the names used in the description of the command md_detect_
motion (see previous page). So, we only have to explain the additional
parameters.
s
This parameter can be used in combination with any scene program. The
asterisk in front of the parameter description indicates this. When set to
0, the script will run in test mode—meaning that no pictures are taken.
The value of 1, in contrast, means full action.
v
This parameter can also be used in combination with any scene program
(indicated by the asterisk in front of the parameter description). The
parameter is used for specifying a pause after each shot (in seconds). The
value –1 has a special meaning: the script pauses until the user presses
the
Basic
Lua
DISP
button.
LEFT,
and
FUNC/

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Powershot sx10 is

Table of Contents