<< Click to Display Table of Contents >> Navigation: 3. Script Language > Image/Pixel-Color Operations > ANA. - Imageworks > Color-Calculation > Image/Pixel-Color Operations |
ANA.Split_RGB / Combine_RGB - Split a Color-Value into R,G and B Values or Combine these. |
Previous Top Next |
MiniRobotLanguage (MRL)
ANA.Split_RGB
Split the a specified Color-Value into R,G and B
ANA.Combine_RGB
Combine the R,G and B Values into a Color-Value
Intention
This command will split an 24-bit Color-Value into the three 8-Bit Color-Components for R,G and B.
While that does not Sound much, it enables you to do unlimited complex Image processing,
Together with other Commands like ANA.Combine_Color_RGB.
1. Color-Processing
In this Sample we will additionally change the Colors.For this we use the two Commands:
ANA.getpixelcolor|1|$$XPO|$$YPO|$$PIX
' This is just for example normally you would use ANA.GetPixelColor_RGB which combines these commands.
ANA.Split_RGB|$$PIX|$$COR|$$COG|$$COB
' We Combine the Colors in away that Blue and Green is exchanged.
ANA.Combine_RGB|$$COG|$$COR|$$COB|$$PIX
' And Set the Pixel
ANA.Setpixelcolor|0|$$XPO|$$YPO|$$PIX
And then Paint the Picture.
In the SPR you can use virtually unlimited Graphics Sources to be combined.
.
' Here is the Code.
' On my Computer it uses 5 Minutes Processing time for a Picture of Medium size in the Editor in "Free-Run Mode".
VAN.$$TIM=#time#
VAF.$$PIA=?pattern\Sarah_640.jpg
VAF.$$PIB=?pattern\Mahakala2.png
ANA.Load|0|$$PIA
ANA.Load|1|$$PIB
ANA.GetRes|0|$$XSZ|$$YSZ
FOR.$$YPO|1|$$YSZ
DBP.$$YPO/$$YSZ
FOR.$$XPO|1|$$XSZ/2
ANA.GetPixelRGB|0|$$XPO|$$YPO|$$RED|$$GRN|$$BLU
CAL.$$ERG=($$GRN>&H80)+($$GRN>$$BLU)+($$GRN>$$RED))
IVV.$$ERG>2
ANA.getpixelcolor|1|$$XPO|$$YPO|$$PIX
ANA.Split_RGB|$$PIX|$$COR|$$COG|$$COB
ANA.Combine_RGB|$$COG|$$COR|$$COB|$$PIX
ANA.Setpixelcolor|0|$$XPO|$$YPO|$$PIX
EIF.
NEX.
NEX.
CAL.$$TIM=#time#-$$TIM
DBP.Used Time in Seconds: $$TIM
DMP.1
ANA.Show|0!
ENR.
->
The Script used ~300 Seconds to complete process the picture.
Here is the Speed-Dump:
Syntax
ANA.Split_Color_RGB[|P1][|P2][|P3][|P4]
Parameter Explanation
P1 - Color Value (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB)
P2 - Variable for Color-Value for Red
P3 - Variable for Color-Value for Green
P4 - Variable for Color-Value for Blue
ANA.Combine_Color_RGB[|P1][|P2][|P3][|P4]
Parameter Explanation
P1 - Variable for Color-Value for Red
P2 - Variable for Color-Value for Green
P3 - Variable for Color-Value for Blue
P4 - opt. Variable for resulting Color Value (24-Bit, Format in Hexadezimal: &HFFFFFF=RR GG BB). If missing the value is been placed on TOS.
Example
See above.
Remarks
The ANA.Combine_Color_RGB is optimized for Speed. It will use only about 444 Ticks. Therefore the Robot could split more then 36000 Values per Second.
Limitations:
-
See also:
•