Image/Pixel-Color Operations

<< Click to Display Table of Contents >>

Navigation:  3. Script Language > Image/Pixel-Color Operations > ANA. - Imageworks > Pixel-Operation >

Image/Pixel-Color Operations

RIC. - Replace If Color Condition

Previous Top Next


MiniRobotLanguage (MRL)

 

RIC.If Color Condition

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

 

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:

 

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 cahnge 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.

 

Orig_01     -> clip0097

And here is the Script:

 

Pixelprocessing: "Pixel by Pixel". Used time: 235 Seconds

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

FOR.$$YPO|0|$$YSZ

  PRT.$$YPO/$$YSZ

  FOR.$$XPO|1|$$XSZ

    RIC.0|$$XPO|$$YPO|&HD0|0|&HD0|0|&HD0|0|$$PIX 

    RIC.0|$$XPO|$$YPO|&HC0|&HF0|&HA9|&HE0|&HB9|&HE9|$$PIX

  NEX.

NEX.

CAL.$$TIM=#time#-$$TIM

DMP.1

MBX.Used Time in Seconds: $$TIM

ANA.Show|0!

ANA.Save|0|$$PIB

ENR.

 

 

Speed-Dump:

 

clip0111

 

 

 

Pixelprocessing: "Pixel by Pixel using CCR". Used time: 233 Seconds

 

 

' You can use the Color Condition Registers to work with less Parameters inside the Loop

VAN.$$TIM=#time#

VAF.$$PIA=?exeloc\Igorslab.png

VAF.$$PIB=?exeloc\V1.png

ANA.Load|0|$$PIA

SRG.&HD0|0|&HD0|0|&HD0|0|0

SRG.&HC0|&HF0|&HA9|&HE0|&HB9|&HE9|1

ANA.GetRes|0|$$XSZ|$$YSZ

$$PIX=&HFFFFFF

FOR.$$YPO|0|$$YSZ

  PRT.$$YPO/$$YSZ

  FOR.$$XPO|1|$$XSZ

    RIC.0|$$XPO|$$YPO|0|$$PIX 

    RIC.0|$$XPO|$$YPO|1|$$PIX

  NEX.

NEX.

CAL.$$TIM=#time#-$$TIM

DMP.1

MBX.Used Time in Seconds: $$TIM

ANA.Show|0!

ANA.Save|0|$$PIB

ENR.

 

 

clip0112

 

 

 

 

 

 

 

 

Syntax

 

RIC.P1|P2|P3|P4|P5|P6|P7|P8|P9

or you can use CCR (Color Condition Register)

RIC.P1|P2|P3[|P4]

 

 

Parameter Explanation

P1 - Image Register Number

P2 - X-Coordinate for the Pixel to read in the Image-Register

P3 - Y-Coordinate for the Pixel to read in the Image-Register

 

Syntax I

P4 /P5 - (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).

P6 /P7 - (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).

P8 /P9 - (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).  

 

Syntax II

P4 -  

 

 

Example

 

See above.

 

 

 

 

Remarks

The RIC.-Commands is fast. It will use only about ~225 Ticks per Pixel. Therefore the Robot could execute it more then >70000 times per Second.

 

 

 

Limitations:

 

-

 

 

See also:

 

    ICC. - If Color Condition