pyrealsense2.pipeline

class pyrealsense2.pipeline

The pipeline simplifies the user interaction with the device and computer vision processing modules. The class abstracts the camera configuration and streaming, and the vision modules triggering and threading. It lets the application focus on the computer vision output of the modules, or the device output data. The pipeline can manage computer vision modules, which are implemented as a processing blocks. The pipeline is the consumer of the processing block interface, while the application consumes the computer vision interface.

__init__(self: pyrealsense2.pipeline, ctx: pyrealsense2.context=<pyrealsense2.context object at 0x7fb6840b5650>) → None

The caller can provide a context created by the application, usually for playback or testing purposes.

Methods

__init__((self: pyrealsense2.pipeline, ...) The caller can provide a context created by the application, usually for playback or testing purposes.
get_active_profile(...)
poll_for_frames(...) Check if a new set of frames is available and retrieve the latest undelivered set.
start(*args, **kwargs) Overloaded function.
stop((self: pyrealsense2.pipeline) -> None) Stop the pipeline streaming.
try_wait_for_frames(...)
wait_for_frames(...) Wait until a new set of frames becomes available.
get_active_profile(self: pyrealsense2.pipeline) → pyrealsense2.pipeline_profile
poll_for_frames(self: pyrealsense2.pipeline) → pyrealsense2.composite_frame

Check if a new set of frames is available and retrieve the latest undelivered set. The frames set includes time-synchronized frames of each enabled stream in the pipeline. The method returns without blocking the calling thread, with status of new frames available or not. If available, it fetches the latest frames set. Device frames, which were produced while the function wasn’t called, are dropped. To avoid frame drops, this method should be called as fast as the device frame rate. The application can maintain the frames handles to defer processing. However, if the application maintains too long history, the device may lack memory resources to produce new frames, and the following calls to this method shall return no new frames, until resources become available.

start(*args, **kwargs)

Overloaded function.

  1. start(self: pyrealsense2.pipeline) -> pyrealsense2.pipeline_profile

Start the pipeline streaming with its default configuration. The pipeline streaming loop captures samples from the device, and delivers them to the attached computer vision modules and processing blocks, according to each module requirements and threading model. During the loop execution, the application can access the camera streams by calling wait_for_frames() or poll_for_frames(). The streaming loop runs until the pipeline is stopped. Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised.

  1. start(self: pyrealsense2.pipeline, config: pyrealsense2.config) -> pyrealsense2.pipeline_profile

Start the pipeline streaming according to the configuraion. The pipeline streaming loop captures samples from the device, and delivers them to the attached computer vision modules and processing blocks, according to each module requirements and threading model. During the loop execution, the application can access the camera streams by calling wait_for_frames() or poll_for_frames(). The streaming loop runs until the pipeline is stopped. Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised. The pipeline selects and activates the device upon start, according to configuration or a default configuration. When the rs2::config is provided to the method, the pipeline tries to activate the config resolve() result. If the application requests are conflicting with pipeline computer vision modules or no matching device is available on the platform, the method fails. Available configurations and devices may change between config resolve() call and pipeline start, in case devices are connected or disconnected, or another application acquires ownership of a device.

  1. start(self: pyrealsense2.pipeline, callback: Callable[[pyrealsense2.frame], None]) -> pyrealsense2.pipeline_profile

Start the pipeline streaming with its default configuration. The pipeline captures samples from the device, and delivers them to the provided frame callback. Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised. When starting the pipeline with a callback both wait_for_frames() and poll_for_frames() will throw exception.

  1. start(self: pyrealsense2.pipeline, config: pyrealsense2.config, callback: Callable[[pyrealsense2.frame], None]) -> pyrealsense2.pipeline_profile

Start the pipeline streaming according to the configuraion. The pipeline captures samples from the device, and delivers them to the provided frame callback. Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised. When starting the pipeline with a callback both wait_for_frames() and poll_for_frames() will throw exception. The pipeline selects and activates the device upon start, according to configuration or a default configuration. When the rs2::config is provided to the method, the pipeline tries to activate the config resolve() result. If the application requests are conflicting with pipeline computer vision modules or no matching device is available on the platform, the method fails. Available configurations and devices may change between config resolve() call and pipeline start, in case devices are connected or disconnected, or another application acquires ownership of a device.

  1. start(self: pyrealsense2.pipeline, queue: pyrealsense2.frame_queue) -> pyrealsense2.pipeline_profile

Start the pipeline streaming with its default configuration. The pipeline captures samples from the device, and delivers them to the provided frame queue. Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised. When starting the pipeline with a callback both wait_for_frames() and poll_for_frames() will throw exception.

  1. start(self: pyrealsense2.pipeline, config: pyrealsense2.config, queue: pyrealsense2.frame_queue) -> pyrealsense2.pipeline_profile

Start the pipeline streaming according to the configuraion. The pipeline captures samples from the device, and delivers them to the provided frame queue. Starting the pipeline is possible only when it is not started. If the pipeline was started, an exception is raised. When starting the pipeline with a callback both wait_for_frames() and poll_for_frames() will throw exception. The pipeline selects and activates the device upon start, according to configuration or a default configuration. When the rs2::config is provided to the method, the pipeline tries to activate the config resolve() result. If the application requests are conflicting with pipeline computer vision modules or no matching device is available on the platform, the method fails. Available configurations and devices may change between config resolve() call and pipeline start, in case devices are connected or disconnected, or another application acquires ownership of a device.

stop(self: pyrealsense2.pipeline) → None

Stop the pipeline streaming. The pipeline stops delivering samples to the attached computer vision modules and processing blocks, stops the device streaming and releases the device resources used by the pipeline. It is the application’s responsibility to release any frame reference it owns. The method takes effect only after start() was called, otherwise an exception is raised.

try_wait_for_frames(self: pyrealsense2.pipeline, timeout_ms: int=5000) → Tuple[bool, pyrealsense2.composite_frame]
wait_for_frames(self: pyrealsense2.pipeline, timeout_ms: int=5000) → pyrealsense2.composite_frame

Wait until a new set of frames becomes available. The frames set includes time-synchronized frames of each enabled stream in the pipeline. In case of different frame rates of the streams, the frames set include a matching frame of the slow stream, which may have been included in previous frames set. The method blocks the calling thread, and fetches the latest unread frames set. Device frames, which were produced while the function wasn’t called, are dropped. To avoid frame drops, this method should be called as fast as the device frame rate. The application can maintain the frames handles to defer processing. However, if the application maintains too long history, the device may lack memory resources to produce new frames, and the following call to this method shall fail to retrieve new frames, until resources become available.