Java mean meanImage(float[][]... images)

Here you can find the source of meanImage(float[][]... images)

Description

Calculates the mean of multiple images through each pixel

License

Open Source License

Parameter

Parameter Description
images array of images to take the mean of

Return

mean image

Declaration

public static float[][] meanImage(float[][]... images) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    /**//from w  ww .  ja  va 2 s .co m
     * Calculates the mean of multiple images through each pixel
     * @param images array of images to take the mean of
     * @return mean image
     */
    public static float[][] meanImage(float[][]... images) {
        int count = images.length;
        float[][] mean_float_mat = new float[images[0].length][images[0][0].length];
        for (int i = 0; i < images[0].length; i++) {
            for (int j = 0; j < images[0][0].length; j++) {
                float sum = 0;
                for (float[][] float_mat : images) {
                    sum += float_mat[i][j];
                }
                mean_float_mat[i][j] = sum / count;
            }
        }

        return mean_float_mat;
    }
}

Related

  1. meandiff(double[] v1, double[] v2)
  2. meanEnt(double[] nums)
  3. meanFast(final double[] values)
  4. meanFilter(float[] weights, int context)
  5. meanGreenwichSideralTime(double t)
  6. meanLow(final int a, final int b)
  7. means(double[][] input)
  8. meanSlow(final double[] values)
  9. meanSml(final int a, final int b)