Camera Module

class camera.Camera

Returns the color images and depth images captured by the camera.

abstract get_color_image()

Returns the current color image captured by the camera.

Return type

NDArray[(480, 640, 3), uint8]

Returns

An array representing the pixels in the image, organized as follows

0th dimension: pixel rows, indexed from top to bottom. 1st dimension: pixel columns, indexed from left to right. 2nd dimension: pixel color channels, in the blue-green-red format.

Note

Each color value ranges from 0 to 255.

Example:

# Initialize image with the most recent color image captured by the camera
image = rc.camera.get_color_image()

# Store the amount of blue in the pixel on row 3, column 5
blue = image[3][5][0]
abstract get_color_image_async()

Returns the current color image without the car in “go” mode.

Return type

NDArray[(480, 640, 3), uint8]

Returns

An array representing the pixels in the image, organized as follows

0th dimension: pixel rows, indexed from top to bottom. 1st dimension: pixel columns, indexed from left to right. 2nd dimension: pixel color channels, in the blue-green-red format.

Note

Each color value ranges from 0 to 255.

Warning

This function breaks the start-update paradigm and should only be used in Jupyter Notebook.

Example:

# Initialize image with the most recent color image captured by the camera
image = rc.camera.get_color_image_async()

# Store the amount of blue in the pixel on row 3, column 5
blue = image[3][5][0]
abstract get_depth_image()

Returns the current depth image captured by the camera.

Return type

NDArray[(480, 640), float32]

Returns

A two dimensional array indexed from top left to the bottom right storing the distance of each pixel from the car in cm.

Example:

# Initialize image with the most recent depth image captured by the camera
image = rc.camera.get_depth_image()

# Store the distance of the object at pixel row 3, column 5
distance = image[3][5]
abstract get_depth_image_async()

Returns the current depth image without the car in “go” mode.

Return type

NDArray[(480, 640), float32]

Returns

A two dimensional array indexed from top left to the bottom right storing the distance of each pixel from the car in cm.

Warning

This function breaks the start-update paradigm and should only be used in Jupyter Notebook.

Example:

# Initialize image with the most recent depth image captured by the camera
image = rc.camera.get_depth_image_async()

# Store the distance of the object at pixel row 3, column 5
distance = image[3][5]
get_height()

Returns the pixel height of the color and depth images.

Return type

int

Returns

The height (number of pixel rows) in the color and depth images.

Example:

image = rc.camera.get_color_image()

# Access the top bottom left pixel of the image
bottom_left_pixel = image[rc.camera.get_height() - 1][0]
get_max_range()

Returns the maximum distance in cm which can be detected by the depth camera.

Return type

float

Returns

The maximum range of the depth camera.

Example:

depth_image = rc.camera.get_depth_image()
center_distance = rc_utils.get_depth_image_center_distance(depth_image)

# If center_distance is 0.0 (no data), set it to max_range
if center_distance == 0.0:
    center_distance = rc.camera.get_max_range()
get_width()

Returns the pixel width of the color and depth images.

Return type

int

Returns

The width (number of pixel columns) in the color and depth images.

Example:

image = rc.camera.get_color_image()

# Access the top right pixel of the image
top_right_pixel = image[0][rc.camera.get_width() - 1]