def main(inImageFileName, outDirName, scale): inImage = SRImage() inImage.openFromFile(inImageFileName) inImageSize = inImage.w, inImage.h print('Input image size: %dx%d' % inImageSize) mkdirOutput(outDirName) createSamples(inImage, outDirName, scale)
def createSamples(image, outDirectory, scale): camera = Camera.Camera(cfg['psf']) downscale = 1.0 / scale # TODO move it somewhere offsets = [[0,0], [1,0], [2,0], [0,1], [1,1], [2,1], [0,2], [1,2], [2,2]] for (x, y) in offsets: sampleFileName = '%s/S_%d_%d.tif' % (outDirectory, x, y) sample = SRImage() sample.openFromLibImg(camera.take(image.toLibImgType(), (x, y), downscale)) sample.save(sampleFileName)
def createSamples(image, outDirectory, scale): camera = Camera.Camera(cfg['psf']) downscale = 1.0 / scale # TODO move it somewhere offsets = [[0, 0], [1, 0], [2, 0], [0, 1], [1, 1], [2, 1], [0, 2], [1, 2], [2, 2]] for (x, y) in offsets: sampleFileName = '%s/S_%d_%d.tif' % (outDirectory, x, y) sample = SRImage() sample.openFromLibImg( camera.take(image.toLibImgType(), (x, y), downscale)) sample.save(sampleFileName)
def main(inImageFileName, outDirName, scale): inImage = SRImage() inImage.openFromFile(inImageFileName) os.makedirs(outDirName, exist_ok = True) createSamples(inImage, outDirName, scale)
def main(inImageFileName, outDirName, scale): inImage = SRImage() inImage.openFromFile(inImageFileName) os.makedirs(outDirName, exist_ok=True) createSamples(inImage, outDirName, scale)
print("\t\t\tdefault: sampleDirectory in srconfig.py") print("") print("Note: be sure to run the script with Python3 interpreter.") def parseCmdArgs(arguments, config): inImageFileName = arguments[1] outDirName = config['inputImageDirectory'] if (len(arguments) == 3): outDirName = arguments[2] return inImageFileName, outDirName if __name__ == "__main__": if 2 > len(sys.argv) > 3: showHelp(); sys.exit(0) inImageFileName, outDirName = parseCmdArgs(sys.argv, cfg) inImage = SRImage() inImage.openFromFile(inImageFileName) inImageSize = inImage.w, inImage.h print('Input image size: %dx%d' % inImageSize) mkdirOutput(outDirName) createSamples(inImage, outDirName)