def importImagesFromFolder(self, path, recursive=False): """ Args: path: A path to a folder or file or a list of files/folders recursive: List files in folders recursively. """ filesByType = multiview.findFilesByTypeInFolder(path, recursive) if filesByType.images: self.buildIntrinsics(self.cameraInit, filesByType.images)
def getFilesByTypeFromDrop(drop): """ Args: drop: Returns: <images, otherFiles> List of recognized images and list of other files """ urls = drop.property("urls") # Build the list of images paths filesByType = multiview.FilesByType() for url in urls: localFile = url.toLocalFile() if os.path.isdir(localFile): # get folder content filesByType.extend(multiview.findFilesByTypeInFolder(localFile)) else: filesByType.addFile(localFile) return filesByType
def update(self): """ Look for new images in the watched folder and create SfM augmentation step (or modify existing one) to include those images to the reconstruction. """ # Get all new images in the watched folder imagesInFolder = multiview.findFilesByTypeInFolder(self._folder) newImages = set(imagesInFolder).difference(self.allImages) for imagePath in newImages: # print('[LiveSfmManager] New image file : {}'.format(imagePath)) if not self.cameraInit: # Start graph modification: until 'computeAugmentation' is called, every commands # used will be part of this macro self.reconstruction.beginModification("SfM Augmentation") # Add SfM augmentation step in the graph self.cameraInit, self.sfm = self.reconstruction.addSfmAugmentation() self.addImageToStep(imagePath) # If we have enough images and the graph is not being computed, compute augmentation step if len(self.imagesInStep()) >= self.minImagesPerStep and not self.reconstruction.computing: self.computeStep()