<< Click to Display Table of Contents >> Navigation: 3. Script Language > Image/Pixel-Color Operations > ANA. - Imageworks > Pattern-Recognition > Image/Pixel-Color Operations |
MiniRobotLanguage (MRL)
ANA.DownScale
DownScale a 12x12 Pattern (inside an IR) to smaller Sizes
Intention
If you have a 12x12 pattern and you want it to be recognized at different zoom settings, the best approach is to record the pattern in its native resolution.
As an alternative, you can use the ANA.DownScale command to automatically generate smaller patterns from the original 12x12 pattern. This method works best with simple symbols and patterns that do not use Cleartype.
Assume your browser setting is at 100%. We will record a red cross as a pattern and then generate a downscaled version.
You can use the "ANA.FindPattern4|0|$$COT|$$PIH|$$COT|$$PIH|$$COT|$$PIH|$$COT|$$PIH"
command to search for multiple patterns at once. The ANA.ShowHits command can be used to identify which patterns have been detected.
Due to the way fonts are rendered in Windows (using "Cleartype"), downscaled versions may not work well with text.
They are more effective when used with symbols.
If the downscaled versions are ineffective, simply record the pattern at the desired zoom level using the HE-Recorder. If you record using the 12x12 pattern size, the HE-Recorder will automatically call the "Downscale" command and save multiple sizes. However, it's generally more effective to record patterns at their native resolution. Even with a high tolerance setting, the success rate with downscaled patterns may not be perfect.
The images below show browser symbols at 100% and 75% zoom, detected using a downscaled pattern with high tolerances.
STW.ct|Chrome_WidgetWin_1|General Discussion - Brave
SWP.12,9|1216,717|T
VAR.$$PA1=?pattern\Cross_12.bmp
ANA.Load|1|$$PA1
' This will generate the 4 Downscaled Versions
ANA.DownScale|1|2
VAN.$$COT=110
VAN.$$PIH=-60
ANA.Snap|0
ANA.FindPattern4|0|$$COT|$$PIH|$$COT|$$PIH|$$COT|$$PIH|$$COT|$$PIH
DMP.1
ANA.ShowHits|0!
ENR.
The first Picture shows the Finds at a Browser Zoom of 100%. The following Pictures show the findings at a Browser Zoom of 80%, 75%, and 67% using the downscaled Patterns.
The first Picture shows the Speed-Dump.
Here is another Sample-Script, in case you have the Patterns already in the ?Pattern\ Folder..
' If you alread have the downscaled Variants
' maybe from the HE-Recorder
' Then you can just load them like this:
STW.ct|Chrome_WidgetWin_1|General Discussion - Brave
SWP.12,9|1216,717|T
VAR.$$PA1=?pattern\Cross_12.bmp
FOR.$$LR3|1|4
CAL.$$NUM=$$LR3+8
VAR.$$PA1=?pattern\Cross_$$NUM.bmp
ANA.Load|$$LR3|$$PA1
DBP.Loading: $$PA1
NEX.
VAN.$$COT=110
VAN.$$PIH=-60
ANA.Snap|0
ANA.FindPattern4|0|$$COT|$$PIH|$$COT|$$PIH|$$COT|$$PIH|$$COT|$$PIH
DMP.6
ANA.ShowHits|0!
ENR.
If you save the Pattern with the HE-Recorder, you will automatically get more versions:
This is internally the result of "DownScale" using the HE-Recorder with a Pattern-Size of 12x12.
Syntax
ANA.DownScale[|P1][|P2][|P3][!][!]
Parameter Explanation
P1 - Source-Pattern IR (Pattern to Scale)
P2 - First Target IR, other Targets are successive IR's -> P2+X ...
P3 - Number of downscaled Variants to produce
Example
STW.ct|Chrome_WidgetWin_1|General Discussion - Brave
SWP.12,9|1216,717|T
VAR.$$PA1=?pattern\Cross_12.bmp
ANA.Load|1|$$PA1
' This will generate the 4 Downscaled Versions
ANA.DownScale|1|2
VAN.$$COT=110
VAN.$$PIH=-60
ANA.Snap|0
ANA.FindPattern4|0|$$COT|$$PIH|$$COT|$$PIH|$$COT|$$PIH|$$COT|$$PIH
DMP.1
ANA.ShowHits|0!
ENR.
Remarks
-
Limitations:
-
See also: