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(lay, widget_position, data_video)[source]¶ Bases:
pyqtgraph.widgets.PlotWidget.PlotWidgetSubclass of pyqtgraph.PlotWidget for displaying a video
- Parameters
lay (PyQt5.QtWidgets.QGridLayout) – layout where the video widget must be displayed
widget_position (tuple or list) – position of the widget in the layout
data_video (tuple) – see value of
ViSiAnnoT.video_data_dict
Methods:
Displays the current frame stored in
imagesetAndDisplayImage(*args)Reads video at the specified frame and displays image
setDataVideo(data_video)Sets the attributes with video data
setImage(frame_id)Reads video at the specified frame
setSynchro(frame_id)Finds the video file to read and the temporal offset to apply when reading frames
Attributes:
(cv2.VideoCapture) Video data currently being played
(str) Basename of the video currently being played
(tuple) Information for video synchronization in case of long recording (ignored otherwise), 3 elements:
(float) Temporal offset in frames number to apply to the current frame to read in case of long recording (ignored otherwise)
(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()
-
setDataVideo(data_video)[source]¶ Sets the attributes with video data
In case of long recording, it sets the attributes
data_video_synchroand resets the attributesdata_video,offset_synchroandnametoNone. Otherwise, it only sets the attributesdata_videoandname.- Parameters
data_video (tuple) – see third positional argument of the constructor of
VideoWidget
-
setImage(frame_id)[source]¶ Reads video at the specified frame
It sets the attributes
previous_frame_idandimage.- Parameters
frame_id (int) – frame to read
- Returns
code (0 success, 1 pause, 2 error)
- Return type
int
-
setSynchro(frame_id)[source]¶ Finds the video file to read and the temporal offset to apply when reading frames
It sets the attributes
data_video,nameandoffset_synchro.- Parameters
frame_id (int) – next frame to read
-
data_video¶ (cv2.VideoCapture) Video data currently being played
-
data_video_synchro¶ (tuple) Information for video synchronization in case of long recording (ignored otherwise), 3 elements:
(list) Instances of cv2.VideoCapture containing the video data spanning the current file in the long recording
(list) Names of the video files spanning the current file in the long recording (same ordering than list of cv2.VideoCapture instances)
(numpy array) Array of shape (n, 2) (n is equal to the length of the list of video data), each row corresponds to an element of the list of cv2.VideoCapture instances (same ordering) and contains the bounding frames that the video spans in the current file in the long recording
-
image¶ (numpy array) Current frame image
-
img_item¶ (pyqtgraph.ImageItem) Displayed image item
-
name¶ (str) Basename of the video currently being played
-
offset_synchro¶ (float) Temporal offset in frames number to apply to the current frame to read in case of long recording (ignored otherwise)
-
previous_frame_id¶ (int) Index of the previously read frame