Example – performing Gaussian Pyramid operation on an input.

Original: 512x384
Step 1 256x192
Step 2 128x96
Step 3 64x48
Step 4 32x24
Step 5 16x12
Step 6 8x6
Step 7 4x3
Step 8 2x2

 
First 3 levels of pyramid output:

Source code:


/*
 * Copyright (c) 2016 Emphysic LLC.  All rights reserved.
 */

package com.emphysic.myriad.core.examples;

import com.emphysic.myriad.core.data.io.Dataset;
import com.emphysic.myriad.core.data.ops.GaussianPyramidOperation;
import com.emphysic.myriad.core.data.util.FileSniffer;

import java.io.File;
import java.net.URL;

/**
 * Demonstrates usage of the Gaussian Pyramid operation
 * Created by ccoughlin on 9/9/16.
 */
public class GaussianPyramid {
    public static void main(String[] args) throws Exception {
        URL sampleImageUrl = Thread.currentThread().getContextClassLoader().getResource("data/io/test.jpg");
        File inputFile = new File(sampleImageUrl.getPath());
        Dataset input = FileSniffer.read(inputFile, true);
        System.out.println("Original: " + input.getWidth() + "x" + input.getHeight());
        GaussianPyramidOperation po = new GaussianPyramidOperation();
        Dataset res = new Dataset(input);
        int pstep = 1;
        while ((res = po.run(res)) != null) {
            System.out.println("Step " + pstep + " " + res.getWidth() + "x" + res.getHeight());
            res.write("pyramid_step" + pstep + ".txt");
            pstep++;
        }
    }
}