© Bueno Systems, Inc. • TSL1401-DB (2009.10.01)
Page 20 of 52
Image Analysis and Measurement
The monitor program is capable of performing feature measurement on binary images. A “feature” can
be an edge location, the centroid of an object, the brightness of the brightest pixel, etc. The feature to be
measured is selected on the measurement control bar at the bottom of the screen:
Possible values for the various options are:
Which
Type
Feature
Aspect
Between
And
Equals
First
Dark
Pixel
Value
1 to 255
1 to 255
Result
Last
Light
Edge
Location
Extreme
Object
Count
Average
Area
Overall
Extent
Not all combinations of these values will make sense or be realistic for the BASIC Stamp to compute. In
such cases the result will be shown as “n/a”. If a measurement
can
be computed, though, the numerical
value will be shown in the “equals” box, and a graphical indicator (also in yellow) will be displayed at the
appropriate place on the scope.
In a subsequent version of the program, the
Code
button will produce the PBASIC program necessary to
acquire an image and make the desired measurement.
Now let’s define some terms:
First:
Beginning at the left-hand side, the first feature to match the conditions.
Last:
Beginning at the left-hand side, the last feature to match the conditions.
Extreme Dark Pixel:
Least bright pixel.
Extreme Light Pixel:
Brightest pixel.
Average:
Mean value of the feature(s) matching the conditions.
Dark Edge:
Light-to-dark transition, reading from left to right.
Light Edge:
Dark-to-light transition, reading from left to right.
Object:
The span between an edge of the object type (dark/light) and an edge of the opposite type.
Value:
The intensity of a pixel or collection of pixels.
Location:
The pixel index (1 – 255) of the selected feature, or zero if the feature wasn’t found.
Count:
The number of features meeting the specified conditions.
Area:
The number of dark or light pixels encompassed by the selected feature.
Extent:
The number of total pixels encompassed by the selected feature.
When experimenting with the various measurement options, it’s often handy to freeze image acquisition
using the
Stop
or
Single
button. That way, you can adjust the measurement parameters with an image
that’s not itself changing.
Now, let’s explore image analysis using a real-life example: bottling juice. Before the bottles are cased,
the bottler wants to know two things: a) is the bottle full, and b) is the cap on? In this example, bottles
will be passing between a backlight and the camera. So the camera will be looking through the bottle
towards the backlight. This is what it will see. To the right of this image is a rotated scope display,
showing what the TSL1401-DB sees. (Lighter is to the left; darker, to the right.)