ANA. - Imageworks

<< Click to Display Table of Contents >>

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

ANA. - Imageworks

 

If you can not localize Controls in any way, you can now use the ANA.-Command to work on a graphical Patterns. This way you can localize things any way.

 

Also ANA. contains a lot of Graphic-commands that you can use for Batch-Image-Processing of Pictures.

 

Here are some general Informations that apply to all ANA.-Commands:

 

1. ANA gives you a Set of 20 Image-Registers.

In each command you can specify one or more Source-Registers, and sometimes also a destination register.

 

2. In most cases where you do not specify a destination register, the source register will be overweritten with the result of the operation.

 

3. You can copy or move content from one Image-Register to other Image Registers.

 

4. You can load an Image into these Registers or you can Snapshot a localized Window into these Registers

5. Then you can do several types of processing with these Images.

6. And finally you can save the pictures.

 

And:

 

7. ANA. contains commands for Patterns-Search. These commands are not simple Pattern-Searching Commands, but highly optimized commands that include a Fuzzy-Logic. This way you can also find things that do not look exactly like the pattern but "somehow".

 

Generally to use ANA. you will first need to fill the Image-Register(s) with some content.

That will be processed in further steps.

 
We will call these "Image-Registers" in Short "IR".

 

You can use the first 20 Image Registers freely. There are some more Image-Registers available, but they are used by Operations internally (21-32).

 

The Blit-Command uses the GPU for fast Graphics-Operations. On some Operations there can be artefacts.

If you do not want these, you can use the "ANA.Logic" Command that uses the CPU.

 

Warning on Variables with Binary Content:

If you have Variables with Binary Content, or Picture-Content (like you get them from ANA.ToVar)

then please clear them before you use them as Return Variables for other ANA.-Commands.

Reason:

Generally all Variables that are given to the ANA.-Command are automatically resolved.

Unless the Command is prefixed with a "#" (like ANA.#FromVar).

Now its possible that Binary Data that might be in a Variable, contains "$$XXX" Patterns,

and if these match with a real existing Variable, this could lead to endless Variable resolution.

Therefore it makes sense that you clear all Variables that contain binary or picture-data before you use them with ANA.-Commands

other then those with a "#" in front of the Command-Name. The same can also happen with other commands then ANA.

If your Script hangs unexpectedly, this might be a reason.

 

 

Sample Image-Processing Script:

 

P3   -> clip0150 clip0151

 

 

' Turning a b/w picture into a 3D-Logo

$$PAB=?exeloc\Pics\P3.jpg

 

$$BOR=4

CAL.$$BOB=$$BOR/2

 

IEF.$$PAB

  ANA.Load|1|$$PAB

  'ANA.Show|1!

ELS.

  MBX.File does not exist:$crlf$$$PAT

EIF.

 

ANA.GetRes|1|$$XPO|$$YPO  

CAL.$$XPA=$$XPO+$$BOR

CAL.$$YPA=$$YPO+$$BOR

 

' Make a Resized Version of P3

ANA.New|2|$$XPA|$$YPA|1

ANA.New|3|$$XPA|$$YPA

 

' Now mix Shiftzed and Resized Version

ANA.bsh|2|1|$$BOB|$$BOB|1

ANA.Invert|1

'ANA.bw|1|100

ANA.bw|2|600

ANA.Show|1!

ANA.Show|2!

ANA.Logic|3|1|2|A XOR B|RGB

ANA.Show|3!

'ANA.MixTar|1|2|2

ANA.Invert|3

ANA.Show|3!

ENR.

 

' Changing the first two lines like this, will produce the second picture:

$$BOR=2

CAL.$$BOB=$$BOR

 

 

IMPORTANT NOTICE about missing Administration Rights Effects: 

 

  When you start the Script from an SPR-Editor that has NO Admin-Rights, you may not be able to load pictures

  from the Standard Robot path because its below C\Programme (x86)\ and you need Admin-Access to load files there.

  As a result you will get only BLACK PICTURES using ANA.Load.

  So if you only get Black Pictures, try to use ADMIN-RIGHTS for the Script.

 

 

More Commands that are not yet documented:

 

ANA.SetMaxResults (no. of Results)

 

ANA.CompareBlock Target Index|Pattern Index|X-Pos Pattern|Y-Pos Pattern|Color Tolerance|Pixel-Hits|$$Out (will contain Number of Hits)

Will put 2 Values on the TOS, TOS -> Number of Pixelhits, TOS-1 -> 0/1 if Error

 

ANA.ShowHits|Index IR with Snap|Size of Marker X|Size of Marker Y

 

ANA.ResetList

 

ANA.ResetResultsPack

 

ANA.SortResultsPack P1|P2
P1 - 0/1  (0 - Descending, 1 - Ascending Sort)

P2 - 0/1 (0 - Sort Y / 1 - Sort X)

 

ANA.GetResultItem P1|P2

P1 - Number of Item to get on TOS

P2 - 0/1 delete Item after get

Will place Items on the TOS:

0/1 - Error/Success

X,Y - Middlepoint of FoundRect

X1,Y1,X2,Y2 - Found Rectangle

Number of Source--Pattern (Multi-Find) or 1

Pattern-Size as String "8x8"

 

ANA.SnapFind1 P1|P2|P3|P4|P5|P6

P1 - Filepath Patternfile

P2 - Farbtoleranz

P3 - Pixel-Hits min.

P4 - 0/1 Debugmode

P5 - "0,0" Positionscorrection

P6 - Maximum Number of Finds