Skip to content

set_paintSetPaintSetPaintset_paintT_set_paint🔗

Short description🔗

set_paintSetPaintSetPaintset_paintT_set_paint — Define the gray value output mode.

Signature🔗

set_paint( window WindowHandle, string Mode )void SetPaint( const HTuple& WindowHandle, const HTuple& Mode )static void HOperatorSet.SetPaint( HTuple windowHandle, HTuple mode )def set_paint( window_handle: HHandle, mode: Sequence[Union[int, str, float]] ) -> None

Herror T_set_paint( const Htuple WindowHandle, const Htuple Mode )

void HWindow::SetPaint( const HTuple& Mode ) const

void HWindow.SetPaint( HTuple mode )

Description🔗

set_paintSetPaint defines the output mode for gray value display (single- or multichannel) in the window. The mode is used by disp_objDispObj, disp_imageDispImage, and disp_colorDispColor.

Different image types and their possible implication on the Modemodemode:

  • Gray images can also be interpreted as 3D data, depending on the gray value. To view these 3D plots, select the modes '3d_plot'"3d_plot".

  • Three-channel images are interpreted as RGB images.

  • Vector field images can be viewed as 'vector_field'"vector_field".

In most cases the setting Modemodemode 'default'"default" is the most suitable.

Depending on the selected mode, the Modemodemode may accept a tuple as value. In these cases the entries 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'"default", HALCON chooses a suitable algorithm for the output of 2- and 3-channel images. No set_paintSetPaint call is necessary in this case.

Apart from set_paintSetPaint there are other operators that affect the output of gray values. The most important of them are set_partSetPart, set_part_styleSetPartStyle and set_lutSetLut. Some output modes display gray values using region output (e.g., '3d_plot'"3d_plot"). In these modes, parameters set with set_colorSetColor, set_rgbSetRgb, set_hsiSetHsi, set_shapeSetShape, and set_line_widthSetLineWidth influence gray value output. In case of unexpected results, check the values of the display parameters.

