otx.api.usecases.exportable_code.streamer#
Initialization of streamer.
Functions
|
Get streamer object based on the file path or camera device index provided. |
Classes
|
Stream video frames from camera. |
|
Stream from directory of images. |
|
Stream from image file. |
|
Runs a BaseStreamer on a separate thread. |
|
Video Streamer. |
Base Streamer interface to implement Image, Video and Camera streamers. |
Exceptions
|
Exception for wrong input format. |
|
Exception for error opening reader. |
- exception otx.api.usecases.exportable_code.streamer.InvalidInput(message: str)[source]#
Bases:
Exception
Exception for wrong input format.
- exception otx.api.usecases.exportable_code.streamer.OpenError(message: str)[source]#
Bases:
Exception
Exception for error opening reader.
- class otx.api.usecases.exportable_code.streamer.BaseStreamer[source]#
Bases:
object
Base Streamer interface to implement Image, Video and Camera streamers.
- class otx.api.usecases.exportable_code.streamer.CameraStreamer(camera_device: int = 0)[source]#
Bases:
BaseStreamer
Stream video frames from camera.
- Parameters:
camera_device (int) – Camera device index e.g, 0, 1
Example
>>> streamer = CameraStreamer(camera_device=0) ... for frame in streamer: ... cv2.imshow("Window", frame) ... if ord("q") == cv2.waitKey(1): ... break
- class otx.api.usecases.exportable_code.streamer.DirStreamer(input_path: str, loop: bool = False)[source]#
Bases:
BaseStreamer
Stream from directory of images.
- Parameters:
path – Path to directory.
Example
>>> streamer = DirStreamer(path="../images") ... for frame in streamer: ... cv2.imshow("Window", frame) ... cv2.waitKey(0)
- class otx.api.usecases.exportable_code.streamer.ImageStreamer(input_path: str, loop: bool = False)[source]#
Bases:
BaseStreamer
Stream from image file.
- Parameters:
Example
>>> streamer = ImageStreamer(path="../images") ... for frame in streamer: ... cv2.imshow("Window", frame) ... cv2.waitKey(0)
- class otx.api.usecases.exportable_code.streamer.ThreadedStreamer(streamer: BaseStreamer, buffer_size: int = 2)[source]#
Bases:
BaseStreamer
Runs a BaseStreamer on a separate thread.
streamer (BaseStreamer): The streamer to run on a thread buffer_size (int): Number of frame to buffer internally. Defaults to 2.
Example
>>> streamer = VideoStreamer(path="../demo.mp4") >>> threaded_streamer = ThreadedStreamer(streamer) >>> for frame in threaded_streamer: ... pass
- class otx.api.usecases.exportable_code.streamer.VideoStreamer(input_path: str, loop: bool = False)[source]#
Bases:
BaseStreamer
Video Streamer.
- Parameters:
path – Path to the video file.
Example
>>> streamer = VideoStreamer(path="../demo.mp4") ... for frame in streamer: ... pass