visiannot.visiannot.components.VideoWidget

Summary

Module defining VideoWidget

Classes

visiannot.visiannot.components.VideoWidget.VideoWidget(…)

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.PlotWidget

Subclass of pyqtgraph.PlotWidget for displaying a video

The video data is not provided in the constructor, but with the method setImage(), then the method displayImage() displays the current frame. The method setAndDisplayImage() combines both.

Parameters
  • visi_lay (PyQt5.QtWidgets.QGridLayout) – layout of the associated instance of ViSiAnnoT

  • widget_position (tuple or list) – position of the widget in the layout of the associated instance of ViSiAnnoT

  • args – positional arguments of the method setWidgetTitle()

  • kwargs – keyword arguments of the method setWidgetTitle()

Methods:

displayImage()

Displays the current frame stored in image

setAndDisplayImage(*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:

title

(str) Name of the video file without extension

previous_frame_id

(int) Index of the previously read frame

image

(numpy array) Current frame image

img_item

(pyqtgraph.ImageItem) Displayed image item

displayImage()[source]

Displays the current frame stored in image

It sets the attribute img_item.

setAndDisplayImage(*args)[source]

Reads video at the specified frame and displays image

It calls the methods setImage() and displayImage().

Parameters

args – positional arguments of setImage()

setImage(data_video, frame_id)[source]

Reads video at the specified frame

It sets the attributes previous_frame_id and image.

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