Image/Pixel-Color Operations

<< Click to Display Table of Contents >>

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

Image/Pixel-Color Operations

ANA.GetBGColor

Previous Top Next


MiniRobotLanguage (MRL)

 

ANA.GetBGColor

Returns the Color of the Background of an IR

 

 

Intention

 

This Command needs the ANA.AnalyzeColor Command to count colors in an IR before it will work. It may also need the "Force-Flag" (P2) to be set.

 

ANA.AnalyzeColor|0|1

 

' These are some further commands that can be used after the ANALYZE.

ANA.getcolorcount|0|$$CNT

ANA.getbgcolor|0|$$BGC

 

you can then work with the list entries.

 

This ccommand will return the color that is mostly used in the IR. It is assumed that the "Color of most of the Pixels" is the Background color.

 

 

$$PAT=?exeloc\pics\P5.jpg

IEF.$$PAT

  ANA.Load|0|$$PAT

  ANA.Show|0!  

ELS.

  MBX: FIle does not exist.

EIF.

ANA.AnalyzeColor|0|1

ANA.GetBgcolor|0|$$RES|$$ANZ

VTH.$$RES|$$HEX

MBX.$$HEX--$$ANZ

ENR.

 

 

clip0154

Will bring up this Messagebox: that shows that the Color &HFEFEFE is most likely the Background Color. And this color is found 597379 times in the original picture.

 

With this picture:

clip0153

 

     

 

 

Syntax

 

ANA.GetBGColor[|P1][|P2][|P3]

 

Parameter Explanation

 

P1 - Source Image-Register Number, if omitted 0 is used.

P2 - (Result) Color of Background, if omitted the result is placed on TOS.

P3 - (Result) Number of Pixels using the Color of Background (in P2), if omitted the result is placed on TOS.

 

The Command will not leave a 0/1 on the TOS. If the Operation fails, P2 may be "-1".

 

Example

 

'***********************************

' ANA.Fill-Sample

'***********************************

ANA.New|0|320|200

ANA.Fill|0|&HFFFFFF|1|&HFF0000

ANA.Show|0!  

ANA.Save|0|?path\Lines01.png

ENR.

 

' Below you can see the result of the Operation.

 

 

 

 

 

 

 

 

Remarks

  -

 

 

 

Limitations:

 

-

 

 

See also:

 

  ANA.AnalyeColor

  ANA.RemoveIndexColors