Image/Pixel-Color Operations

<< Click to Display Table of Contents >>

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

Image/Pixel-Color Operations

ANA.Complementary_Color / ANA. Inverse_Color

Previous Top Next


MiniRobotLanguage (MRL)

 

ANA.Complementary_Color

Calculate the Complementary Color Value for a given 24-bit Color-Value

ANA.Inverse_Color

Calculate the Inverse Color Value for a given 24-bit Color-Value

 

 

Intention

 

This command will return the Inverse / or complementary color value of a given 24-bit Color-Value.

To show the difference of both here is an example:

 

 

clip0179       clip0182     clip0183

Original Picture                                                        Inverse Color                                                        Complementary Color

 

The Complementary Color is very good to use as Text on Pixels. The Inverse Color is exactly the Inverse Color in the Color-Wheel.

 

 

VAF.$$PIA=?exeloc\Colp.jpg

NEF.$$PIA

  MBX.No such file.

  ENR.

EIF.

ANA.Load|0|$$PIA

ANA.ResizeTo|0|1|640|400

ANA.Copy|1|0

ANA.Copy|1|2

ANA.GetRes|1|$$XRE|$$YRE

 

FOR.$$LOX|0|$$XRE

  PRT.Column: $$LOX/$$XRE

  FOR.$$LOY|0|$$YRE

    ANA.getpixelcolor|0|$$LOX|$$LOY|$$PIB

    

    ANA.Inverse_Color|$$PIB|$$PIC

    ANA.Complementary_Color|$$PIB|$$PID

    

    ANA.Setpixelcolor|1|$$LOX|$$LOY|$$PIC

    ANA.Setpixelcolor|2|$$LOX|$$LOY|$$PID

  NEX.

NEX.

ANA.Compare|1|2|0

POP.$$RES

PRT.Result of Compare: $$RES

 

GSB.Save|1

GSB.Save|2

ENR.

 

 

Here is another Version of the Script using a Picture with a Person.

 

clip0184   clip0185   clip0186   clip0188    

    Original Picture                                        ANA.Inverse_Color                                            ANA.Complementary_Color                                            Complement of Inverted Color    

 

 

VAF.$$PIA=?exeloc\Sara2.jpg

NEF.$$PIA

  MBX.No such file.

  ENR.

EIF.

ANA.Load|0|$$PIA

ANA.Show|0!

ANA.Copy|0|1

ANA.Copy|0|2

ANA.Copy|0|3

ANA.GetRes|0|$$XRE|$$YRE

 

FOR.$$LOX|0|$$XRE

  PRT.Column: $$LOX/$$XRE

  FOR.$$LOY|0|$$YRE

    ANA.getpixelcolor|0|$$LOX|$$LOY|$$PIB

    

    ANA.Inverse_Color|$$PIB|$$PIC

    ANA.Complementary_Color|$$PIB|$$PID

    

    ANA.Setpixelcolor|1|$$LOX|$$LOY|$$PIC

    ANA.Setpixelcolor|2|$$LOX|$$LOY|$$PID

  NEX.

NEX.

' Show Inverted Picture

GSB.Save|1

 

' Complement Inverted Picture

FOR.$$LOX|0|$$XRE

  PRT.Column: $$LOX/$$XRE

  FOR.$$LOY|0|$$YRE

    ANA.getpixelcolor|1|$$LOX|$$LOY|$$PIB

    ANA.Complementary_Color|$$PIB|$$PID

    ANA.Setpixelcolor|1|$$LOX|$$LOY|$$PID

    'Complement Complemented Color

    ANA.Complementary_Color|$$PID|$$PIC

    ANA.Setpixelcolor|3|$$LOX|$$LOY|$$PIC

  NEX.

NEX.

 

' Invert Result from Complementry Color in one strike

GSB.Save|2

ANA.Invert|2

 

DMP.1

GSB.Save|1

GSB.Save|2

GSB.Save|3

 

ENR.

 

'===========================================================

:Save

$$NUM=§§_01

RND.0|999999|$$RND

FMT.$$RND|000000

$$PAT=?exeloc\Save_$$RND.png

IEF.$$PAT

  GTO.Save

EIF.

ANA.Save|$$NUM|$$PAT 

ANA.Show|$$NUM!

RET.

'===========================================================

ENR.

 

 

clip0187

 

 

 

 

Syntax

 

ANA.Complementary_Color[|P1][|P2][|P3][|P4]

ANA.Inverse_Color[|P1][|P2][|P3][|P4]

 

 

 

Parameter Explanation

 

P1 - Source 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

   

If any of the Variables is missing, the value is been placed on the TOS.

 

 

Example

 

See above.

 

 

 

 

Remarks

The ANA.Split_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: