sima.video_reader ================= .. py:module:: sima.video_reader Attributes ---------- .. autoapisummary:: sima.video_reader.logger Classes ------- .. autoapisummary:: sima.video_reader.Reader sima.video_reader.Writer sima.video_reader.RTSPReader sima.video_reader.FolderImageReader sima.video_reader.PCIeReader sima.video_reader.RTSPWriter sima.video_reader.PCIeWriter sima.video_reader.VideoReader sima.video_reader.VideoWriter Module Contents --------------- .. py:data:: logger .. py:class:: Reader Helper class that provides a standard way to create an ABC using inheritance. .. py:method:: read() -> Tuple[int, numpy.ndarray] :abstractmethod: .. py:method:: isOpened() -> bool :abstractmethod: .. py:method:: get_cam_resolution() -> Tuple[int, int] :abstractmethod: .. py:method:: release() :abstractmethod: .. py:class:: Writer Helper class that provides a standard way to create an ABC using inheritance. .. py:method:: write(frame, meta=None) :abstractmethod: .. py:method:: release() :abstractmethod: .. py:class:: RTSPReader(cam_source: str) Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: frame_num :value: 0 .. py:attribute:: app_source :value: 'rtspsrc location=Uninferable latency=0 ! rtph264depay wait-for-keyframe=true ! h264parse !... .. py:attribute:: cap .. py:method:: get_cam_resolution() -> Tuple[int, int] Get frame width and frame height .. py:method:: read() .. py:method:: isOpened() -> bool .. py:method:: release() .. py:class:: FolderImageReader(folder_path: str, frame_width: int = 1280, frame_height: int = 720) .. py:attribute:: folder_path .. py:attribute:: loop :value: False .. py:attribute:: image_files .. py:attribute:: frame_num :value: 0 .. py:attribute:: total_images .. py:attribute:: current_index :value: 0 .. py:method:: set_loop(val) .. py:method:: get_cam_resolution() -> Tuple[int, int] Get frame width and frame height .. py:method:: read() -> Tuple[int, numpy.ndarray] .. py:method:: isOpened() -> bool .. py:method:: release() .. py:class:: PCIeReader(frame_width: int = 1280, frame_height: int = 720, data_buf_name: str = 'in-img-source') Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: app_source :value: 'simaaipciesrc buffer-size=0 ! appsink sync=true max-buffers=100 drop=true' .. py:attribute:: data_reader .. py:attribute:: frame_num :value: 0 .. py:method:: get_cam_resolution() -> Tuple[int, int] Get frame width and frame height .. py:method:: read() -> Tuple[int, numpy.ndarray] .. py:method:: isOpened() -> bool .. py:method:: release() .. py:class:: RTSPWriter(host_ip: str, port: int, width: int, height: int) Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: app_sink :value: 'appsrc ! video/x-raw,format=NV12,width=Uninferable,height=Uninferable,framerate=30/1 !... .. py:attribute:: writer .. py:method:: write(frame, meta=None) .. py:method:: release() .. py:class:: PCIeWriter(data_buf_name: str = 'overlay', frame_width: int = 1280, frame_height: int = 720) Helper class that provides a standard way to create an ABC using inheritance. .. py:attribute:: buf_size :value: 0 .. py:attribute:: app_sink :value: 'appsrc ! simaaimetaparser dump-data=false ! simaaipciesink data-buffer-size=0... .. py:attribute:: data_writer .. py:method:: write(frame, meta=None) .. py:method:: release() .. py:class:: VideoReader(source: str = None, frame_width: int = 1280, frame_height: int = 720) A class for reading video from various sources, including ``pcie``, ``rtspsrc`` and ``filesrc``. .. py:method:: read() -> Tuple[int, numpy.ndarray] Reads a frame from the video source. .. py:method:: isOpened() -> bool Check whether the video source has been successfully opened. This method verifies that the underlying video reader or stream is properly initialized and ready for reading frames. :returns: True if the video source is open and accessible; False otherwise. :rtype: bool .. py:method:: get_cam_resolution() -> Tuple[int, int] Get frame width and frame height .. py:method:: release() Releases the VideoReader resources. .. py:method:: set_loop(val) .. py:property:: frame_num .. py:class:: VideoWriter(source: str = None, host_ip: str = None, port: int = None, frame_width: int = None, frame_height: int = None) A class for writing video stream to various destinations, including ``pcie``, ``rtspsrc`` and ``filesrc``. .. py:method:: write(frame, meta=None) Writes a frame to the video sink. .. py:method:: release() Releases the VideoWriter resources.