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)