<< Click to Display Table of Contents >> Navigation: 3. Script Language > Image/Pixel-Color Operations > ANA. - Imageworks > Color-Calculation > Image/Pixel-Color Operations |
MiniRobotLanguage (MRL)
ANA.Sub_Color
Subtract Color P2 from Color P1
ANA.Add_2_Colors
Add 2 Colors additive
ANA.Add_3_Colors
Add 3 Colors additive
ANA.Add_4_Colors
Add 4 Colors additive
ANA.Mix_2_Colors
Average 2 Colors additive
ANA.Mix_3_Colors
Average 3 Colors additive
ANA.Mix_4_Colors
Average 4 Colors additive
Intention
Use the SPR like a box with watercolors. Add colors and use them for Painting. Also you can subtract colors -
that is somehow like watching through a colored glass.
These command do color calculations to Mix or Subtract colors.
For this it will internally split the colors into its three 8-Bit Color-Components for R,G and B.
And use these for the final calculation.
What is the difference between ADD and MIX?
Using Add, the color-values will just be added to each other therefore the result will be an real addition.
Using Mix, the color-values will be added and then divided by the number of Sources therefore the result will be an average of the sources.
While that does not Sound much, it enables you to do unlimited complex color Mixing and processing.
You can use Colors like physical colors that you can mix together and paint with these.
1. Color-Calculations
In this Sample we will just add and subtract some colors.
$$COA=&H102030
$$COB=&H010203
ANA.Mix2|$$COA|$$COB|$$RES
VTH.$$RES
DBP.&H$$RES
ANA.Sub|&H$$RES|$$COB|$$REX
VTH.$$REX
DBP.&H$$REX
ENR.
Here you can see the result.
2. Filter Color Bandwith
Here we can use this to clean up a picture and remove artefacts.
.
VAN.$$TIM=#time#
VAF.$$PIA=?exeloc\BNB.jpg
VAF.$$PIB=?exeloc\V2.jpg
ANA.Load|0|$$PIA
ANA.GetRes|0|$$XSZ|$$YSZ
CAL.$$FAC=&H909090
FOR.$$YPO|1|$$YSZ
PRT.$$YPO/$$YSZ
FOR.$$XPO|1|$$XSZ
ANA.getpixelcolor|0|$$XPO|$$YPO|$$PAX
ANA.Sub|$$PAX|$$FAC|$$PAX
ANA.Add2|$$PAX|&HF0F0F0|$$PBX
ANA.Sub|$$PBX|$$FAC|$$PAX
ANA.Setpixelcolor|0|$$XPO|$$YPO|$$PAX
NEX.
NEX.
RCC.0|&H0|&H61|0|&H61|0|&H61|0
RCC.0|&HC6e|&HFF|&HC6e|&HFF|&HC6e|&HFF|&HFFFFFF
CAL.$$TIM=#time#-$$TIM
DBP.Used Time in Seconds: $$TIM
DMP.1
ANA.Save|0|$$PIB
ANA.Show|0!
ENR.
->
The Script will remove all watermarks and JPG-Artefacts and also darken the picture.
The Speed-Dump looks like this:
Syntax
ANA.Sub_Color|P1|P2[|P3]
Parameter Explanation
P1 - Color Value A (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P2 - Color Value B (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P3 - Variable the result.
ANA.Add_2_Colors|P1|P2[|P3]
Parameter Explanation
P1 - Color Value A (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P2 - Color Value B (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P3 - Variable the result.
ANA.Add_3_Colors|P1|P2|P3[|P4]
Parameter Explanation
P1 - Color Value A (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P2 - Color Value B (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P3 - Color Value C (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P4 - Variable the result.
ANA.Add_4_Colors|P1|P2|P3|P4[|P5]
Parameter Explanation
P1 - Color Value A (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P2 - Color Value B (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P3 - Color Value C (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P4 - Color Value D (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P5 - Variable the result.
ANA.Mix_2_Colors|P1|P2[|P3]
Parameter Explanation
P1 - Color Value A (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P2 - Color Value B (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P3 - Variable the result.
ANA.Mix_3_Colors|P1|P2|P3[|P4]
Parameter Explanation
P1 - Color Value A (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P2 - Color Value B (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P3 - Color Value C (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P4 - Variable the result.
ANA.Mix_4_Colors|P1|P2|P3|P4[|P5]
Parameter Explanation
P1 - Color Value A (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P2 - Color Value B (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P3 - Color Value C (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P4 - Color Value D (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P5 - Variable the result.
Example
' Paint 5 "Fingerprints"
VAN.$$TIM=#time#
ANA.New|1|800|400
ANA.vgradient|1|&HFF00FF|&H000000
ANA.New|0|800|400
ANA.hgradient|0|&H0000FF|&H00FFFF
ANA.Mix|1|0|7
ANA.GetRes|0|$$XSZ|$$YSZ
FOR.$$LOA|1|5
PRT.$$LOA
RND.100|($$XSZ-100)|$$XPA
RND.100|($$YSZ-100)|$$YPA
RND.0|&H808080|$$COL
GSB.PaintCirc
NEX.
CAL.$$TIM=#time#-$$TIM
DBP.Used Time in Seconds: $$TIM
DMP.1
ANA.Save|0|$$PIB
ANA.Show|0!
ENR.
'-----------------------------------------------------------
:PaintCirc
FOR.$$LIB|2|40|2
FOR.$$LOP|0|8|0.1
CAX.$$XPO=SIN($$LOP)*$$LIB+$$XPA|i
CAX.$$YPO=COS($$LOP)*$$LIB+$$YPA|i
ANA.getpixelcolor|0|$$XPO|$$YPO|$$PAX
ANA.Add2|$$PAX|$$COL|$$PBX
ANA.Setpixelcolor|0|$$XPO|$$YPO|$$PBX
NEX.
NEX.
RET.
Here is the Speed-Dump for the Script.
Remarks
The ANA.Sub/Add/Mix Commands are optimized for Speed. They will only use about 210 Ticks. Therefore the Robot could work on more then 76000 Values per Second.
Limitations:
-
See also:
•