Image/Pixel-Color Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Image/Pixel-Color Operations > Pattern-Search >

Image/Pixel-Color Operations

JTP.- / JTN. - Jump If (n)one of Two Pattern

Previous Top Next


MiniRobotLanguage (MRL)

 

JTP. - Jump if one of Two Pattern
JTN. - Jump if Two Pattern Not found

 
Check if one or more of two specified Pattern can be found in an Image-Register (IR) and if so Jump to a Label

 

 

Intention

 

This command check if a specified Pattern can be found or not. If the Condition is met, the Jump to the specified Label will be made using JTP.

JNT is just the opposite, it will jump in none of the two Patterns was found.

 

And put the number of found occurrences on the TOS, as well as all occurrences limited by the Setting of MaxResults (See SFP.-Command).

It uses only 3 Parameter which are similar to the Parameters in LFP..

 

This command uses internally multiple Levels (4 Levels) of Fuzzy-Logic.

It will search all of the currently localized Top-Window.

 

The JTP./JTN.-Command will use additional Parameters that can be changed using the SFP.-Command.

These are for example the Color-Tolerance and the number of "needed Pixel-Hits".

Hereby Pixel-Hits are the number of Pixels that do match the Pattern using the given Color-Tolerance.

 

Technically the JTP. is an enhanced Version of the JFP.-Command, as it has the same Parameters but you can specify two Patterns.

Please see the LFP.-Commands for more  Details.

 

1. Use WFP with 3 Parameters and default settings

This will include all Screens on a Dual-Screen System. Here we search a Pattern on the complete Desktop.

 

STW.ct|Chrome_Widge|Safir - Brav

SWP.0,1320|1098,668|T

VAR.$$PAA=?pattern\Py.bmp

VAR.$$PAB=?pattern\Pa.bmp

SFP.ColorTolerance|0

SFP.PixelHits|0

SFP.DebugMode|0

JTP.$$PAA|$$PAB|out|0,0|10

MBX.Pattern found

ENR.

:out

MMV.

DMP.6

MBX.Pattern found

ENR.

 

 

clip0063

If you Specify P3, then P3 is the number of findings, limited by thesetting of Max-Results (see SFP.-Command).

On the TOS you will find all the Results.

 

 

Very useful is the negative Form of the Command. Assume taht you Click some Button and you expect a Menu to appear.

Now using this one Command, you can locate the Menu (or whatever the Pattern is).

And in the same Command, you have a variable Waiting Time (to wait a moment if it appears), and if the Pattern does not appear you can jump back to Click again.

All in one Command.

 

 

STW.ct|Chrome_Widge|Safir - Brav

SWP.0,1320|1098,668|T

VAR.$$PAA=?pattern\Py.bmp

VAR.$$PAB=?pattern\Pa.bmp

SFP.ColorTolerance|0

SFP.PixelHits|0

SFP.DebugMode|0

JTN.$$PAA|$$PAB|out|0,0|1

MMV.

DMP.6

MBX.Pattern found

ENR.

:out

MBX.Pattern not found

ENR.

 

 

 

clip0064               clip0065

The first Picture shows the Stack from JTN. if the Pattern was faound.   The second Picture shows the Stack if the Pattern was not found.

 

 

 

Syntax

 

JTP.P1|P2[|P3][|P4][|P5]

JTN.P1|P2[|P3][|P4][|P5]

 

Parameter Explanation

 

P1 - Pattern File A - Name and Path
    or Specify "IR:" and Image-Register number for Pattern from an Image-Register..
        or Specify "ID:$$DTA" und directly use Inline-Data as Pattern.

 

P2 - Pattern File B - Name and Path
    or Specify "IR:" and Image-Register number for Pattern from an Image-Register..
        or Specify "ID:$$DTA" und directly use Inline-Data as Pattern.

 

P3 - Label - Label where the Jump will go if the condition is met. With the SPR Labels can also be dynamic and in Variables.

 

P4 - opt. Destination Point Shift, will be used to move the target point by a specified amount of Pixels.

                   For example, if the Target is found at 100,50 and you specify here -10,40 then the final Point will be at 90,90.

 

P5 - opt. Wait-Time in Seconds Command will wait until the time is over if that Pattern will appear.

                   If  not specified the Command will return immediately.
                   If 0 is specified the command will wait "Forever". If "-1" is specified the command will not wait and therefore return immediately, this is the default option.

 

The Command will leave the number of finds on the TOS.

 

The Result "0" means "nothing found", a result of -1 means "Error", while a "1" or a higher number shows the number of found matches.

The maximum Number of found Locations is limited by the "Max-Results" Setting that can be changed using the "SFP.-Command".

The last found Position will automatically be set as the "Active Point".

If the Pattern does not exist then you will get a result "0" on TOS. The program will not generate an Error-Message.

 

 

 

Example

 

-

 

 

Remarks

Do not use ".jpg" Images or images that are compressed with Artefacts. Generally use ".bmp" or ".png" Images. Otherwise the result will be hard to predict.

 

Limitations:

The resolution of the Pattern-Images that can be used is limited to those resolutions that can be saved with the "Human Eye-Recorder"-Tool.

 

 

See also: