set_paint ( : : Mode : )

Definition of the greyvalue output mode.

set_paint defines the output mode for greyvalue display (single- or multichannel) in the active window. The mode is used by disp_image.

This page describes the different modes, that can be used for greyvalue output. It should be noted, that the mode 'default' is the most suitable.

The hardware characteristics determine, how greyvalues can be displayed. On a screen with one to seven bit planes, only binary data can be displayed. On screens with at least eight bit planes, it is possible to display multiple greyvalues. For binary displays HORUS includes algorithms with dithering matrix (fast, but low resolution), minimal error (good, but slow) and thresholding. Usinf the thresholding algorithm, the threshold can be passed as a second parameter (a tuple with the string 'threshold' and the actual threshold, e.g.: ['theshold', 100]).

Displays with eight bit planes use approx. 200 greyvalues for output. Of course it is still possible to use a binary display on those displays.

A different way to display greyvalues is the histogram (mode: 'histogram'). This mode has two additional parameter values: Row (second value) and column (thirs value). They denote row and column of the histogram center for positioning on the screen. The scale factor (fourth value) determines the histogram size: A scale factor of 1 distinguishes 256 greyvalues, 2 distinguishes 128 grevalues, and so on. The four values are passed as a tuple, e.g. ['histogram', 256,256,1]. If only the first value is passed ('histogram'), the other values are set to defaults or the last values, respectively. For histogram computation see histo__. Histogram output honors the same parameters as procedures like disp_region etc. (e.g. set_color, set_draw, etc.)

Yet another mode is the display of relative frequencies of the number of connection components ('component_histogram'). For informations on computing the component histogram see tshape_histo1). Positioning and resolution is exactly as in the mode 'histogram'.

In mode 'mean', all object regions are displayed in their mean greyvalue.

The modes 'line' and 'column' allow the display of lines or columns, respecivelly. Tho position (line- and columnindex) is passed with the second paramter value. The third parameter value is the scale factor in percent (100 means 1 pixel per greyvalue, 50 means one pixel per two greyvalues).

Grey images can also be interpreted as 3d data, depending on the greyvalue. To view these 3d plots, select the modes 'contourline', '3D-plot' or '3D-plot_hidden'.

Two-channel images can be viewed as 'vectorfield'.

Three-channel images are interpreted as RGB images. They can be displayed in three different modes. Two of them can be optimized by Floyd-Steinberg dithering.

Paramters for modes that need more than one parameter can be passed the following ways:

- Only the name of the mode is passed: the defaults or the last
  values are used, respectivelly.
  Example: set_paint(::'contourline':)
- All values are passed: all output characteristics can be set.
  Example: set_paint(::['contourline',10,1]:)
- Only the first n values are passed: only the passed values are
  changed.
  Example: set_paint(::['contourline',10]:)
- Some of the values are replaced by an asterisk ('*'): The value of
  the replaced parameters is not changed.
  Example: set_paint(::['contourline','*',1]:)
If the current mode is 'default', HORUS chooses a suitable algorithm for the output of 2- and 3-channel images.. No set_paint call is necessary in this case.

Apart from set_paint there are other procedures that affect the output of greyvalues. The most important of them are set_part, set_part_style,set_lut and set_lut_style. Some output modes display greyvalues using region output (e.g. 'histogram','contourline','3D-plot', etc.). In these modes, paramters set with set_color, set_rgb,set_hsi, set_pixel, set_shape, set_line_width and set_insert influence greyvalue output. This can lead to unexpected results when using set_shape(::'convex':) and set_paint(::'histogram':). Here the convex hull of the histogram is displayed.

Modes:

one-channel images

  'default'
                    optimal display on given hardware
  'grey'
                    greyvalue output
  'mean'
                    mean greyvalue
  'dither4_1'
                    binary image, dithering matrix 4x4
  'dither4_2'
                    binary image, dithering matrix 4x4
  'dither4_3'
                    binary image, dithering matrix 4x4
  'dither8_1'
                    binary image, dithering matrix 8x8
  'floyd_steinberg'
                    binary image, optimal greyvalue simulation
  'threshold'
                    binary image, threshold: 128 (default)

  ['threshold',Threshold]
  ['threshold',200] 
                    binary image, any threshold: (here: 200)
  'histogram'
                    greyvalue output as histogram
                    position default: max. size, in the window center
  ['histogram',Row,Column,Scale]
  ['histogram',256,256,2]              
                    greyvalue output as histogram, any parameter values
                    positioning: window center (here (256,256))
                    size: (here 2, half the max. size)
  'component_histogram'
                    output as histogram of the connection components.
                    Positioning: default
  ['component_histogram',Row,Column,Scale]
  ['component_histogram',256,256,1]
                    output as histogram of the connection components.
                    Positioning: (here (256, 256))
                    Scaling: (here 1, max. size)
  'line'
                    output of the greyvalue profile along the given
                    line.
                    line: image center (default)
                    Scaling: 50%
  ['line',Row,Scale]
  ['line',100,20]   
                    output of the greyvalue profile of line 100 with
                    a scaling of 0.2 (20%).
  'column'
                    output of the greyvalue profile along the given
                    column.
                    column: image center (default)
                    Scaling: 50%
  ['column',Column,Scale]
  ['column',100,20]
                    output of the greyvalue profile of column 100 with
                    a scaling of 0.2 (20%).
  'contourline'
                    greyvalue output as contour lines:
                    the greycalue difference per line is defined
                    with the parameter 'Step' (default: 30,
                    i.e. max. 8 lines for 256 greyvalues). The line
                    can be displayed in a given color (see
                    set_color) or in the greyvalue they
                    represent. This behaviour is defined with the
                    parameter 'Colored' (0 = color, 1 = greyvalues).
                    Default is color.
  ['contourline',Step,Colored]
  ['contourline',15,1]
                    greyvalue output as contour lines with a step of
                    15 and grey output.
  '3D-plot'
                    greyvalues are interpreted as 3d data: the
                    greater the value, the 'higher' the assumed
                    mountain. Lines with step 2 (second paramter
                    value) are drawn along the x- and y-axes.
                    The third parameter (Colored) determines, if the
                    output should be in color (default) or
                    greyvalues. To define the projection of the 3d
                    data, use the parameters EyeHeight and
                    EyeDistance. The projection parameters take
                    values from 0 to 255. ScaleGrey defines a
                    factor, by which the greyvalues are multiplied
                    for 'height' interpretation (given in
                    percent. 100% = factor 1). For extreme values of
                    EyeHeight and EyeDistance the image can be
                    shifted out of place. Use RowPos and ColumnPos
                    to move the whole output. Values from -127 to
                    127 are possible.
  ['3D-plot',Step,Colored,EyeHeight,EyeDistance,ScaleGrey,RowPos,ColumnPos]
  ['3D-plot',5,1,110,160,150,70,-10]
                    line step:   5 pixel
                    Colored:     yes (1)
                    EyeHeight:   110
                    EyeDistance: 160
                    ScaleGrey:   1.5 (150)
                    RowPos:      70 pixel down
                    ColumnPos:   10 pixel right
  '3D-plot_hidden'  
                    like '3D-plot', but computes hidden lines.
  ['3D-plot_hidden',Step,Colored,EyeHeight,EyeDistance,ScaleGrey,RowPos,
   ColumnPos]	

Two-channel images:

  'default'
                    output as vector field.
  'vectorfield'
                    output of the two channels as displacement
                    vector field. Procedures like optical_flow*
                    produce images of pixel displacements (first
                    channel: x-displacement, second channel:
                    y-displacement).
                    In this mode, an arrow is drawn for each
                    vector. The parameter Step has to be set in
                    correspondence to optical_flow*. Short vectors
                    can be suppressed by the third parameter value
                    (MinLength). The fourth parameter value scales
                    the vector length. Vectors, that exceed the
                    window boundaries are nor drawn.
  ['vectorfield',Step,MinLengh,ScaleLength]		      
  ['vectorfield',16,2,3]
                    Output of every 16. vector, that is loner than 2
                    pixel. Each vector is multiplied by 3 for
                    output.

Three-channel images:

  'default'
                    output as RGB image with 'median_cut'.
  'television'
                    color addition algorithm for RGB images: (three
                    components necessary for
                    disp_image). Images are displayed
                    via a fixed color lookup table. Fast, but
                    non-optimal color resolution. Only recommended on
                    bright screens.
  'grid_scan'
                    grid-scan algorithm for RGB images (three
                    components necessary for
                    disp_image). An optimized  color
                    lookup table is generated for each image. Slower
                    than 'television'. Disadvantages: Hard color
                    boundaries (no dithering). Different color lookup
                    table for every image.
  'grid_scan_floyd_steinberg'
                    grid-scan with Floyd-Steinberg dithering for
                    smooth color boundaries.
  'median_cut'
                    median-cut algorithm for RGB images (three
                    components necessary for
                    disp_image). Similar to grid-scan.
                    Disadvantages: Hard color boundaries (no
                    dithering). Different color lookup table for
                    every image.
  'median_cut_floyd_steinberg'
                    median-cut algorithm with Floyd-Steinberg
                    dithering for smooth color boundaries.


Attention

- Display of color images ('television', 'grid_scan', etc.) changes
  the color lookup tables.
- If a wrong color mode is set, the error message may appear not until
  the disp_image call.
- Greyvalue output may be influenced by region output parameters. This
  can yield unexpected results.


Parameters

Mode (input_control)
string-array -> string / integer
grevalue output name. Additional parameters possible.
Default value: 'default'


Example
read_image(:Image:'fabrik':) >
open_window(0,0,-1,-1,'root','visible','') >
query_paint(:::Modi) >
fwrite_string(::['available grey value modes: ',Modi]:) >
fnew_line(:::) >
disp_image(Image:::) > 
get_mbutton(:::_,_,_) >
set_color(::'red':) >
set_draw(::'margin':) >
set_paint(::'histogram':) >
disp_image(Image:::) > 
set_color(::'blue':) >
set_paint(::['histogram',100,100,3]:) >
disp_image(Image:::) > 
set_color(::'yellow':) >
set_paint(::['line',100]:) >
disp_image(Image:::) > 
get_mbutton(:::_,_,_) >
clear_window(:::) >
set_paint(::['contourline',10,1]:) >
disp_image(Image:::) > 
set_lut(::'color':) >
get_mbutton(:::_,_,_) >
clear_window(:::) >
set_part(::100,100,300,300:) >
set_paint(::'3D-plot':) >
disp_image(Image:::).

Result

set_paint returns TRUE, if the parameter is correct and a window is active. Otherwise an exception is raised.


Possible Predecessors

query_paint, get_paint


Possible Successors

disp_image


See also

get_paint, query_paint, disp_image, set_shape, set_rgb, set_color, set_grey



Copyright © 1996-1997 MVTec Software GmbH