IDS peak ICV v1.3.0
Loading...
Searching...
No Matches
Painter Class Reference

Public Member Functions

None __init__ (self, Union[Image, ids_peak_ipl.Image] image)
 Creates a Painter object.
 
Color color (self)
 Get the current color for painting.
 
None color (self, Union[Color, ColorConstant, ColorPalette, ColorPaletteConstant] color)
 Set the color for painting an object into the image.
 
Opacity opacity (self)
 Get the current opacity for painting.
 
None opacity (self, Opacity opacity)
 Set the Opacity for painting.
 
None draw (self, IDrawable drawable)
 Draws the drawable onto the image, the painter was initialized with.
 

Protected Attributes

 _image = _check_and_get_icv_image(image)
 
 _drawing_options = DrawingOptions()
 

Detailed Description

Class for painting simple things (e.g.

a region) on images.

With the Painter, objects derived from IDrawable can be drawn in order to visualize them. It is possible to configure the drawing style, including color and opacity settings, for customized results.

The Painter is initialized with the image onto which the object is to be painted. It must be of type RGB8, BGR8, RGBa8 or BGRa8. Optionally, you can configure the painter by setting the color and opacity; if omitted, default values from DrawingOptions are used. Once configured, the object to be rendered can be passed to the draw method, which paints it onto the image. :: painter = Painter(image) painter.color = ColorConstant.BLUE painter.opacity = Opacity(50) painter.draw(region)

Since
ids_peak_icv 1.1

Definition at line 12 of file painter.py.

Constructor & Destructor Documentation

◆ __init__()

None __init__ ( self,
Union[Image, ids_peak_ipl.Image] image )

Creates a Painter object.

Parameters
imageThe image all painting operations are performed on.
Since
ids_peak_icv 1.1

Definition at line 35 of file painter.py.

Member Function Documentation

◆ color() [1/2]

Color color ( self)

Get the current color for painting.

Returns
Color: The current color.
Since
ids_peak_icv 1.1

Definition at line 48 of file painter.py.

◆ color() [2/2]

None color ( self,
Union[Color, ColorConstant, ColorPalette, ColorPaletteConstant] color )

Set the color for painting an object into the image.

If the draw method is called several times, there are two options:

  • the same color is used for each call,
  • the color changes with each call.

For the first option a Color or a ColorConstant must be passed, for the second a ColorPalette or a ColorPaletteConstant.

Parameters
colorThe color to set.
Exceptions
NotSupportedExceptionIf color is not a Color or ColorConstant.
Since
ids_peak_icv 1.1

Definition at line 60 of file painter.py.

◆ draw()

None draw ( self,
IDrawable drawable )

Draws the drawable onto the image, the painter was initialized with.

For more info, please see the documentation of the specific object that shall be drawn.

The following objects can be drawn:

  • Region
Parameters
drawableThe object to be drawn.
Since
ids_peak_icv 1.1

Definition at line 112 of file painter.py.

◆ opacity() [1/2]

Opacity opacity ( self)

Get the current opacity for painting.

Returns
Opacity: The current opacity.
Since
ids_peak_icv 1.1

Definition at line 89 of file painter.py.

◆ opacity() [2/2]

None opacity ( self,
Opacity opacity )

Set the Opacity for painting.

Parameters
opacityThe opacity to set.
Since
ids_peak_icv 1.1

Definition at line 101 of file painter.py.

Field Documentation

◆ _drawing_options

_drawing_options = DrawingOptions()
protected

Definition at line 45 of file painter.py.

◆ _image

_image = _check_and_get_icv_image(image)
protected

Definition at line 44 of file painter.py.