pepper.framework.abstract.camera module

class pepper.framework.abstract.camera.AbstractCamera(resolution, rate, callbacks)[source]

Bases: object

Abstract Camera

Parameters:
  • resolution (CameraResolution) – CameraResolution
  • rate (int) – Camera Frames per Second
  • callbacks (List[Callable[[AbstractImage], None]]) – Functions to call each time an AbstractImage is captured
callbacks

Get/Set on_image() Callbacks

Returns:callbacks – on_image callbacks
Return type:list of callable
channels

Number of Image (Color) Channels

Returns:channels – Number of Image (Color) channels
Return type:int
height

Image Height

Returns:height – Image height
Return type:int
on_image(image)[source]

On Image Event, Called for every Image captured by Camera

Custom Camera Backends should call this function for every frame acquired by the Camera

Parameters:image (AbstractImage) –
rate

Image Rate (Frames per Second)

Returns:rate – Image rate (Frames per Second)
Return type:int
resolution

Returns CameraResolution

Returns:resolution
Return type:CameraResolution
running

Returns whether Camera is Running

Returns:running
Return type:bool
shape

Image Shape (height, width, channels)

Returns:shape – Image Shape (height, width, channels)
Return type:np.ndarray
start()[source]

Start Streaming Images from Camera

stop()[source]

Stop Streaming Images from Camera

true_rate

Actual Image Rate (Frames per Second)

Image rate after accounting for latency & performance realities

Returns:true_rate – Actual Image Rate (Frames per Second)
Return type:float
width

Image Width

Returns:width – Image width
Return type:int
class pepper.framework.abstract.camera.AbstractImage(image, bounds, depth=None, image_time=None)[source]

Bases: object

Abstract Image Container

Parameters:
  • image (np.ndarray) – RGB Image (height, width, 3) as Numpy Array
  • bounds (Bounds) – Image Bounds (View Space) in Spherical Coordinates (Phi, Theta)
  • depth (np.ndarray) – Depth Image (height, width) as Numpy Array
bounds

Image Bounds (View Space) in Spherical Coordinates (Phi, Theta)

Returns:bounds – Image Bounds (View Space) in Spherical Coordinates (Phi, Theta)
Return type:Bounds
depth

Depth Image (height, width) as Numpy Array

Returns:depth – Depth Image (height, width) as Numpy Array
Return type:np.ndarray
frustum(depth_min, depth_max)[source]

Calculate Frustum of the camera at image time (visualisation)

Parameters:
  • depth_min (float) – Near Viewing Plane
  • depth_max (float) – Far Viewing Place
Returns:

frustum

Return type:

List[float]

get_depth(bounds)[source]

Get depth from Image at Bounds in Image Space

Parameters:bounds (Bounds) – Image Bounds (Image) in Image Space (y, x)
Returns:depth – Requested depth within Bounds
Return type:np.ndarray
get_direction(coordinates)[source]

Convert 2D Image Coordinates [x, y] to 2D position in Spherical Coordinates [phi, theta]

Parameters:coordinates (Tuple[float, float]) –
Returns:direction
Return type:Tuple[float, float]
get_image(bounds)[source]

Get pixels from Image at Bounds in Image Space

Parameters:bounds (Bounds) – Image Bounds (Image) in Image Space (y, x)
Returns:pixels – Requested pixels within Bounds
Return type:np.ndarray
hash
image

RGB Image (height, width, 3) as Numpy Array

Returns:image – RGB Image (height, width, 3) as Numpy Array
Return type:np.ndarray
time

Get time image was captured and received by the application.

Returns:time
Return type:float
to_file(root)[source]