Operators |
set_paint — Define the gray value output mode.
set_paint( : : WindowHandle, Mode : )
set_paint defines the output mode for gray value display (single- or multichannel) in the window. The mode is used by disp_obj, disp_image, and disp_color.
This page describes the different modes that can be used for gray value output. It should be noted that the mode 'default' is the most suitable in almost all cases.
Gray images can also be interpreted as 3D data, depending on the gray value. To view these 3D plots, select the modes '3d_plot'. If your graphics card supports OpenGL, choose this for a high quality plot that is well suited for interactive display (see update_window_pose on how to make the display interactive).
Three-channel images are interpreted as RGB images.
Vector field images can be viewed as 'vector_field'.
All available painting modes can be queried with query_paint.
Parameters 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 most recently used values are used, respectively.
Example: set_paint(WindowHandle,'3d_plot')
All values are passed: All output characteristics can be set.
Example: set_paint(WindowHandle,['3d_plot','shaded', 8,0.939,-0.052,0.296,-0.165,0.401,0.072,-0.047,-0.073])
Only the first n values are passed: Only the passed values are changed.
Example: set_paint(WindowHandle,['3d_plot','texture'])
Some of the values are replaced by an asterisk ('*'): The value of the replaced parameters is not changed.
Example: set_paint(WindowHandle,['3d_plot','*',8])
If the current mode is 'default', HALCON 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 operators that affect the output of gray values. The most important of them are set_part, set_part_style and set_lut. Some output modes display gray values using region output (e.g. 'histogram','contourline','3d_plot_lines', etc.). In these modes, parameters set with set_color, set_rgb,set_hsi, set_shape, set_line_width and set_insert influence gray value output. This can lead to unexpected results when using set_shape('convex') and set_paint(WindowHandle,'histogram') . Here, the convex hull of the histogram is displayed.
Modes:
one-channel images:
optimal display on given hardware
Gray values are interpreted as a 3D height field and displayed using OpenGL. The first parameter specifies the way in which the height field is displayed. The following modes are available:
The height field is displayed as a closed surface and colored using texture mapping. The texture is passed as the second channel (for a gray-valued texture) or as the second to fourth channel (for a colored texture) of the image to display.
The height field is displayed as a closed surface and colored using the current LUT.
The height field is displayed as a hidden line plot and colored using the current LUT.
Similar to 'contourline' height lines are extracted and displayed at their actual height. Again the lines are colored using the current LUT.
The second parameter contains the step width, i.e. at what intervals samples in row and column direction are taken from the image. The smaller this parameter is chosen, the coarser the resulting height field. However, computation time increases while this parameter decreases. In the case of 'contour_lines' this parameter corresponds to the number of intervals the height range is divided into.
The third to sixth parameter are the four values of a unit quaternion, describing the orientation of the height field (see axis_angle_to_quat for more information on quaternions).
The seventh parameter is the zooming factor. Smaller values implicate higher zooming.
The last three parameters are the row, column, and height position of the actual center of view. This values must be scaled to the interval [-0.5, 0.5].
You can set the third or the seventh parameter in the tuple to 'auto' . Then, the zooming factor and the center of view are determined automatically such that the plot of the height field fills the window as good as possible. It is important that the part of the window is set correctly (using set_part) before set_paint is called. By setting the third value in the tuple to 'auto' , the previous orientation (or the default one) is kept, by setting the seventh parameter to 'auto' , the provided orientation is used. It is not possible to set any parameters after 'auto' in the tuple. Furthermore 'auto' will only work correctly if 'scale_plot' is set to 'true' using set_window_param. (Example: ['3d_plot','shaded',4,'auto'])
Depending on the speed of your graphics card, the display of the height field is performed at interactive rates. See the operator update_window_pose for an intuitive way of modifying the parameters of the 3D plot (e.g., with the mouse).
The colors of the axis are influenced by the colors set using set_rgb, set_color, and set_colored. The first three colors set this way are used as colors for row, column, and height axis (in this order).
Additional parameters concerning the 3D plot can be set using the operator set_window_param.
If you intend to use '3d_plot' on a Unix-like system, make sure you have sufficient permissions on your graphics device.
Defaults:
['3d_plot','shaded',8,0.939,-0.052,0.296,-0.165,0.401,0.072, -0.047,-0.073]
Two-channel images:
output the first channel.
Three-channel images:
output as RGB image with 'median_cut'.
Vector field images:
output a vector field. It is possible to display vector fields containing relative coordinates or vector fields containing absolute coordinates. This behavior is controlled via the optional parameter Mode. Possible values for Mode are 'auto' (the visualization depends on the semantic type of the vector field), 'absolute', or 'relative'. The default value is 'auto'. In the 'vector_field' mode, a circle with diameter CircleSize is drawn for each vector at the position of the pixel. Furthermore, a line segment is drawn with the current vector. The step size for drawing the vectors, i.e., the distance between the drawn vectors, can be set with the parameter Step. Short vectors can be suppressed with the parameter MinLength. The fourth parameter value scales the vector length. It should be noted that by setting 'vector_field' only the internal parameters Mode, Step, MinLength, ScaleLength, and CircleSize are changed. The current display mode is not changed. Vector field images are always displayed as vector field, no matter which mode is selected with set_paint .
Output of every 16th vector, that is longer than 2 pixel. Each vector is multiplied by 3 for output.
Window handle.
Output mode. Additional parameters possible.
Default value: 'default'
List of values: '3d_plot' , 'default' , 'vector_field'
set_paint returns 2 (H_MSG_TRUE) if the parameter is correct and the window is valid. Otherwise an exception is raised.
get_paint, query_paint, disp_image, set_shape, set_rgb, set_color, set_gray, set_window_param, update_window_pose
Foundation
Operators |