All available painting modes can be queried with query_paintQueryPaint. Possible values for Modemodemode:

  • 'default'"default" Optimal display on given hardware (default value). Its behavior depends on the number of channels of the input image:

    • One-channel image: Output the single channel.

    • Two-channel images: Output the first channel.

    • Three-channel images: Output as RGB image.

  • **'[3d_plot, Mode, Step, qa, qb, qc, qd, ZoomFac, CenterRow,CenterCol, CenterHeight**'"[3d_plot, Mode, Step, qa, qb, qc, qd, ZoomFac, CenterRow,CenterCol, CenterHeight**"] Gray values are interpreted as a 3D height field and displayed using OpenGL. Thereby the different parameters are:

    • 'Mode'"Mode": Specifies the way in which the height field is displayed. The following modes are supported:

      • 'texture'"texture": 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.

      • 'shaded'"shaded": The height field is displayed as a closed surface and colored using the current LUT.

      • 'hidden_lines'"hidden_lines": The height field is displayed as a hidden line plot and colored using the current LUT.

      • 'contour_lines'"contour_lines": Height lines are extracted and displayed at their actual height. Again the lines are colored using the current LUT.

    • 'Step'"Step": 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 finer the resulting height field. However, computation time increases while this parameter decreases. In the case of 'contour_lines'"contour_lines" this parameter corresponds to the number of intervals the height range is divided into.

    • 'qa'"qa",'qb'"qb",'qc'"qc",'qd'"qd": The four values of a unit quaternion, describing the orientation of the height field (see axis_angle_to_quatAxisAngleToQuat for more information on quaternions).

    • 'ZoomFac'"ZoomFac": Zooming factor, whereby smaller values implicate higher zooming.

    • 'CenterRow'"CenterRow", 'CenterCol'"CenterCol", 'CenterHeight'"CenterHeight": Position of the actual center of view defined by row, column, and height. These values must be scaled to the interval [-0.5-0.5, 0.50.5].

    Automatic parameter determination: You can set 'qa'"qa" (fourth value in the tuple) or 'ZoomFac'"ZoomFac" (eighth value in the tuple) to 'auto'"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. By setting 'qa'"qa" to 'auto'"auto", the previous orientation (or the default one) is kept. By setting 'ZoomFac'"ZoomFac" to 'auto'"auto", the provided orientation is used. It is important that the part of the window is set correctly (using set_partSetPart) before set_paintSetPaint is called. It is not possible to set any parameters after 'auto'"auto" in the tuple. Furthermore 'auto'"auto" will only work correctly if 'scale_plot'"scale_plot" is set to 'true'"true" using set_window_paramSetWindowParam.

    Example: set_paint(WindowHandle, ['3d_plot','shaded',4,'auto'])

    This mode allows interactive display of the 3D data. For an interactive rate, your graphics card needs to be powerful enough and support OpenGL. See the operator update_window_poseUpdateWindowPose 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_rgbSetRgb, set_colorSetColor, and set_coloredSetColored. 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_paramSetWindowParam.

    If you intend to use '3d_plot'"3d_plot" on a Unix-like system, make sure you have sufficient permissions on your graphics device.

    Default: ['3d_plot', 'shaded', 8, 0.939, -0.052, 0.296, -0.165, 0.401, 0.072, -0.047, -0.073]["3d_plot", "shaded", 8, 0.939, -0.052, 0.296, -0.165, 0.401, 0.072, -0.047, -0.073]

    Restriction: Only for one-channel images.

  • **'[vector_field, Mode, Step, MinLength, ScaleLength,CircleSize**'"[vector_field, Mode, Step, MinLength, ScaleLength,CircleSize**"] Output a vector field. Thus, for Modemodemode 'vector_field'"vector_field" a circle is drawn for each vector at the position of the pixel. Furthermore, a line segment is drawn with the current vector. Thereby the different parameters are:

    • 'Mode'"Mode": Tells whether the visualized vector fields contain absolute or relative coordinates. Possible values:

      • 'auto'"auto" (default): The visualization depends on the semantic type of the vector field.

      • 'absolute'"absolute": Display vector fields containing absolute coordinates.

      • 'relative'"relative": Display vector fields containing relative coordinates.

    • 'Step'"Step": Step size for drawing the vectors, i.e., the distance between the drawn vectors.

    • 'MinLength'"MinLength": Minimum length a vector needs in order to be displayed.

    • 'ScaleLength'"ScaleLength": Scales the vector length.

    • 'CircleSize'"CircleSize": Diameter of the drawn circles.

    It should be noted that by setting 'vector_field'"vector_field" only the internal parameters 'Mode'"Mode", 'Step'"Step", 'MinLength'"MinLength", 'ScaleLength'"ScaleLength", and 'CircleSize'"CircleSize" are changed. The current display mode is not changed.

    Vector field images are always displayed as vector fields, no matter which Modemodemode is selected with set_paintSetPaint.

    Example: set_paint(WindowHandle,['vector_field','auto',16,2,3,5])

    This results in an output of every 16th vector, that is longer than 2 pixels. Each vector is multiplied by 3 for output.

    Restriction: Only for vector field images.

Execution information🔗

Execution information
  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).

  • Multithreading scope: global (may be called from any thread).

  • Processed without parallelization.

Parameters🔗

WindowHandlewindowHandlewindow_handle (input_control) window → (handle)HTuple (HHandle)HWindow, HTuple (IntPtr)HHandleHtuple (handle)

Window handle.

Modemodemode (input_control) string-array → (string / integer / real)HTuple (HString / Hlong / double)HTuple (string / int / long / double)Sequence[Union[int, str, float]]Htuple (char* / Hlong / double)

Output mode. Additional parameters possible.

Default: 'default'"default"
List of values: '3d_plot', 'default', 'vector_field'"3d_plot", "default", "vector_field"

Result🔗

set_paintSetPaint returns 2 (H_MSG_TRUE) if the parameter is correct and the window is valid. Otherwise an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

query_paintQueryPaint, get_paintGetPaint

Possible successors

disp_imageDispImage

See also

get_paintGetPaint, query_paintQueryPaint, disp_imageDispImage, set_shapeSetShape, set_rgbSetRgb, set_colorSetColor, set_graySetGray, set_window_paramSetWindowParam, update_window_poseUpdateWindowPose

Module🔗

Foundation