Scene video class#
- class pyneon.video.NeonVideo(video_file: Path, timestamps_file: Path, info_file: Path)#
Bases:
VideoCapture
Loaded video file with timestamps.
- Parameters:
video_file (pathlib.Path) – Path to the video file.
timestamps_file (pathlib.Path) – Path to the timestamps file.
info_file (pathlib.Path) – Path to the scene camera info file.
- timestamps#
Timestamps of the video frames in nanoseconds.
- Type:
- ts#
Alias for timestamps.
- Type:
- plot_frame(index: int = 0, ax: Axes | None = None, auto_title: bool = True, show: bool = True)#
Plot a frame from the video on a matplotlib axis.
- Parameters:
index (int) – Index of the frame to plot.
ax (matplotlib.axes.Axes or None) – Axis to plot the frame on. If
None
, a new figure is created. Defaults toNone
.auto_title (bool) – Whether to automatically set the title of the axis. The automatic title includes the video file name and the frame index. Defaults to
True
.
- Returns:
fig (matplotlib.figure.Figure) – Figure object containing the plot.
ax (matplotlib.axes.Axes) – Axis object containing the plot.
- plot_scanpath_on_video(scanpath: DataFrame, circle_radius: int = 10, line_thickness: int = 2, max_fixations: int = 10, show_video: bool = False, video_output_path: Path | str = 'scanpath.mp4') None #
Plot scanpath on top of the video frames. The resulting video can be displayed and/or saved.
- Parameters:
scanpath (pandas.DataFrame) – DataFrame containing the fixations and gaze data.
circle_radius (int) – Radius of the fixation circles in pixels. Defaults to 10.
line_thickness (int or None) – Thickness of the lines connecting fixations. If None, no lines are drawn. Defaults to 2.
max_fixations (int) – Maximum number of fixations to plot per frame. Defaults to 10.
show_video (bool) – Whether to display the video with fixations overlaid. Defaults to False.
video_output_path (pathlib.Path or str or None) – Path to save the video with fixations overlaid. If None, the video is not saved. Defaults to ‘scanpath.mp4’.