comp-vision-group-cw / src / main / java / uk / ac / soton / ecs / zmk1g19 / Main.java
Main.java
Raw
package uk.ac.soton.ecs.zmk1g19;

import org.openimaj.image.FImage;
import org.openimaj.image.processing.convolution.FConvolution;

public class Main {

    public static void main(String[] args) {
        float[][] kernel = {{0, 0, (float) (1/Math.sqrt(5))},
                {(float) (1/Math.sqrt(5)), (float) (1/Math.sqrt(5)), (float) (1/Math.sqrt(5))},
                {0, (float) (1/Math.sqrt(5)), 0}};

        float[][] image =
                {{0, 0, 0, 0, 0},
                        {0, 0, 1, 0, 0},
                        {0, 1, 1, 1, 0},
                        {0, 1, 0, 0, 0},
                        {0, 0, 0, 0, 0}};
        FConvolution convolution = new FConvolution(kernel);
        FImage image2 = new FImage(image);
        convolution.processImage(image2);
        System.out.println(image2);
        System.out.println(image2.pixels);

    }

}