scistag.mediastag.video_source.VideoSource¶
- class VideoSource[source]¶
Bases:
objectDefines an arbitrary video source
Initializer
Methods
Pauses the video
Returns the current image as np array
Pauses the video
Seeks to given video position :type position_s:
float:param position_s: The new desired position :rtype:float:return: The real new positionAssigns a filter which is assigned to every image received from the original video source.
Starts the video
Stops the video
Tries to update the videos' progress :param repeat: Defines if the video shall repeat when the end is reached :param speed: The speed factor :rtype:
bool:return: True if the progress was updatedAttributes
__dict____doc____module____weakref__list of weak references to the object (if defined)
The video's overall duration in seconds.
Defines if the source is a continuous stream
Timestamp when the playback started or continued
Timestamp of the last update
The current position (in seconds)
Defines if there is a valid source
The video's size in pixels
The videos frame per second count
The amount of seconds per frame (1/fps)
A filter which shall be applied to every image received from the video before it's returned
The last raw image received internal
The last raw image's time stamp
The last returned image (after applying filters etc.)
The movie's playback speed.
The movie's repeat mode
If defined the get_image function is also allowed to update the video's progress.
- _get_image_int(timestamp=None)[source]¶
Returns the current image as np array (internal function providing the raw data before filters etc. are applied) :type timestamp: float | None :param timestamp: The timestamp of the last image received :rtype: tuple[float, Image | None] :return: Updated timestamp, the image
- get_image(timestamp=None, wait=False, timeout_s=2.0)[source]¶
Returns the current image as np array
- Parameters
- Return type
- Returns
Updated timestamp, the image
- seek(position_s)[source]¶
Seeks to given video position :type position_s:
float:param position_s: The new desired position :rtype:float:return: The real new position
- set_filter(image_filter)[source]¶
Assigns a filter which is assigned to every image received from the original video source. For example call set_filter(Grayscale()) to convert the camera or video to grayscale. You can also assign an ImageFilterPipeline to combine multiple filters. :type image_filter: ImageFilter | None :param image_filter: The filter to assign or None to disable it
- Return type
None
- update_progress()[source]¶
Tries to update the videos’ progress :param repeat: Defines if the video shall repeat when the end is reached :param speed: The speed factor :rtype:
bool:return: True if the progress was updated
- auto_progress¶
If defined the get_image function is also allowed to update the video’s progress. Otherwise the managing control, e.g. the VideoPlayer is responsible to do so
- duration¶
The video’s overall duration in seconds. 0 if a stream
- fps¶
The videos frame per second count
- image_filter: ImageFilter | None¶
A filter which shall be applied to every image received from the video before it’s returned
- is_stream¶
Defines if the source is a continuous stream
- last_update_timestamp¶
Timestamp of the last update
- position¶
The current position (in seconds)
- repeat¶
The movie’s repeat mode
- speed¶
The movie’s playback speed. 1.0 = 100%
- start_timestamp¶
Timestamp when the playback started or continued
- time_per_frame¶
The amount of seconds per frame (1/fps)
- valid¶
Defines if there is a valid source
- video_resolution¶
The video’s size in pixels