Display Module

class display.Display

Allows the user to print images to the screen.

abstract create_window()

Creates an empty window into which images will be displayed.

Note

It is not necessary to call create_window before any of the other display methods (show_color_image, show_depth_image, etc.). These methods will automatically create a new window if one was not already created.

Example:

# Creates a window
rc.camera.create_window()

# Display an image in this window
image = rc.camera.get_color_image()
rc.display.show_color_image(image)
Return type

None

abstract show_color_image(image)

Displays a color image in a window.

Parameters

image (NDArray) – The color image to display to the the screen.

Example:

image = rc.camera.get_color_image()

# Show the image captured by the camera
rc.display.show_color_image(image)
Return type

None

show_depth_image(image, max_depth=1000, points=[])

Displays a depth image in grayscale in a window.

Parameters
  • image (NDArray[(typing.Any, typing.Any), float32]) – The depth image to display to the screen.

  • max_depth (int) – The farthest depth to show in the image in cm. Anything past this depth is shown as black.

  • points (List[Tuple[int, int]]) – A list of points in (pixel row, pixel column) format to show on the image as colored dots.

Example:

depth_image = rc.camera.get_depth_image()

# Show the depth_image captured by the camera.
rc.display.show_depth_image(depth_image)

# Show anything that is at most 500 cm away, and show a black cross at
# row 3, column 5
rc.display.show_depth_image(depth_image, 500, [(3, 5)])
Return type

None

show_lidar(samples, radius=128, max_range=1000, highlighted_samples=[])

Displays a set of LIDAR samples.

Parameters
  • samples (NDArray[Any, float32]) – A complete LIDAR scan.

  • radius (int) – Half of the width or height (in pixels) of the generated image.

  • max_range (int) – The farthest depth to show in the image in cm. Anything past this depth is shown as black.

  • highlighted_samples (List[Tuple[float, float]]) – A list of samples in (angle, distance) format to show as light blue dots. Angle must be in degrees from straight ahead (clockwise), and distance must be in cm.

Note

Each sample in samples is shown as a red pixel. Each sample in highlighted_samples is shown as a blue pixel. The car is shown as a green dot at the center of the visualization.

Warning

samples must be a complete LIDAR scan. This function assumes that each sample is equal angle appart, and that samples spans the entire 360 degrees. If this is not the case, the visualization will be inaccurate.

Example:

depth_image = rc.camera.get_depth_image()

# Show the depth_image captured by the camera.
rc.display.show_depth_image(depth_image)

# Show anything that is at most 500 cm away, and show a black cross at
# row 3, column 5
rc.display.show_depth_image(depth_image, 500, [(3, 5)])
Return type

None