FIGURE 3. Motion can be detected by comparing two images.
sector number (0-24 for a 5x5 grid) that contains the
maximum number of pixels that match (see Clr Tol) the
specified Color (or -1 if no sectors contain the color).
This sector number can be converted to the x and y
parameters mentioned above as follows (for a 5x5 grid):
x = Var1 5, y = Var1 / 5.
• Var2: This variable will be set by the command to the
number of sectors that contain a significant number of
pixels (see Grid Tol) matching the specified Color. Your
program can use this information as a validity indicator to
decide if different tolerances should be used to acquire
more valid information.
• Clr Tol: This expression should be a number from 0 to 1
that sets the tolerance for deciding if two colors match.
For example, if Clr Tol is 0.1 then each of the RGB
FIGURE 4. RobotBASIC provides many commands
to process your images.
components of a pixel’s color must be within ±10% of
the components of Color to be counted as a pixel that
• Grid Tol: This expression should be a number from 0 to 1
that indicates the tolerance to be used when determining
if a sector contains enough of the specified Color to be
included in the sector count (Var2). For example, if
Grid Tol is 0.1, then a sector must have 90% as many
matching pixels as the sector with the most matching
pixels (reported in Var1) if it is to be included in the
sector count (Var2).
• GridSize: This expression should be a number from 3 to
20 that specifies the size of the grid matrix (a value of 5
indicates a 5x5 matrix).
• ArrayVar: This is a two-dimensional array (based on the
selected GridSize) that provides information to facilitate
a more detailed analysis. Each of the elements in the
44 SERVO 04.2009