<< Click to Display Table of Contents >> Navigation: 3. Script Language > Image/Pixel-Color Operations > ANA. - Imageworks > Color Table Operations > Image/Pixel-Color Operations |
MiniRobotLanguage (MRL)
ANA.GetColorCount
Returns the Color of the Background of an IR
Intention
This Command needs the ANA.AnalyzeColor Command to count colors in an IR before it will work. It may also need the "Force-Flag" (P2) to be set.
ANA.AnalyzeColor|0|1
' These are some further commands that can be used after the ANALYZE.
ANA.getcolorcount|0|$$CNT
ANA.getbgcolor|0|$$BGC
you can then work with the list entries.
This ccommand will return the color that is mostly used in the IR. It is assumed that the "Color of most of the Pixels" is the Background color.
VAF.$$PIA=?exeloc\Sarah_BG.png
ANA.Load|0|$$PIA
ANA.Show|0!
ANA.AnalyzeColor|0|1
' Greenboard-Color, Mask and the color-range that shall be removed must be adjusted per picture
$$COL=&H30FF30
$$MSK=&HFFFFFF
ANA.GetColorCount|0|$$CNT
MBX.Number of Color in IR 0: $$CNT
ENR.
Will bring up this Messagebox.
With this picture:
Here is the Speed-Dump:
Syntax
ANA.GetColorCount[|P1][|P2]
Parameter Explanation
P1 - Source Image-Register Number, if omitted 0 is used.
P2 - (Result) Color of Background, if omitted the result is placed on TOS.
P3 - (Result) Number of Pixels using the Color of Background (in P2), if omitted the result is placed on TOS.
The Command will not leave a 0/1 on the TOS. If the Operation fails, P2 may be "0".
Example
'***********************************
' ANA.GetColorCounts-Sample
'***********************************
VAF.$$PIA=?exeloc\Sarah_BG.png
ANA.Load|0|$$PIA
ANA.Show|0!
ANA.AnalyzeColor|0|1
' Greenboard-Color, Mask and the color-range that shall be removed must be adjusted per picture
$$COL=&H30FF30
$$MSK=&HFFFFFF
ANA.GetColorCount|0|$$CNT
DBP.$$CNT
CAL.$$LES=$$CNT-5
ANA.Sort_Similar_To|&H26592A|$$MSK
ANA.Reduce_Colors|0|$$LES|$$CNT|90|-1|2
ANA.GetColorCount|0|$$CNT
DBP.$$CNT
DMP.Speed
ANA.Show|0!
ENR.
' Below you can see the result of the Operation.
Remarks
-
Limitations:
-
See also: