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

ICC./ NCC. - If Color Condition

Previous Top Next


MiniRobotLanguage (MRL)

 

ICC.If Color Condition

NCC.If NOT Color Condition

Get a Pixel from an IR and test the Pixel-Color-Value about R,G and B values

 

 

Intention

 

These commands 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".

 

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 ICC. will evaluate "true" and NCC: will evaluate "false".

 

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" using the ICC.-Command.

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

    ICC.0|$$XPO|$$YPO|&HD0|0|&HD0|0|&HD0|0

    ANA.Setpixelcolor|0|$$XPO|$$YPO|$$PIX

  EIF.

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

    ANA.Setpixelcolor|0|$$XPO|$$YPO|$$PIX

  EIF.

  NEX.

NEX.

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

MBX.Used Time in Seconds: $$TIM

ANA.Show|0!

ANA.Save|0|$$PIB

ENR.

 

 

Speed-Dump, total Time used: 309 Seconds:

 

clip0109

 

 

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

' this may speed up the process.

VAN.$$TIM=#time#

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

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

ANA.Load|0|$$PIA

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

$$PIX=&HFFFFFF

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

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

FOR.$$YPO|0|$$YSZ

  PRT.! $$YPO/$$YSZ

  FOR.$$XPO|1|$$XSZ

    ICC.0|$$XPO|$$YPO|0

    ANA.Setpixelcolor|0|$$XPO|$$YPO|$$PIX

  EIF.

  ICC.0|$$XPO|$$YPO|1

  ANA.Setpixelcolor|0|$$XPO|$$YPO|$$PIX

EIF.

NEX.

NEX.

DMP.1

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

MBX.Used Time in Seconds: $$TIM

ANA.Show|0!

ANA.Save|0|$$PIB

ENR.

 

 

 

Speed-Dump, total Time used: 216 Seconds:

 

clip0145

 

 

 

Syntax

 

ICC.P1|P2|P3|P4|P5|P6|P7|P8|P9  ... ELS.  ..EIF

NCC.P1|P2|P3|P4|P5|P6|P7|P8|P9  ... ELS.  ..EIF

or you can use CCR (Color Condition Register)

ICC.P1|P2|P3|P4  ... ELS.  ..EIF

NCC.P1|P2|P3|P4  ... ELS.  ..EIF

 

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 - opt. Color Condition Register Number (default 0). The Color Condition Register must be set using the SRG. - Command

 

Example

 

See above.

 

 

 

 

Remarks

The ICC.-Commands is fast. It will use only about 185 Ticks per Pixel. Therefore the Robot could execute it more then >85000 times per Second.

 

 

 

Limitations:

 

-

 

 

See also:

 

    RIC. Replace If Color Condition