Exemple #1
0
 def source(self, value):
     self._video_source = value
     qimage = GUIUtilities.array_to_qimage(self._video_source)
     pixmap = QPixmap.fromImage(qimage)
     pixmap = pixmap.scaledToHeight(120,
                                    mode=QtCore.Qt.SmoothTransformation)
     # pixmap=pixmap.scaled(QSize(150,150),aspectRatioMode=QtCore.Qt.KeepAspectRatio,transformMode=QtCore.Qt.SmoothTransformation)
     # image_widget.setScaledContents(True)
     self._video_widget.setPixmap(pixmap)
Exemple #2
0
 def create_thumbnail(item):
     file_path = item.file_path
     image = cv2.imread(file_path)
     h, w, _ = np.shape(image)
     if w > h:
         thumbnail_array = imutils.resize(image, width=150)
     else:
         thumbnail_array = imutils.resize(image, height=150)
     thumbnail_array = cv2.cvtColor(thumbnail_array,
                                    cv2.COLOR_BGR2RGB)
     thumbnail = GUIUtilities.array_to_qimage(thumbnail_array)
     thumbnail = QPixmap.fromImage(thumbnail)
     del thumbnail_array
     del image
     return item, h, w, thumbnail
Exemple #3
0
 def create_thumbnail(item):
     file_path = item.file_path
     if os.path.isfile(file_path):
         image = cv2.imread(file_path)
         h, w, _ = np.shape(image)
         if w > h:
             thumbnail_array = imutils.resize(image, width=150)
         else:
             thumbnail_array = imutils.resize(image, height=150)
         thumbnail_array = cv2.cvtColor(thumbnail_array,
                                        cv2.COLOR_BGR2RGB)
         thumbnail = GUIUtilities.array_to_qimage(thumbnail_array)
         thumbnail = QPixmap.fromImage(thumbnail)
         del thumbnail_array
         del image
         return item, h, w, thumbnail, os.path.getsize(
             file_path), False
     thumbnail = GUIUtilities.get_image("placeholder.png")
     thumbnail = thumbnail.scaledToHeight(100)
     h, w = thumbnail.height(), thumbnail.width()
     return item, h, w, thumbnail, 0, True