Pymecavideo 8.0
Étude cinématique à l'aide de vidéos
toQimage.py
1from PyQt6.QtGui import QImage, qRgb
2
3import numpy as np
4
5
7 pass
8
9
10def toQImage(im, copy=False):
11 """transforme une image ope,cv (numpy array) en une QImage"""
12 if im is None:
13 return QImage()
14
15 if im.dtype == np.uint8:
16 if len(im.shape) == 3:
17 if im.shape[2] == 3:
18 qim = QImage(im.data, im.shape[1],
19 im.shape[0], QImage.Format.Format_RGB888)
20 return qim.copy() if copy else qim
21
22 raise NotImplementedException