Here you can find the source of meanImage(float[][]... images)
Parameter | Description |
---|---|
images | array of images to take the mean of |
public static float[][] meanImage(float[][]... images)
//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; } }