landingai.image_source_ops
Operations (create, probe, save, etc) around images, videos from various sources (webcam, video, RTSP stream etc).
probe_video(video_file, samples_per_second)
Probe a video file to get some metadata before sampling images. Parameters
video_file: The local path to the video file samples_per_second: Number of images to sample per second Returns
A tuple of three values - The total number of frames, - The number of frames to sample, - The video length in seconds.
Source code in landingai/image_source_ops.py
sample_images_from_video(video_file, output_dir, samples_per_second=1)
Sample images from a video file. Parameters
video_file: The local path to the video file output_dir: The local directory path that stores the sampled images samples_per_second: The number of images to sample per second. If set to zero, it disables sampling Returns
a list of local file paths to the sampled images
Source code in landingai/image_source_ops.py
take_photo_from_webcam(webcam_source=0)
Open a Window and allow users to take a photo from the webcam. It supports running on both local environment and Google's colab notebooks. For Google colab, it will open a window to allow users to take a photo from the webcam by pressing the "Capture" button. For local environment, it will open a window to allow users to take a photo from the webcam by pressing the "space" button.