API Documentation

Colors:

viren2d.Color

A color in rgba format, i.e. \(r,g,b,a \in [0,1]\).

viren2d.axis_color

Returns a default color for the \(x\), \(y\), or \(z\) axis.

viren2d.color_from_object_category

Alias of viren2d.Color.from_object_category().

viren2d.color_from_object_id

Alias of viren2d.Color.from_object_id().

viren2d.color_names

Returns a list of the predefined color names.

viren2d.fade_out_linear

Color transition function for viren2d.Painter.draw_trajectory().

viren2d.fade_out_logarithmic

Color transition function for viren2d.Painter.draw_trajectory().

viren2d.fade_out_quadratic

Color transition function for viren2d.Painter.draw_trajectory().

viren2d.object_category_names

Alias of viren2d.Color.object_category_names().

viren2d.rgba

Creates a Color from \(r,g,b,a \in [0,1]\).

viren2d.RGBa

Creates a Color from \(R,G,B \in [0, 255]\) and alpha \(a \in [0, 1]\).

Color Gradients:

viren2d.ColorGradient

Base class for LinearColorGradient and RadialColorGradient.

viren2d.LinearColorGradient

Gradient definition for linear color blending along a line.

viren2d.RadialColorGradient

Radial gradient between two circles.

Color Maps:

viren2d.ColorMap

Enumeration of available color maps.

viren2d.colorize_labels

Colorizes a label image.

viren2d.colorize_scaled

Colorizes 2D data array using a colormap.

viren2d.colorize_scalars

Returns corresponding color map colors for a list of scalar values.

viren2d.get_colormap

Returns the list of Color for the specified color map.

viren2d.set_custom_colormap

Registers a customized color map.

viren2d.StreamColorizer

Utility class for scaled colorization of a data stream.

viren2d.peaks

Computes the peaks example data.

Drawing Functionality:

The Painter provides the following drawing functionality:

draw_arc()

Draws a circular arc.

draw_arrow()

Draws an arrow.

draw_bounding_box_2d()

Draws a single 2D bounding box.

draw_circle()

Draws a circle.

draw_ellipse()

Draws an ellipse.

draw_gradient()

Draws a color gradient.

draw_grid()

Draws a grid.

draw_horizon_line()

Draws the estimated line of horizon.

draw_image()

Draws an image onto the canvas.

draw_line()

Draws a line.

draw_marker()

Draws a single marker/keypoint.

draw_markers()

Draws multiple (similarly styled) markers/keypoints.

draw_polygon()

Draws a polygon.

draw_rect()

Draws a rectangle.

draw_text()

Draws single- or multi-line text.

draw_text_box()

Draws a single- or multi-line text box.

draw_trajectories()

Draws multiple (similarly styled) trajectories.

draw_trajectory()

Draws a single trajectory.

draw_xyz_axes()

Visualizes a coordinate system reference frame.

reset_clip()

Resets the latest clip region.

set_clip_circle()

Establishes a circular clip region for the current canvas.

set_clip_rect()

Establishes a rectangular clip region for the current canvas.

Image Handling:

viren2d.ImageBuffer

Encapsulates image data.

viren2d.collage

Creates a collage.

viren2d.color_pop

Returns an image where the specified color range is highlighted.

viren2d.convert_gray2rgb

Converts a grayscale image to RGB(A).

viren2d.convert_hsv2rgb

Converts a HSV image to RGB(A)/BGR(A).

viren2d.convert_rgb2gray

Converts RGB(A)/BGR(A) images to grayscale.

viren2d.convert_rgb2hsv

Converts a RGB(A)/BGR(A) image to HSV.

viren2d.load_image_uint8

Reads an 8-bit image from disk.

viren2d.save_image_uint8

Stores an 8-bit image to disk as either JPEG or PNG.

Optical Flow:

viren2d.colorize_optical_flow

Colorizes a two-band optical flow field.

viren2d.load_optical_flow

Loads an optical flow field from a .flo file.

viren2d.optical_flow_legend

Returns the color wheel visualization.

viren2d.save_optical_flow

Saves a two-band optical flow field as .flo file.

Points/Vectors:

viren2d.Vec2d

A 2D vector of float coordinates.

viren2d.Vec2i

A 2D vector of int coordinates.

viren2d.Vec3d

A 3D vector of float coordinates.

viren2d.Vec3i

A 3D vector of int coordinates.

Positioning:

viren2d.Anchor

Placement options with respect to a reference point.

viren2d.HorizontalAlignment

Enumeration for horizontal alignment.

viren2d.LabelPosition

Placement options for labels.

viren2d.VerticalAlignment

Options for vertical alignment.

Shapes:

Style Definitions:

viren2d.ArrowStyle

How an arrow should be drawn.

viren2d.BoundingBox2DStyle

How a 2D bounding box should be drawn."

viren2d.LineCap

Enumeration specifying how to render the endpoints of a line/dash stroke.

viren2d.LineJoin

Enumeration specifying how to render the junction of two lines/segments.

viren2d.LineStyle

How a line/contour should be drawn.

viren2d.Marker

Enumeration specifying the marker shape.

viren2d.MarkerStyle

How a marker/keypoint should be drawn.

viren2d.TextStyle

How text should be rendered.