Wait for appearance Version 9 (Python)

Action group: Vision


Description

The action is intended to wait for an object matching the set pattern to appear and get its coordinates. If the transmitted image matches the image(s) on the screen, the coordinates of all found matches are returned

Action icon

Parameters

Input parameters

Output parameters

Coordinates - a variable that will contain the coordinates of all found objects. The order in which the result collection is populated: first comes the object found closest to the top-left corner of the search area. If the object did not appear within the specified period of time, the error «Image not found» will be displayed.

Settings 

PropertyDescriptionTypeFilling exampleMandatory field
Parameters
ImageThe path to the image for recognition. The most effective use of files with the extension «.png». Valid extensions: «.jpeg», «.jpg», «.bmp», «.png», «.tif», «.tiff». If the algorithm did not find the file extension or the file type is not applicable, a warning will be displayed.Robin.ImageC:\doc\img.pngYes
Similarity rateRequired coefficient of similarity between the template image and the target area. The maximum value is «1»Robin.Numeric
Yes
Give centerIf the parameter is «false», the action will return coordinates of the upper left corner of the image found on the screen, otherwise it returns coordinates of the center of the found imageRobin.BooleantrueNo
Timeout (ms)The time during which the appearance of the specified object will be expected. Timeout is set in millisecondsRobin.Numeric
Yes
Interval of taking screenshotsThe interval of taking a screenshot for comparison with the specified image. Measured in seconds. Acceptable values: integers from 1 and more.Robin.Numeric
No
Comparison algorithmThe algorithm for comparing the specified image. If one algorithm does not work correctly, you should try another one. The default value is TM_CCOEFF.Robin.String
No
Make the image black and whiteIf the value is «true», then the image color will be changed to grayscale.Robin.BooleantrueNo
Search for image edgesIf the value is «true», then the search for edges of objects in the image will be performed. Edges are the boundaries that outline the image object.Robin.BooleantrueNo
Min edge search boundaryThe minimum size of the edges of the image objects. Together with the value from the «Max. edge search boundary» field, it makes up the range of possible edge sizes. It is taken into account only if the «Search for image edges» parameter is true. Acceptable value: from 0 to 255. Default: 150.Robin.Numeric
No
Max edge search boundaryThe maximum size of the edges of the image objects.Together with the value from the «Min. edge search boundary» field, it makes up the range of possible edge sizes. It is taken into account only if the «Search for image edges» parameter is true. Acceptable value: from 0 to 255. Default: 200.Robin.Numeric
No
Min image size changeThe minimum zoom factor of the specified image. This parameter is used if the size of the image on the screen may differ from the size of the specified image. Recommended value: from 0.5. Default: 1.Robin.Numeric
No
Max image size changeThe maximum zoom factor of the specified image. It is recommended to use the parameter if the size of the image on the screen may differ from the size of the specified image. Recommended value: up to 5. By default: 1.Robin.Numeric
No
Results
CoordinatesA variable that will contain the coordinates of all found objects. The order in which the result collection is populated: first comes the object found closest to the top-left corner of the search area. If the object did not appear within the specified period of time, the error «Image not found» will be displayed.Robin.Collection

Special conditions of use

Example of use

Task

Return the coordinates of the found images on the screen corresponding to the specified image when setting different parameter values according to the settings table. 

Solution

Use the "Wait for appearance" action. 

Implementation

  1. Add the "Wait for appearance" action to the test robot - 6 to the workspace we will be working with .
  2. Click on the icon on the right side of the screen and a sidebar with parameter settings will appear.
  3. Sequentially set the values of the parameters.

In the "image" field, set the path where the image to be recognized is located.

Consistently set the parameters that affect the similarity rate of the template of the image that appears.


Task 1 

Return the coordinates of found images on the screen corresponding to the given image when setting the minimum settings of parameter values according to the setup table. 

Run the robot. 

The program robot completed successfully. The minimum set of configuration parameters is correct.


Task 2

Return the coordinates of the found images on the screen corresponding to the given image when you make advanced settings of parameter values according to the setting table. 

Run the robot. 


Task 3

Return the coordinates of found images on the screen corresponding to the specified image when setting individual incorrect advanced settings for parameter values other than the setting table. 

When specifying an interval for taking a screenshot to compare with the specified image. Specified a null value.  Valid values: integers from 1 and more. 

The robot generated an error.


Task 4

Return the coordinates of found images on the screen corresponding to the specified image when setting individual incorrect advanced settings to parameter values other than the setting table. 

When specifying the minimum coefficient of change of scale of the specified image, the value "-1" was set.  Recommended value: from 0.5. Default: 1

The robot generated an error.