def extract(targetDatasetPath, geoCenters, label, windowGeoLength, multispectralImage, panchromaticImage): # Initialize dataset = sample_store.create(targetDatasetPath) windowCount = len(geoCenters) # For each geoCenter, for windowIndex, geoCenter in enumerate(geoCenters): window = [x.extractCenteredGeoWindow(geoCenter, windowGeoLength, windowGeoLength) for x in multispectralImage, panchromaticImage] if window[0] and window[1]: dataset.addSample(label, geoCenter, *window) if windowIndex % 100 == 0: view.printPercentUpdate(windowIndex + 1, windowCount) view.printPercentFinal(windowCount) # Return return dataset
def extract(targetDatasetPath, label, windowGeoLength, multispectralImage, panchromaticImage, geoCenters): # Initialize dataset = sample_store.create(targetDatasetPath) windowCount = len(geoCenters) # For each geoCenter, for windowIndex, geoCenter in enumerate(geoCenters): window = [ x.extractCenteredGeoWindow(geoCenter, windowGeoLength, windowGeoLength) for x in multispectralImage, panchromaticImage ] if window[0] and window[1]: dataset.addSample(label, geoCenter, *window) if windowIndex % 100 == 0: view.printPercentUpdate(windowIndex + 1, windowCount) view.printPercentFinal(windowCount) # Return return dataset
def __init__(self, sampleDatabasePath, windowGeoLength, multispectralPixelShiftValue, shiftCount, negativeRatio): self.sampleDatabase = sample_store.create(sampleDatabasePath) self.windowGeoDimensions = windowGeoLength, windowGeoLength self.multispectralPixelShiftValue = multispectralPixelShiftValue self.shiftCount = shiftCount self.negativeRatio = negativeRatio