visiannot.visiannot.components.VideoWidget¶
Summary¶
Module defining VideoWidget
Classes¶
Subclass of pyqtgraph.PlotWidget for displaying a video |
API¶
Class VideoWidget¶
-
class
visiannot.visiannot.components.VideoWidget.VideoWidget(visi_lay, widget_position, *args, **kwargs)[source]¶ Bases:
pyqtgraph.widgets.PlotWidget.PlotWidgetSubclass of pyqtgraph.PlotWidget for displaying a video
The video data is not provided in the constructor, but with the method
setImage(), then the methoddisplayImage()displays the current frame. The methodsetAndDisplayImage()combines both.- Parameters
visi_lay (PyQt5.QtWidgets.QGridLayout) – layout of the associated instance of
ViSiAnnoTwidget_position (tuple or list) – position of the widget in the layout of the associated instance of
ViSiAnnoTargs – positional arguments of the method
setWidgetTitle()kwargs – keyword arguments of the method
setWidgetTitle()
Methods:
Displays the current frame stored in
imagesetAndDisplayImage(*args)Reads video at the specified frame and displays image
setImage(data_video, frame_id)Reads video at the specified frame
setWidgetTitle(video_path, **kwargs)Sets the widget title with the file name without extension of the video
Attributes:
(str) Name of the video file without extension
(int) Index of the previously read frame
(numpy array) Current frame image
(pyqtgraph.ImageItem) Displayed image item
-
setAndDisplayImage(*args)[source]¶ Reads video at the specified frame and displays image
It calls the methods
setImage()anddisplayImage().- Parameters
args – positional arguments of
setImage()
-
setImage(data_video, frame_id)[source]¶ Reads video at the specified frame
It sets the attributes
previous_frame_idandimage.- Parameters
data_video (cv2.VideoCapture) – video data to read
frame_id (int) – frame to read
- Returns
code (0 success, 1 pause, 2 error)
- Return type
int
-
setWidgetTitle(video_path, **kwargs)[source]¶ Sets the widget title with the file name without extension of the video
- Parameters
video_path (str) – path to the video file to read
kwargs – keyword arguments of the method
pyqtgraph.PlotWidget.setTitle()
-
image¶ (numpy array) Current frame image
-
img_item¶ (pyqtgraph.ImageItem) Displayed image item
-
previous_frame_id¶ (int) Index of the previously read frame
-
title¶ (str) Name of the video file without extension