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.Show...Array

Previous Top Next


MiniRobotLanguage (MRL)

 

ANA.ShowSimArray

Show the Content of the Col_BGL  - Color-Table

ANA.ShowSortArray

Show the Content of the Cl_Srt - Color-Table

 

 

Intention

 

These Operations work with the "Color Table", this is a sorted list with all colors in the IR.

In fact there are 2 Color-Tables:

0 - Color-Sort (Col_Srt)  - This table contains the Colors sorted by number of Pixel per Color.
   The Top-Entry is the color with the most Pixels. The bottom Entry is the color with the least number of Pixels.

1 - Color-Background (Col_Bgl) - This table is sorted by similarity to the Color that has most Pixel, which is assumed to be the Background Color.

   Here the Top-Entry contains the Background Color and then any further Entry is sorted by Similarity to this Color.

 

Before using these Commands the Color Tables must be generated.  This is done, using:

ANA.AnalyzeColor|0|1

 

The Col_Bgl Table can be sorted to Similarity from another Color using:

 

ANA.Sort_Similar_To|&H26592A|$$MSK

 

Thee are several other commands that will only work if the Color-Table has been updated before.

If you want to see the Contents of the Color-Tables - for Debugging - you can use these two Commands.

 

ANA.ShowSimArray

ANA.ShowSortArray

 

Using this Script:

 

VAN.$$TIM=#time#

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

ANA.Load|0|$$PIA

ANA.AnalyzeColor|0|1

ANA.showsortarray|0

MBX.!

ENR.

 

You will get a listing of the Col_Srt-Table, this may look like this:

 

clip0138   clip0139     clip0137          

Start of the Color-Tabel, Entries 0 to 41.                        Second part. As you can see, the Entry for "Black" is on position 40.              End of the Color-Table. Entries up to 1318.

 

Using this commands you can work with the list entries in the color table and do significant improvements in pictures.

Now you can improve the image. All colors are already sorted by Quantity (How many Pixels).

 

You can also get a sort on "Color difference to background". For this you can use:

 

VAN.$$TIM=#time#

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

ANA.Load|0|$$PIA

ANA.AnalyzeColor|0|1

ANA.ShowSimArray|0

MBX.!

ENR.

 

 

Then you will get the Content of The Col_BGL-Table which looks somehow like this:

 

clip0135                   clip0134

 

In this table the black colors will be "on Top" while the White colors will be "bottom".  For this sort the robot assumes that the color that is mostly in the picture "is the background color".

The he will sort all colors "by difference to the background".  This is the result.

 

Using these tables you can significantly improve pictures with your Script.

 

For example you can remove colors from the list and the IR using:

' this command will remove the given color and replace it with another color.

ANA.removeindexcolors|0|300|$$CNV|0

 

VAN.$$TIM=#time#

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

'VAF.$$PIA=?exeloc\BTC2.jpg

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

ANA.Load|0|$$PIA

GSB.Reanalyze

ANA.removeindexcolors|0|300|$$CNV|0

ANA.removeindexcolors|0|$$CNV|$$CNT|-1

GSB.Reanalyze

ANA.removeindexcolors|0|$$CNV|$$CNT|-1

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

DBP.Used Time in Seconds: $$TIM

DMP.1

ANA.Save|0|$$PIB

ANA.Show|0!

ENR.

 

:Reanalyze

ANA.AnalyzeColor|0|1

ANA.getcolorcount|0|$$CNT

ANA.getbgcolor|0|$$BGC

CAL.$$CNV=$$CNT-400

RET.

 

 

 

clip0121         -> clip0125

Original Picture                                                                                                        Picture-Result

 

With a few changes, you can see in detail how the Script works:

 

clip0127

 

' Here we have changed the script a bit to show 

' how the commands paint the colors.

' Green -> would be painted in white

' red -> would be painted in black

VAN.$$TIM=#time#

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

'VAF.$$PIA=?exeloc\BTC2.jpg

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

ANA.Load|0|$$PIA

GSB.Reanalyze

ANA.removeindexcolors|0|300|$$CNV|&HFF0000

GSB.Reanalyze

ANA.removeindexcolors|0|$$CNV|($$CNT-20)|&H00FF00

ANA.removeindexcolors|0|($$CNT-20)|$$CNT|&HFFFFFF

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

DBP.Used Time in Seconds: $$TIM

DMP.1

ANA.Save|0|$$PIB

ANA.Show|0!

ENR.

 

:Reanalyze

ANA.AnalyzeColor|0|1

ANA.getcolorcount|0|$$CNT

ANA.getbgcolor|0|$$BGC

CAL.$$CNV=$$CNT-400

RET.

 

clip0128

This is the Speed-Dump of the Script. It uses just few Seconds for the complete run.

 

 

 

 

 

 

 

 

Syntax

 

ANA.ShowSimArray[|P1]

ANA.ShowSortArray[|P1]

 

Parameter Explanation

 

P1 - Source Image-Register Number

 

 

Example

 

  -

 

 

Remarks

 

-

 

 

 

Limitations:

 

-

 

See also: