set_lut — Set “look-up-table” (lut).
set_lut sets look-up-table of the device (monitor) displaying
the output window. A look-up-table defines the transformation of a
“gray value” within an image into a gray value or color on the screen.
It describes the screen gray value/color as a combination of red, green and
blue for any image gray value (0..255) (so it is a 'table' to 'look up' the
screen gray value/color for each image gray value: look-up-table).
Transformation into screen-colors is performed in real-time at every
time the screen is displayed new (typically this happens about 60 - 70 times
per second). So it is possible to change the look-up-table to get a new look
of images or regions. Please remind that not all machines support changing
the look-up-table (e.g., monochrome resp. real color).
Look-up-tables within HALCON (and on a machine that supports 256 colors) are divided into three areas:
system area resp. user area,
Colors in S descend from applications that were active before starting
HALCON and should not get lost. Graphic colors in G are used for
operators such as
and are set unique within all look-up-tables. An output in a graphic color
has always got the same (color-)look, even if different look-up-tables are
set_rgb set graphic colors.
Gray values resp. colors in B are used by
display an image. They can change according to the current look-up-table.
There exist two exceptions to this concept:
For common monitors only one look-up-table can be loaded per screen.
set_lut can be activated separately for each window.
There is the following solution for this problem:
It will always be
activated the look-up-table that is assigned to the
“active window” (a window is set into the state “active” by the
look-up-table can also be used with true-color displays. In this case the look-up-table will be simulated in software. This means, that the look-up-table will be used each time an image is displayed.
WindowsNT specific: if the graphic card is used in mode different from true-color, you must display the image after setting the look-up-table.
query_lut lists the names of all look-up-tables. They differ
from each other in the area used for gray values. Within this area the
following behavior is defined:
gray value tables (1-7 image levels)
Only the two basic colors (generally black and white) are used.
color tables (Real color, static gray value steps)
Table proposed by the hardware.
gray value tables (256 colors)
Linear increasing of gray values from 0 (black) to 255 (white).
Inverse function of 'linear'.
Gray values increase according to square function.
Inverse function of 'sqr'.
Gray values increase according to cubic function.
Inverse function of 'cube'.
Gray values increase according to square-root function.
Inverse Function of 'sqrt'.
Gray values increase according to cubic-root function.
Inverse Function of 'cubic_root'.
color tables (256 colors)
Linear transition from red via green to blue.
Smooth transition from yellow via red, blue to green.
Smooth transition from yellow via red, blue, green, red to blue.
Smooth transition from yellow via red to blue.
Displaying the three colors red, green and blue.
Displaying the six basic colors yellow, red, magenta, blue, cyan and green.
Displaying 12 colors.
Displaying 24 colors.
Displaying the spectral colors from red via green to blue.
Temperature table from black via red, yellow to white.
Color changes after every pixel within the table alternating the six basic colors.
Fivefold color changes from green via red to blue.
Threefold color changes from green via red to blue.
Smooth transition from blue via green, yellow to red.
Smooth transition from red via yellow, green to blue.
A look-up-table can be read from a file. Every line of such a file must
contain three numbers in the range of 0 to 255, with the first number
describing the amount of red, the second the amount of green and the third
the amount of blue of the represented display color. The number of lines
can vary. The first line contains information for the first gray value and
the last line for the last value. If there are less lines than gray values,
the available information values are distributed over the whole interval.
If there are more lines than gray values, a number of (uniformly distributed)
lines is ignored.
The file-name must conform to “
Within the parameter the name is specified without file extension.
HALCON will search for the file in the current directory and after that in
a specified directory ( see
It is also possible to call
set_lut with a tuple of RGB-Values.
These will be set directly. The number of parameter values must conform to
the number of pixels currently used within the look-up-table.
set_lut can only be used with monitors supporting
256 gray levels/colors.
→(string / integer)
Name of look-up-table, values of look-up-table (RGB) or file name.
Default value: 'default'
Suggested values: 'default', 'linear', 'inverse', 'sqr', 'inv_sqr', 'cube', 'inv_cube', 'sqrt', 'inv_sqrt', 'cubic_root', 'inv_cubic_root', 'color1', 'color2', 'color3', 'color4', 'three', 'six', 'twelve', 'twenty_four', 'rainbow', 'temperature', 'cyclic_gray', 'cyclic_temperature', 'hsi', 'change1', 'change2', 'change3', 'jet', 'jet_inverse'
File extension: .
read_image(Image,'monkey') query_lut(WindowHandle,LUTs) for i := 0 to |LUTs|-1 by 1 set_lut(WindowHandle,LUTs[i]) fwrite_string(FileHandle, ['current table ',LUTs[i]]) fnew_line(FileHandle) get_mbutton(WindowHandle,_,_,_) endfor
set_lut returns TRUE if the hardware supports a look-up-table
and the parameter is correct. Otherwise an exception is raised.