sign_language_translator.vision.utils module
This module provides utility functions for video processing.
- sign_language_translator.vision.utils.iter_frames_with_opencv(path: str) Generator[ndarray[Any, dtype[uint8]], None, None][source][source]
Extracts individual frames from a video file or an image file.
This function reads a video file using opencv and extracts its frames as numpy arrays. It can also read an image file and treat it as a single frame video.
- Parameters:
path (str) – The path to the video or image file.
- Yields:
NDArray[np.uint8] – numpy arrays representing frames from the video with shape: (height, width, color_channels).
- Raises:
FileNotFoundError – If the video file is not found or cannot be opened.
- sign_language_translator.vision.utils.read_frames_with_opencv(path: str) List[ndarray[Any, dtype[uint8]]][source][source]
Extracts individual frames from a video file or an image file.
This function reads a video file using opencv and extracts its frames as numpy arrays. It can also read an image file and treat it as a single frame video.
- Parameters:
path (str) – The path to the video or image file.
- Returns:
A list of numpy arrays, each representing a frame from the video.
- Return type:
List[NDArray]
- Raises:
FileNotFoundError – If the video file is not found or cannot be opened.