def handler(paths, dimensions=None): if dimensions is None: dimensions = [None, None] self.first_image = ImageWrapper.from_path(paths[0]) self.second_image = ImageWrapper.from_path(paths[1]) self.set_enabled_operations(True) self.select_images_btn.setEnabled(False)
def selectFileButton_clicked(self): options = QFileDialog.Options() filePath, _ = QFileDialog.getOpenFileName(self, "Select image file", "", "Images (*.jpg *.jpeg *.raw *.ppm *.pgm *.RAW *.png)", options=options) if filePath: self.loadedImage_changed(ImageWrapper.from_path(filePath)) return True return False
def run(self): point_a, point_b = self.points dim = (point_b[0] - point_a[0], point_b[1] - point_a[1]) border_tracking = BorderTracking(point_a, dim, self.epsilon) for i, img_path in enumerate(self.images_paths): startTime = time.time() result = border_tracking.next_image(ImageWrapper.from_path(img_path)) result.draw_image() self.add_image_to_carrousel_signal.emit(result, f"<b>Frame {i + 1}/{len(self.images_paths)}</b> (Time spent: {round(time.time() - startTime, 2)}s)") self.update_progressbar_signal.emit((i + 1) / len(self.images_paths) * 100)
def selectMultipleFilesButton_clicked(self): options = QFileDialog.Options(QFileDialog.ExistingFiles) filePaths, _ = QFileDialog.getOpenFileNames(self, "Select image files", "", "Images (*.jpg *.jpeg *.raw *.ppm *.pgm *.RAW *.png)", options=options) filePaths.sort() self.images_paths = filePaths new_image_window = ImageSectionSelectorWindow(ImageWrapper.from_path(filePaths[0]), self.prueba_callback, "Select section") self.imageVisualizerWindows.append(new_image_window) new_image_window.show()
def test_run(): images = [] folder_path = "/home/fastiz/Escritorio/video sintetico" for image_path in glob.glob(folder_path + "/*.jpg"): images.append(ImageWrapper.from_path(image_path)) border_tracking = BorderTracking((102, 340), (200, 100), 150, theta1=(255, 0, 0)) for image in images: result = border_tracking.next_image(image) result.draw_image() plt.imshow(result.image_element) plt.show()
def onSelectButtonClicked(self): options = QFileDialog.Options() filePath, _ = QFileDialog.getOpenFileName( self, "Select image file", "", "Images (*.jpg *.jpeg *.raw *.ppm *.pgm *.RAW)", options=options) if filePath: self.image = ImageWrapper.from_path(filePath) for i in reversed(range(self.viewerLayout.count())): self.viewerLayout.itemAt(i).widget().setParent(None) self.imageSectionSelector = ImageSectionSelector(self.image) self.viewerLayout.addWidget(self.imageSectionSelector)
def reload_from_disk_clicked(self): self.loadedImage_changed(ImageWrapper.from_path(self.image.file_path))