ANA.SetPixelColor_5H

<< Click to Display Table of Contents >>

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

ANA.SetPixelColor_5H

ANA.SetPixelColor_5H - Set the Color of 5 successive Pixels of an IR

Previous Top Next


MiniRobotLanguage (MRL)

 

ANA.SetPixelColor_5H

Set the Color of 5 successive horizontal Pixels from an Image-Register (IR)

 

 

Intention

 

This command will set/change the color of 5 successive Pixels in an IR. Its an Option to Speed up Image-Processing.

With this command, the returned value is the 24-bit color of the Pixels.
You do not need to worry, if the resolution is not a multiple of 5, illegal Coordinates will just be ignored.

 
Freerun Due to the use of a nested Loop going "Line by Line" through all Pixels, it is recommended to start the script in the Editor using "Freerun Mode".

Free-Run Button

 

  You will not see the Robot Painting unless the Show command is been called which leads to an Update in the Show-Window.

 

 

' This code will invert the left half of a Picture.

' We will use two technologies and you can compare the needed time.

'

VAF.$$PIA=?exeloc\Pics\Sarah_HS.png

NEF.$$PIA

  MBX.File not found.

EIF.

VAN.$$BMA=0

ANA.Load|$$BMA|$$PIA

ANA.GetRes|$$BMA|$$XRA|$$YRA

ANA.Show|$$BMA!

FOR.$$YPO|0|$$YRA

  'PRT.Line: $$YPO/$$YRA

  FOR.$$XPO|0|($$XRA/2)|5

    ' We get 5 Pixels and process them

    ANA.GetPixelColor_5h|$$BMA|$$XPO|$$YPO|$$COA|$$COB|$$COC|$$COD|$$COE

    CAL.$$COA=&HFFFFFF-$$COA

    CAL.$$COB=&HFFFFFF-$$COB

    CAL.$$COC=&HFFFFFF-$$COC

    CAL.$$COD=&HFFFFFF-$$COD

    CAL.$$COE=&HFFFFFF-$$COE

    ' We write the 5 Pixels back

    ANA.SetPixelColor_5h|$$BMA|$$XPO|$$YPO|$$COA|$$COB|$$COC|$$COD|$$COE

  NEX.

NEX.

VAN.$$TMC=#dsince#

DBP.$$TMC used

' This Script will do the same, but process "Pixel by Pixel"

' This way it takes nearly twice the time.

ANA.Show|$$BMA!

ANA.Load|$$BMA|$$PIA

VAN.$$TMA=#dtime#

FOR.$$YPO|0|$$YRA

  PRT.Line: $$YPO/$$YRA

  FOR.$$XPO|0|($$XRA/2)

    ' Bild mit Kanten 

    ANA.GetPixelColor|$$BMA|$$XPO|$$YPO|$$COL

    CAL.$$COL=&HFFFFFF-$$COL

    ANA.SetPixelColor|$$BMA|$$XPO|$$YPO|$$COL

  NEX.

NEX.

VAN.$$TMB=#dsince#

DBP.$$TMB used

DMP.6

ANA.Show|$$BMA!

ENR.

 

Sara_Green     clip0398

The Script used 6 Seconds to complete process the picture.

 

 

Here is the Speed-Dump:

 

clip0397

 

 

 

Syntax

 

ANA.SetPixelColor_5h|P1|P2|P3|P4|P5|P6|P7|P8

 

Parameter Explanation

 

P1 - Source Image-Register number

P2 - X1 - Upper Left Coordinate X-Value

P3 - Y1 - Upper Left Coordinate Y-Value

P4 - Variable for Color-Value of Pixel 1 at (X1,Y1)

P5 - Variable for Color-Value of Pixel 2 at (X1+1,Y1)

P6 - Variable for Color-Value of Pixel 3 at (X1+2,Y1)

P7 - Variable for Color-Value of Pixel 4 at (X1+3,Y1)

P8 - Variable for Color-Value of Pixel 5 at (X1+4,Y1)

 

 

 

Example

 

See above.

 

 

 

 

Remarks

The ANA.SetPixelColor_5h is optimized for Speed. It will use only about 350 Ticks. Therefore the Robot could set more then 300.000 Pixels per Second.

 

 

Limitations:

 

-

 

 

See also:

 

    ANA.GetPixelColor_5h