<< Click to Display Table of Contents >> Navigation: 3. Script Language > Image/Pixel-Color Operations > ANA. - Imageworks > Pixel-Operation > Image/Pixel-Color Operations |
MiniRobotLanguage (MRL)
RCC.If Color Condition for IR
Process Block of Pixels or complete IR
Get a Pixel from an IR and test the Pixel-Color-Value about R,G and B values, if it matches the Condition, set the Pixel with a given color.
Intention
This Command is the optimized Version of RIC. It will not only process 1 Pixel but a Block of Pixels or the Complete IR in one Strike.
These command will take 2 Color-Values for R,G and B value. The first in the "Minimum" and the second is the "Maximum".
So the Colour of the specified Pixel must be inside this RGB Range then the Condition will evaluate to "true" and the Command will change the color of that Pixel to another color.
So the Command does this for the specified Block or the complete IR:
1. Read the specified Pixel from the IR.
2. Split the Pixelcolor into R,G and B values
3. Check if all 3 values (R,G and B) are inside the given range
If that is the case then the RIC. will evaluate "true" and directly change the color of that pixel to the specified color..
Here is a Sample Script that will remove unwanted Artefacts - for example here a watermark - from a picture.
->
And here is the Script:
Pixelprocessing: "Complete IR in one Strike".
The structure of this Script is easy to understand and it can be modified for any case.
VAN.$$TIM=#time#
VAF.$$PIA=?exeloc\Igorslab.png
VAF.$$PIB=?exeloc\V1.png
ANA.Load|0|$$PIA
ANA.GetRes|0|$$XSZ|$$YSZ
$$PIX=&HFFFFFF
RCC.0|&HD0|0|&HD0|0|&HD0|0|$$PIX
RCC.0|&HC0|&HF0|&HA9|&HE0|&HB9|&HE9|$$PIX
CAL.$$TIM=#time#-$$TIM
DMP.1
MBX.Used Time in Seconds: $$TIM
ANA.Show|0!
ANA.Save|0|$$PIB
ENR.
Speed-Dump:
VAN.$$TIM=#time#
VAF.$$PIA=?exeloc\Igorslab.png
VAF.$$PIB=?exeloc\V1.png
ANA.Load|0|$$PIA
ANA.GetRes|0|$$XSZ|$$YSZ
$$PIX=&HFFFFFF
RCC.0|&HD0|0|&HD0|0|&HD0|0|0
RCC.0|&HC0|&HF0|&HA9|&HE0|&HB9|&HE9|$$PIX
CAL.$$TIM=#time#-$$TIM
DMP.1
MBX.Used Time in Seconds: $$TIM
ANA.Show|0!
ANA.Save|0|$$PIB
ENR.
Using the ! - (Negate Result) Operator, you get such Results.
If this Operator is set then RCC. will only set the Pixel-Color if the condition is NOT True.
' Using the ! - Operator with RCC.
VAN.$$TIM=#time#
VAF.$$PIA=?exeloc\Igorslab.png
VAF.$$PIB=?exeloc\V1.png
ANA.Load|0|$$PIA
ANA.GetRes|0|$$XSZ|$$YSZ
$$PIX=&HFFFFFF
RCC.!0|&HD0|0|&HD0|0|&HD0|0|0
RCC.0|&HC0|&HF0|&HA9|&HE0|&HB9|&HE9|$$PIX
CAL.$$TIM=#time#-$$TIM
MBX.Used Time in Seconds: $$TIM
ANA.Show|0!
ANA.Save|0|$$PIB
ENR.
More Complex Sample
Here on the Left you can see the Original Picture with sort of watermartks
and on the right the picture after the processing with the SPR.
Here on the Left you can see the Original Picture with sort of watermartks and on the right the picture after the processing with the SPR.
In this example we remove watermarks on the white and on the black Parts.
The same Script has been used on both pictures.
VAN.$$TIM=#time#
VAF.$$PIA=?exeloc\BTC2.jpg
VAF.$$PIB=?exeloc\V1.png
ANA.Load|0|$$PIA
ANA.GetRes|0|$$XSZ|$$YSZ
$$PIX=&HFFFFFF
RCC.0|&HD0|0|&HD0|0|&HD0|0|$$PIX
RCC.0|&H0|&H6d|&H0|&H69|&H0|&H6a|0
RCC.0|&H5c|&H80|&H58|&H80|&H59|&H80|0
' Stronger black:
'RCC.0|&H16|&HAF|&H16|&HAF|&H16|&HAF|0
CAL.$$TIM=#time#-$$TIM
DMP.1
MBX.Used Time in Seconds: $$TIM
ANA.Show|0!
ANA.Save|0|$$PIB
ENR.
Syntax
RCC.[!]P1|P2|P3|P4|P5|P6|P7|P8[|P9][|P10][|P11][|P12]
Parameter Explanation
P1 - Image Register Number - if prefixed with an "!" then the Result of the Operation will be negated
P2 /P3 - (numeric) Min./Max. Values for Red, can be from 0 to 255 or in Hexadezimal from 0 to &HFF. If you write "0" in the Max-Field, it will be replaced with 255 (&HFF).
P4/P5 - (numeric) Min./Max. Values for Green, can be from 0 to 255 or in Hexadezimal from 0 to &HFF. If you write "0" in the Max-Field, it will be replaced with 255 (&HFF).
P6 /P7 - (numeric) Min./Max. Values for Blue, can be from 0 to 255 or in Hexadezimal from 0 to &HFF. If you write "0" in the Max-Field, it will be replaced with 255 (&HFF).
P8 - Color that will be used if condition is true
P9 - opt. X-Start-Position
P10 - opt. X-End-Position, if 0 then XMax is used
P11 - opt. Y-Start-Position
P12 - opt. Y-End-Position, if 0 then YMax is used
Using the ! - (Negate Result) Operator in P1, you get other Results.
If this Operator is set then RCC. will only set the Pixel-Color if the condition is NOT True.
Example
See above.
Remarks
The RCC.-Commands is optimized for Speed. It will use only about ~5 Ticks per Pixel. Therefore the Robot can process a full IR in just 1-2 seconds.
Limitations:
-
See also:
• RCC. - Replace If Color Condition
•