visiannot.tools.ToolsImage¶
Module with functions for loading image and video files
Summary¶
Functions¶
Loads video data with openCV |
|
Reads an image with openCV |
|
Changes the order of an image channels in order to get RGB color, may reverse the first and second axis (in order to transform shape |
API¶
Functions¶
-
visiannot.tools.ToolsImage.getDataVideo(path)[source]¶ Loads video data with openCV
- Parameters
path (str) – path to the video file
- Returns
data_video (cv2.VideoCapture)
nframes (int) – number of frames in the video
fps (int or float) - frame rate of the video
date_time (datetime.datetime) – beginning date-time of the video file (this information must be provided in the name of the video file, see
ToolsDateTime.getFileDatetimeString())
-
visiannot.tools.ToolsImage.readImage(path)[source]¶ Reads an image with openCV
- Parameters
path (str) – path to the image file
- Returns
RGB image array of shape

- Return type
numpy array
-
visiannot.tools.ToolsImage.transformImage(im, RGB_combination='BGR', flag_transpose=True)[source]¶ Changes the order of an image channels in order to get RGB color, may reverse the first and second axis (in order to transform shape
to
).Particularly useful to display images retrieved with openCV. Indeed, openCV returns images of shape
with BGR
color.- Parameters
im (numpy array) – image array of shape
, where third
axis is a 3-channel colorRGB_combination (str) – order of the color channel (as with openCV)
flag_transpose (bool) – specify if first axis and second axis must be reversed
- Returns
image array of shape
where third axis
is RGB color- Return type
numpy array
If
imis not a numpy array or is not a 3D array, then the output isim.