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

SRG./GRG. - Set/Get Color Condition Register

Previous Top Next


MiniRobotLanguage (MRL)

 

SRG. - Set Color Condition Register

GRG. - Get Color Condition Register

Get or Set the CCR (Color Condition Registers) for use with commands as ICC. and RIC. etc.

 

 

Intention

 

There are currently 8 Color Condition Registers that can be set and read using these commands.

They are numbered 0 to 7.
These commands will take 2 Color-Values for each CCR (Color Condition Register).

These two color values are the "Minimum" and the the "Maximum" value for each of "R,G and B".

So these 2 values define a "Condition". If you take any color and compare it to this condition, there is result whether the condition evaluates true or false.

So the Colour of the specified Pixel must be inside this RGB Range then the CCR Min and Max-Values then it will evaluate to "true".

Currently the SRG.-Command is the Command that is used.

The GRG. - Command is implemented for Completeness, but does not have any important use.

 

Here is a Sample Script that will remove unwanted Artefacts - for example here a watermark - from a picture.

 

Orig_01     -> clip0097

And here is a Sample Script:

 

' 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:

 

clip0110

 

 

 

Syntax

 

SRG.P1|P2|P3|P4|P5|P6|P7

GRG.P1|P2|P3|P4|P5|P6|P7

 

 

Parameter Explanation

P1 - one of the following Terms, that will specify the used Parameters:

  All - in this case you need to specify all values (See example below) - the last value is the CCR-Number (0 to 7). If omitted 0 is the default.

        Details see in the Example below.

 

  LA - you specify 2 Color Values - these are Color-Values like &HA0FF1C that represents the three values which are Red-Min,Green-Min and Blue-Min and Red-Max,Green-Max and Blue-Max.

       - the P4 value is the CCR-Number (0 to 7). If omitted 0 is the default.

 

  Min - you only specify the 3 values which are Red-Min,Green-Min and Blue-Min.
        The last value is the CCR-Number (0 to 7). If omitted 0 is the default.

        If no further values for Max will be specified, R/G/B-Max is assumed to be 255.

 

  Max - you only specify the 3 values which are Red-Max,Green-Max and Blue-Max. The value of 0 is not allowed for a Max-Value and will be replaced by &HFF.
      - the last value is the CCR-Number (0 to 7). If omitted 0 is the default.

        If no further values for Min will be specified, R/G/B-Min is assumed to be 0.

 

  Minl - you only specify the 1 Value - that is a Color-Value like &HA0FF1C that represents the three values which are Red-Min,Green-Min and Blue-Min
       - the P3 value is the CCR-Number (0 to 7). If omitted 0 is the default.

         If no further values for Max will be specified, R/G/B-Max is assumed to be &HFFFFFF.

 

  Maxl - you only specify the 1 Value - that is a Color-Value like &HA0FF1C that represents the three values which are Red-Max,Green-Max and Blue-Max

       - the P3 value is the CCR-Number (0 to 7). If omitted 0 is the default.

        If no further values for Min will be specified, R/G/B-Min is assumed to be &H00000.

 

Using SRG. you can use numerical Variables or directly numbers.

Using GRG. the Color Values must be given as Variables, then the values will be filled into these variables.

 

 

 

Example

 

SRG.All|$$RMin|$$RMax|$$GMin|$$GMax|$$BMin|$$BMax|$$Num

'     0    1     2       3       4     5       6   | 7

SRG.Min|$$RMin|$$GMin|$$BMin|$$Num

'     0    1     2       3       4

SRG.Max|$$RMax|$$GMax|$$BMax|$$Num

'     0    1     2       3       4

 

SRG.Minl|$$Col|$$Num

SRG.Maxl|$$Col|$$Num

SRG.La|$$CMin|$$CMax[|$$Num]

 

 

GRG.All|$$RMin|$$RMax|$$GMin|$$GMax|$$BMin|$$BMax|$$Num

'     0    1     2       3       4     5       6   | 7 

GRG.Min|$$RMin|$$GMin|$$BMin|$$Num

'     0    1     2       3       4

GRG.Max|$$RMax|$$GMax|$$BMax|$$Num

'     0    1     2       3       4

 

GRG.Minl|$$Col|$$Num

GRG.Maxl|$$Col|$$Num

GRG.La|$$CMin|$$CMax[|$$Num]

 

 

 

Remarks

The SRG.-Commands is fast. It will use only about 200 to 400 Ticks. Therefore the Robot could execute it more then >50000 times per Second.

 

 

 

Limitations:

 

-

 

 

See also:

 

    RIC. Replace If Color Condition

    ICC. If Color Condition