Neobotics Foundation Inc.
These docs are public and open source.Edit on GitHub

RC.CAMERA

The camera module provides color frames as a NumPy array.

METHODS

rc.camera.get_color_image()returns NDArray[H, W, 3]

A deep copy of the current color frame as a NumPy array of rows by columns, three channels in blue-green-red order, values 0 to 255.

rc.camera.get_color_image_no_copy()returns NDArray[H, W, 3]

A direct reference to the current color frame, without copying. Do not modify it; the library reuses the buffer for the next frame.

rc.camera.get_color_image_async()returns NDArray[H, W, 3]

The current color frame but readable outside the start/update loop. This function should only be used in a Jupyter Notebook cell, after rc.go_async() has been called.

rc.camera.get_width()returns int

Returns the frame width in pixels.

rc.camera.get_height()returns int

Returns the frame height in pixels.

EXAMPLE USAGE

python
import racecar_core import numpy as np rc = racecar_core.create_racecar() def start(): pass def update(): image = rc.camera.get_color_image() # average brightness of the colour frame print("brightness:", np.mean(image)) # the centre pixel as blue, green, red. The NeoRacer is RGB-only, # so reach for the LiDAR (rc.lidar), not a depth frame, for distance. h, w = image.shape[0], image.shape[1] b, g, r = image[h // 2, w // 2] print("centre BGR:", b, g, r) rc.set_start_update(start, update) rc.go()

For full documentation, visit the racecar-neo-library documentation.