List of usage examples for org.apache.commons.math3.analysis.function Sinc value
public DerivativeStructure value(final DerivativeStructure t)
From source file:com.thalespf.dip.DeblurringTest.java
private static Complex[] motionBlur(double[] degradation, int width, int height) { Complex[] complex = new Complex[width * height]; double[] temp = new double[2 * width * height]; for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { double teta = Math.PI * ((x - width / 2) % width * A + (y - height / 2) % height * B); Sinc sinc = new Sinc(); double real = Math.cos(teta) * sinc.value(teta) * T; double imaginary = Math.sin(teta) * sinc.value(teta) * T; Complex c = new Complex(real, imaginary); Complex cConj = c.conjugate(); temp[2 * (x + y * width)] = cConj.getReal(); temp[2 * (x + y * width) + 1] = cConj.getImaginary(); }/* w w w . j a v a 2 s. co m*/ } for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { int xTranslated = (x + width / 2) % width; int yTranslated = (y + height / 2) % height; double real = temp[2 * (yTranslated * width + xTranslated)]; double imaginary = temp[2 * (yTranslated * width + xTranslated) + 1]; degradation[2 * (x + y * width)] = real; degradation[2 * (x + y * width) + 1] = imaginary; Complex c = new Complex(real, imaginary); complex[y * width + x] = c; } } return complex; }