<< Click to Display Table of Contents >> Navigation: 3. Script Language > Image/Pixel-Color Operations > ANA. - Imageworks > Manage IR's > Image/Pixel-Color Operations |
MiniRobotLanguage (MRL)
ANA.Compare
Compare an Image-Register (IR) vs. another IR with Tolerance
Intention
This command will compare the Content of an IR with another IR, the result will be just 0 or 1 to show if the two are identical or not.
It can use a Fuzzy Logic-2 Step-Tolerance.
You can specify a Color-Tolerance between 0 and 442 and you can specify how many Pixels are allowed to be out of this Tolerance before the Compare fails.
The result will always be the Position of the Pixel that exceeds these two given Parameters.
For example: If you say "Tolerance 10, and 15 Pixel Count", the given Pixelwill be the 15th Pixel that does not match the Source Colour for more then the Pixel-Tolerance.
This Command can be combined with the "ANA.BlockTo" Command for Interesting effects.
If the two IR's that you want to Compare do not have the same resolution, you can use the ANA.equalres Command to enforce the same resolution.
Important: The Compare Operation currently is done Left->Right and Top->Bottom.
Both IR that will be compared, must have the same size!
1. Compare two IR with different results
This will include all Screens on a Dual-Screen System. Here we search a Pattern on the complete Desktop.
ANA.New|0|160|40
ANA.vgradient|0|&HFF0000|&H1000FF
ANA.copy|0|1
ANA.Compare|0|1
DMP.6
MBX.Result is zero, both are equal
ANA.vgradient|1|&HFF0000|&H1000F4
ANA.Compare|0|1
DMP.6
MBX.Result is Pixel Number 5442 at Position 2,34 exceeds the given Parameters.
ANA.Compare|0|1|4|100
DMP.6
MBX.Result is Pixel Number 2181 at Position 101,13 exceeds the given Parameters.
ENR.
Here is the result of the Stack for the first DMP.6
Here is the result of the Stack for the second DMP.6
Syntax
ANA.Compare|P1|P2[|P3][|P4]
Parameter Explanation
P1 - Image-Register number
P2 - Image-Register number to compare with P1
P3 - opt. Colour-Tolerance between 0 and 442 (442 is the Colour-difference between black and white)
P4 - opt. Number of allowed "Hits", Pixels that do not match and do exceed the Color-Tolerance.
The Command will leave a 0 on the TOS if the two IR's do match.
If they do NOT match to each other, you will get a result like this:
On TOS is the "Pixel-Number" of the last Pixel that exceeds the given conditions,
below is the "X-Position" and below the "Y-Position" of that Pixel.
Example
'***********************************
' ANA.Compare-Sample
'***********************************
ANA.New|0|160|40
ANA.vgradient|0|&HFF0000|&H1000FF
ANA.copy|0|1
ANA.Compare|0|1
DMP.6
MBX.Result is zero, both are equal
ANA.vgradient|1|&HFF0000|&H1000F4
ANA.Compare|0|1
DMP.6
MBX.Result is Pixel Number 5442 at Position 2,34 exceeds the given Parameters.
ANA.Compare|0|1|4|100
DMP.6
MBX.Result is Pixel Number 2181 at Position 101,13 exceeds the given Parameters.
ENR.
Remarks
-
Limitations:
-
See also:
•