Here you can find the source of gaussian(int size, double sigma)
public static float[] gaussian(int size, double sigma)
//package com.java2s; /*// ww w . j a v a 2s . c o m * Copyright (C) 2011 Ren? Jeschke <rene_jeschke@yahoo.de> * See LICENSE.txt for licensing information. */ public class Main { public static float[] gaussian(int size, double sigma) { final float[] g = new float[size]; final int s2 = size / 2; float sum = 0; for (int i = 0; i < size; i++) { final double x = (double) (i - s2) / (double) s2; final float v = (float) Math.exp(-(x * x) / (2.0 * sigma * sigma)); sum += v; g[i] = v; } for (int i = 0; i < size; i++) g[i] /= sum; return g; } }