Video¶
This class is mainly used to extract images from videos.
The project isn’t pivoting off of video data yet, so it lacks functions.
Grabbing Frames¶
We can grab frames from a video using anything iterable, like np.linspace.
This grabs the 0s, 50s, 100s frames
from frmodel.base.D2.video2D import Video2D
import numpy as np
from frmodel.base.consts import CONSTS
vid = Video2D.from_video("sample.mp4")
frames = vid.to_frames(np.linspace(0, 100000, 3))
Caveats¶
The class doesn’t provide a way to calculate the length of the video.
Grabbing Frames¶
-
class
frmodel.base.D2.video2D.Video2D(vid: cv2.VideoCapture)¶ Bases:
objectThis class holds the data as OpenCV2.VideoCapture.
Extract the actual Capture with .vid property
-
static
from_video(file_path: str) → frmodel.base.D2.video2D.Video2D¶ Creates an instance using the file path.
-
to_frames(offsets_msec: List[int], failure_default: None = None) → List[frmodel.base.D2.frame2D.Frame2D]¶ Extracts images from the video.
Returns frmodel.Image
- Parameters
offsets_msec – The timestamps to extract images from.
failure_default – Value to default to on failure on offset read.
- Returns
List of Images
-
static