Skip to content

set_hsiSetHsiSetHsiset_hsiT_set_hsi🔗

Short description🔗

set_hsiSetHsiSetHsiset_hsiT_set_hsi — Define output colors (HSI-coded).

Signature🔗

set_hsi( window WindowHandle, integer Hue, integer Saturation, integer Intensity )void SetHsi( const HTuple& WindowHandle, const HTuple& Hue, const HTuple& Saturation, const HTuple& Intensity )static void HOperatorSet.SetHsi( HTuple windowHandle, HTuple hue, HTuple saturation, HTuple intensity )def set_hsi( window_handle: HHandle, hue: MaybeSequence[int], saturation: MaybeSequence[int], intensity: MaybeSequence[int] ) -> None

Herror T_set_hsi( const Htuple WindowHandle, const Htuple Hue, const Htuple Saturation, const Htuple Intensity )

void HWindow::SetHsi( const HTuple& Hue, const HTuple& Saturation, const HTuple& Intensity ) const

void HWindow::SetHsi( Hlong Hue, Hlong Saturation, Hlong Intensity ) const

void HWindow.SetHsi( HTuple hue, HTuple saturation, HTuple intensity )

void HWindow.SetHsi( int hue, int saturation, int intensity )

Description🔗

set_hsiSetHsi sets the region output color(s)/gray value(s) for the valid window. Colors are passed as Huehuehue, Saturationsaturationsaturation, and Intensityintensityintensity. Transformation from HSI to RGB is done with:

\[\begin{eqnarray*} \begin{array}{lllllllll} H & = & (\textrm{Hue} / 255.0) * 2 \pi \\ S & = & (\textrm{Saturation} / 255.0) * 2.0 / \sqrt{6}\\ I & = & \textrm{Intensity} \\ \\ M1 & = & S \cos{(H)} / \sqrt{6} * 255.0 \\ M2 & = & S \sin{(H)} / \sqrt{2} * 255.0 \\ \\ Red & = & 2 M1 + I \\ Green & = & - M1 + M2 + I \\ Blue & = & - M1 - M2 + I \\ \end{array} \end{eqnarray*}\]

The value range is clipped to 0 to 255.

If only one combination is passed, all output will take place in that color. If a tuple of colors is passed, the output color of regions and geometric objects is modulo to the number of colors. HALCON always begins output with the first color passed. Note, that the number of output colors depends on the number of objects that are displayed in one operator call. If only single objects are displayed, they always appear in the first color, even if the consist of more than one connected components.

Selected colors are used until the next call of set_colorSetColor,set_rgbSetRgb or set_graySetGray. Colors are relevant to windows, i.e., only the colors of the valid window can be set. Region output colors are used by operators like disp_regionDispRegion, disp_lineDispLine, disp_rectangle1DispRectangle1, disp_rectangle2DispRectangle2, disp_arrowDispArrow, etc. It is also used by operators with gray value output in certain output modes (e.g., '3d_plot'"3d_plot", see set_paintSetPaint).

Attention🔗

The colors are internally stored as RGB triples. Some HSI triples can not be represented by a valid RGB triple (i.e. in the range 0..255). In this case the nearest color which can be represented is used instead.

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.

Huehuehue (input_control) integer(-array) → (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Hue for region output.

Default: 3030
Value range: 0 ≤ Hue ≤ 255

Saturationsaturationsaturation (input_control) integer(-array) → (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Saturation for region output.

Default: 255255
Value range: 0 ≤ Saturation ≤ 255

Intensityintensityintensity (input_control) integer(-array) → (integer)HTuple (Hlong)HTuple (int / long)MaybeSequence[int]Htuple (Hlong)

Intensity for region output.

Default: 8484
Value range: 0 ≤ Intensity ≤ 255

Result🔗

set_hsiSetHsi returns 2 (H_MSG_TRUE) if the window is valid and the output colors are displayable. Otherwise an exception is raised.

Combinations with other operators🔗

Combinations

Possible predecessors

get_hsiGetHsi

Possible successors

disp_regionDispRegion

See also

get_hsiGetHsi, trans_from_rgbTransFromRgb, trans_to_rgbTransToRgb, disp_regionDispRegion

Module🔗

Foundation