Template Image Editor allows to edit template images and define image
comparison parameters. It is available from any GUI component
which deals with image comparison, such as the CompareTo,
Screenshot, and Waitfor match windows.
The editor operates in two modes depending on the image comparison
method (algorithm) selected in the owning component:
Basic Mode allows to
view, inspect and crop the template image.
Advanced
Mode provides additional functionality related to pixel
transparency supported by the image search algorithm.
2. Basic Mode
The template editor displays in basic mode whenever the selected image
comparison algorithm doesn't support transparency, such as for example
the default histogram based
one. It basically allows just to crop the image. The window then
consists of the following elements:
Image view displays the
current template image on a contrast chessboard-like background. To
define a crop rectangle (such as the one in the picture) drag the mouse
in the view. The selected rectangle can be further on adjusted through
dragging its dashed side lines or corners.
Save
& Close button closes the image editor and saves the crop
rectangle (if defined) as well as any image comparison parameters
defined through transparency operations (if available). These changes
are stored just to the memory and they are not saved to the image file
and/or the test script unless the window owning the editor is closed
with the OK button.
Cancel
Selection button resets (cancels) the selected rectangle.
Zoom In
and Zoom Out buttons allow to
magnify the image. Zooming functions apply just to the image view and
they do not have any effect on the resulting template image. The zoom
in function is available only as long as the displayed image width and
height are smaller than 1000 pixels. This limitation is applied to
prevent Java from running out of memory.
Help button
opens
this
help topic.
Pixel
label displays information about the image pixel under the
current mouse pointer position. It displays its coordinates and color
(both visually as well as in form of HTML style RGB notation). It also
appends information on whether the pixel is fully opaque (alpha
component is equal to 255) or transparent
(alpha is between 0 and 254).
The red cross indicates the image click point. It represents the
best location for an eventual mouse action such as a click, press,
release or drag. The point defaults to the image center but it can be
customized to any location inside or even outside the template
image rectangle. See the Image
Meta
Data documentation for details. To move the click point simply
drag it using the mouse.
3. Advanced Mode With Transparency Support
Advanced mode supports image search improvements delivered in
T-Plan Robot Enterprise 2.1. The new functionality is intended to support seamless
search for graphic objects on various backgounds without having to edit
the template image with third party editors in order to reduce
comparable pixels through transparency. The image search algorithm
optional now supports an image filter which makes background color of
the template image transparent and thus forces the search logic to skip
them. This feature is provided through three parameters:
The removebg parameter
(represented by the Ignore template
background check box in the GUI) switches on/off functionality
allowing
to filter out the background color during image search. It can be
applied
only to template images which do not contain any transparent or
translucent pixels
created by third party image editors (such as Gimp). When this feature
is on (removebg=true), the
algorithm internally applies an image filter to the template
which makes all pixels equal to the specified color transparent
and all reasonably similar pixels translucent (partially transparent).
Transparent pixels are then ignored during the image search
process while translucent pixels may be compared up to the limit
specified by the minalpha
parameter (see below).
The bgcolor
parameter (Custom background color
field) allows to define a custom background color. If this parameter is
not specified, the color is determined automatically from the very
first image pixel (top left image corner of the selected
rectangle or image). This parameter is enabled
and makes sense only when background filter is on (removebg=true).
The minalpha
parameter (Minimum alpha field)
sets translucency tolerance. Alpha is a pixel color component between 0
(transparent) and 255 (opaque) which defines the level of pixel
translucency. The
default value of 255 instructs the search algorithm to compare just the
fully opaque pixels and ignore all transparent or translucent
ones. Values lower than 255 will make the algorithm to compare even
translucent pixels with the alpha component equal to or greater
than the specified limit.
The parameter may be applied to images filtered
through the removebg filter
as well as to images with already existing transparency (for example to
images made transparent through Gimp or other image editor). The
minimum alpha parameter is intended to solve situations where the
background color filter makes too many pixels or even all of them
transparent or translucent. This leaves the search algorithm comparing
just against a
small number of opaque pixels which usually leads to unexpected match
results. As lowering the alpha limit increases number of comparable
pixels, it may be used to improve accuracy of the image search
algorithm. Be however aware that as comparison of translucent
pixels is based on color similarity, it has significalntly slower
performance than the classic image search and extremely low values of
minimum alpha may produce unexpected match results.
Setting of these three parameters is supported by the template editor
as follows. Be aware that the transparency defined in the editor is
never physically written to the image file and it gets saved just in
form of the image search parameters into the test script.
Ignore
Template Background toggle button switches on/off removal of
image background. When the button is on, the image view displays
filtered image containing just those pixels which are comparable
(meaning either opaque or with alpha equal to or greater than the
limit).
Select
Background Color allows
to select custom transparent color. When the button is on, the image
view temporarily switches to opaque mode and lets the user click into
the image to select the new transparent color.
Reduce
Translucency Limit lowers the minimum alpha. When this buton is
clicked on, it lowers the alpha limit to the next lower level for which
there is
at least one pixel with the given alpha value. This makes the pixel (or
pixels) comparable by the image search algorithm. The Increase Translucency Limit button
provides reverse functionality and raises
the minimum alpha to the next
upper alpha value. Selecting this button removes
comparable pixels with the specified alpha component from the image.
The button is enabled only when the minalpha
parameter is lower than
255 (0xFF).
The
pixel label provides in this mode extended information about the
actual pixel. It may display one of three state suffices:
Opaque indicates that
the pixel is opaque and is always compared (alpha=255),
Translucent/comparable
shows that the pixel is translucent and its alpha value meets the
current minimum alpha limit (and thus it is accepted by the image
search as comparable),
Transparent/ignored
means that the pixel is either fully transparent or translucent with
alpha value below the limit
and it will be ignored by image search.
Image
Details component displays template image summary. It lists the
image size and the crop rectangle (if defined), status and values of
the transparency parameters and summary of comparable pixels. It also
recommends a minimum pass rate calculated from the ratio of comparable
pixels with an added safety marging of 10 pixels.
Image
view acts a bit different in the advanced mode. As it displays
only comparable pixels, the view may differ from how the same image
gets displayed in a web browser or any other third party image viewer.
This applies mainly to images which already contain
transparent/translucent pixels.