Image/Pixel-Color Operations

<< Click to Display Table of Contents >>

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

Image/Pixel-Color Operations

SFP. - Set Find Parameter

Previous Top Next


MiniRobotLanguage (MRL)

 

SFP. Set Find Pattern Parameter

Set internal Parameters for the Find Pattern Commands

 

 

Intention

 

This command manages the Standard-Parameters for the Find-Pattern Commands.

To have the Find-Pattern Commands use only 3 Parameters, all less important Parameters can be set using this Command.

 

The SFP-Command will set all additional Parameters.

 

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.

 

 

1. Use LFP. and set the default Parameters with SFP. before

You can change the Parameters that LFP. uses with the SFP.-Command.

 

STW.ct|PBWindowClass:0|JK - IDE 2.

' Set Maxmimum Results Number to 4

SFP.MaxResults|4

' Set Minimum Pixel-Hits to 63

SFP.PixelHits|63

' Set Color-Tolerance to 12

SFP.ColorTolerance|12

$$LAA=?pattern\SP_8.bmp

' LFP. uses only 3 Parameters but internally also uses the Parameters that can be changed using the SFP.-Command

LFP.$$LAA|0,40|$$RES

DMP.6

MBX.$$RES

ENR.

 

 

Explanation for the Parameter-Names:

 

"MaxResults" or "Mr"

This will tell the Pattern-Engine to stop searching for more results after this number of results has been found.

 

"PixelHits" or "Ph"

This number will tell the Engine how many Pixels from the Target must match the Source Pattern (taking the Color-Tolerance into account)

so that the Location is been marked as a "Hit". This Parameter must be set depending on the Pattern Size. If you leave it at "0" a default, calculated value is taken (85%).

 

"ColorTolerance" or "Ct"

This number will define the Color-Tolerance that the Pattern-Search Engine applies to each Pixel before marking it as "valid" or "Invalid".

The higher this value, the more possible results can be found.

 

"DebugMode" or "db"

This number can only be 0 or 1. If set to one, after there have been results found, a Console Window will appear and list all the found results together with some technical informations, like the "Pixelhits" that have matched for the Find. Using the Debugmode you can find the best values for Tolerance and Pixelhits by looking over the results. If nothing is found, possibly no Console Window will appear.

 

"CPU"

Number of CPU-Cores in the System. If change this, the Subprogrammes may use less CPU-Cores and work possibly slower. If you set it too high (Higher then the real number of available CPU-Cores)  then the System may become overloaded and get unresponsible. Best leave at the default value that is calculated when the Robot starts.

 

"Snap_Border" or "sb"

This can be set to 0, 1 or 2 and will influence the Bordersize that is taken when Snapshoting a Window.

"0" - Client-Area only

"1" - Whole Window

"2" - Whole WIndow without Border

It depends on the Target which is the best setting.

 

XSize, YSize

This gives you the X- and Y-Resolution of the last Snapshot, using any of the Pattern-Commands that do Snapshot a Window. Including ANA.Snap.

There are no know use cases where you would like to change these numbers. Doing so may have unforeseeable Side-Effects on some commands.

 

"MovePoint", "MP"

This is the preset for the Point-Shift Parameter. By default it is "0,0". The Preset is not yet implemented in all Pattern-Commands.

 

"LastPattern", "LP"

This is will return the number of the Pattern that was found if a "multi-Pattern-Command" was used. It is working for WTP. and LTP.-Commands.

  Using this, you can find out which of multiple Patterns was found for example with

  WTP.$$PAA|$$PAB|30,40|60

  GFP.LastPattern|$$PAT

  MBX.$$PAT

 

This will only make sense, if only 1 result was found.

In this case, $$PAT will be 1 or 2 depending if the Pattern in $$PAA or $$PAB was found.

 

"LastCount", "LC"

This will return the number of found matches from the last Pattern-Command. It may not yet be implemented in all Pattern-Commands. It is working for WTP. and LTP.-Commands where its mostly needed.

 

"LastHits", "LH"

This will return the number of Pixelhits that were diagnosed with the last find. Of course this makes only sense if there was just 1 find.

 

 WTP.$$PAA|$$PAB|30,40|60

 GFP.LH|$$PAT

 MBX.Pixelhits: $$PAT

 

"LastSnap", "LS"

This will return the Number of the IR that got the last Snapshot (Read Only).

 

"FlagA", "FA"

This will Set the Value of Flag "A". It has to do with Pattern Search. Generally the normal value is "0".

If set to 1,2 or 3 the Pattern-Operation check more Pixels before returning a result, this may lead to better yet may use longer time.

 

"MinDist", "MD"

This will Set the Value for "Minimal Distance". Results that have use a higher Color Tolerance tend to appear multiple times, with a distance of 1 or 2.

These will automatically be eliminated from the Point-Results, based on this value. A MinDist of 1 will eliminate Results that are +/-1 Pixel near another result.

 

 

Syntax

 

SFP.P1|P2

 

Parameter Explanation

 

P1 - Parameter-Name this is the Name of the Parameter that is going to be changed. Please note that some Parameters-Names refer to "read-only" Parameters that can not be changed or may result in strange side-effects if you change them.

 

MaxResults

PixelHits

ColorTolerance

DebugMode

HWnd

Use_First

Snap_Border

CPU

Snap_Border

MovePoint

LastPattern

LastCount

LastHits

FlagA

 

Then there are several "Read Only" Parameter-Names

LastSnap (RO)

XSize (RO)

YSize (RO)

Result (RO)

 

  P2 - Value for Parameter The value that is to be stored inside the given Parameter.

 

The values are not checked for validity. Specifying nonsense values may have unforeseeable side-effects.

 

Example

 

' Set and Read the value of "MaxResults"

SFP.mr|12

GFP.mr|$$RES

MBX.$$RES

ENR.

 

' Set the maximum Number of used CPU-Cores to 8

SFP.CPU|8

GFP.CPU|$$RES

MBX.$$RES

 

 

Remarks

-

 

Limitations:

The values are not checked for validity. Specifying nonsense values may have unforeseeable side-effects.

 

 

See also:

 

    GFP-Command