package imagetools; import java.awt.image.BufferedImage; /** * Performa wavelet transform. The equations come from Wolfram with (yep) a little form Wikipedia * @author aevens * */ public class WaveletTransform { private BufferedImage image; private double alpha = 0.707; private int count = 1; private int omega = 2; private double t; private double h; public WaveletTransform() { } public WaveletTransform(BufferedImage bi) { this.image = bi; } private void calculate(double theta) { int sigma = 2; int gamma = 2; float[] gaborpts = new float[35]; double sigma_x = sigma; double sigma_y = sigma / gamma; int nstds = 3; double xmax = Math.max(Math.abs(nstds * sigma_x * Math.cos(theta)), Math.abs(nstds * sigma_y * Math.sin(theta))); xmax = Math.ceil(Math.max(1, xmax)); double ymax = Math.max(Math.abs(nstds * sigma_x * Math.sin(theta)), Math.abs(nstds * sigma_y * Math.cos(theta))); ymax = Math.ceil(Math.max(1, ymax)); double xmin = -xmax; double ymin = -ymax; /** * double inter1=0; double inter2=0; double inter3=0; double inter4=0; * double inter5=0; double inter6=0; * * float[] gaborpts=new float[35]; * * int w=2; * * inter2=Math.pow(((-1)*alpha),(2*w)); inter5=w*3.14*Math.pow(alpha,w); * * int k=0; * * for(int i=1;i<5;i++) { for(int j=1;j<7;j++) { inter1=(Math.pow(i, * 2)+Math.pow(j, 2))/2; inter3=Math.exp((inter1*inter2)); * inter4=(i*Math.cos(theta))+(j*Math.sin(theta)); * inter6=Math.exp(inter5*inter5); * * gaborpts[k]= (float)(inter6*inter3); k++; } } */ for (int i = 0; i < gaborpts.length; i++) { System.out.println(gaborpts[i]); } } public void transform(double theta) { calculate(theta); } }