Example #1
0
parser = argparse.ArgumentParser(description='select image')
parser.add_argument('--imagepath', type=str)

args = parser.parse_args()

if __name__ == '__main__':
    ############################################################################
    # load the first face image
    ############################################################################
    images = Loader("", regex=args.imagepath)
    range_image = images.get_image(0, scale_factor=1)

    # plot it so we know what it looks like
    plot_image(
        range_image,
        title=f"Range Image {range_image.shape[0]}x{range_image.shape[1]}",
        cmap='gray')

    ############################################################################
    # divide up the first image into chunks
    ############################################################################
    # domain image is a 50% downsampled range image
    domain_image = images.get_image(0, scale_factor=1 / 2)

    plot_image(
        domain_image,
        title=f"Domain Image {domain_image.shape[0]}x{domain_image.shape[1]}",
        cmap='gray')

    # each block is 4x4
    domain_chunks = utils.Partition(domain_image, mode=MODE)
Example #2
0
    face = Image.open(list(facedir.glob("mandrill.jpg"))[0])
    face = np.asarray(face.getdata()).reshape(512,512)
    face = rescale(face, 0.25)
    return face


if __name__ == '__main__':
    ############################################################################
    # load images
    ############################################################################
    images = Loader(optpath="", regex="lena.jpg")
    range_image = images.get_image(0, scale_factor=SCALE)

    # plot it so we know what it looks like
    plot_image(range_image, 
        title=f"Range Image {range_image.shape[0]}x{range_image.shape[1]}",
        cmap='gray')

    ############################################################################
    # divide up the first image into chunks
    ############################################################################
    # domain image is a 50% downsampled range image
    domain_image = images.get_image(0, scale_factor=SCALE/2)

    plot_image(domain_image, 
        title=f"Domain Image {domain_image.shape[0]}x{domain_image.shape[1]}",
        cmap='gray')

    # each block is 4x4
    domain_chunks = utils.Partition(domain_image, mode=MODE)
    range_chunks = utils.Partition(range_image, mode=MODE)
    ############################################################################
    # psnr = PSNR(range_image, reconstructed_chunks.image)
    print(f"PSNR: {psnr} \t Coefficients Retained: {COMPRESSION_FACTOR}/{BLOCK_SIZE}")
    return psnr

if __name__ == '__main__':

    ############################################################################
    # load images
    ############################################################################
    images = Loader(optpath="", regex="lena.jpg")
    range_image = images.get_image(0, scale_factor=SCALE)

    # plot it so we know what it looks like
    plot_image(range_image, 
        title=f"Range Image {range_image.shape[0]}x{range_image.shape[1]}",
        cmap='gray')

    ############################################################################
    # divide up the first image into chunks
    ############################################################################
    # domain image is a 50% downsampled range image
    domain_image = images.get_image(0, scale_factor=SCALE/2)

    plot_image(domain_image, 
        title=f"Domain Image {domain_image.shape[0]}x{domain_image.shape[1]}",
        cmap='gray')

    # each block is 4x4
    domain_chunks = utils.Partition(domain_image, mode=MODE)
    range_chunks = utils.Partition(range_image, mode=MODE)
Example #4
0
    return aaronface


if __name__ == '__main__':
    print(MODE)
    print("Standard")
    ############################################################################
    # load the first face image
    ############################################################################
    images = Loader("")
    range_image = images.get_image(0, scale_factor=SCALE)
    orig = range_image

    # plot it so we know what it looks like
    plot_image(
        range_image,
        title=f"Range Image {range_image.shape[0]}x{range_image.shape[1]}",
        cmap='gray')

    ############################################################################
    # divide up the first image into chunks
    ############################################################################
    # domain image is a 50% downsampled range image
    domain_image = images.get_image(0, scale_factor=SCALE / 2)

    plot_image(
        domain_image,
        title=f"Domain Image {domain_image.shape[0]}x{domain_image.shape[1]}",
        cmap='gray')

    # each block is 4x4
    domain_chunks = utils.Partition(domain_image, mode=MODE)
Example #5
0
    facedir = Path(__file__).resolve().parent.parent / "data" / "faces"
    aaronface = Image.open(list(facedir.glob("*.pgm"))[0])
    aaronface = np.asarray(aaronface.getdata()).reshape(64, 64)
    return aaronface


if __name__ == '__main__':
    ############################################################################
    # load images
    ############################################################################
    images = Loader("")
    range_image = images.get_image(0, scale_factor=SCALE)

    # plot it so we know what it looks like
    plot_image(
        range_image,
        title=f"Range Image {range_image.shape[0]}x{range_image.shape[1]}",
        cmap='gray')

    ############################################################################
    # divide up the first image into chunks
    ############################################################################
    # domain image is a 50% downsampled range image
    domain_image = images.get_image(0, scale_factor=SCALE / 2)

    plot_image(
        domain_image,
        title=f"Domain Image {domain_image.shape[0]}x{domain_image.shape[1]}",
        cmap='gray')

    # each block is 4x4
    domain_chunks = utils.Partition(domain_image, mode=MODE)
from fractal.coding import encode, decode
import copy
from skimage.transform import rescale
import pandas as pd
import numpy as np

if __name__ == '__main__':
    ############################################################################
    # load the first face image
    ############################################################################
    images = Loader("")
    range_image = images.get_image(0, scale_factor=0.25)

    # plot it so we know what it looks like
    plot_image(
        range_image,
        title=f"Range Image {range_image.shape[0]}x{range_image.shape[1]}",
        cmap='gray')

    ############################################################################
    # divide up the first image into chunks
    ############################################################################
    # domain image is a 50% downsampled range image
    # domain_image = images.get_image(0, scale_factor=0.125)
    domain_image = np.zeros([128, 128])

    plot_image(
        domain_image,
        title=f"Domain Image {domain_image.shape[0]}x{domain_image.shape[1]}",
        cmap='gray')

    # each block is 4x4