V. quick image processing question

Could anybody give me a method to calculate a gausian matrix / kernal of unknown width, height and standard deviation Please.

publicdouble[][] gauss(int w,int h,int sd)

Could anybody give me a method to calculate a lapacian matrix / kernal of unknown width, height and standard deviation Please.

publicdouble[][] laplace(int w,int h,int sd)

[701 byte] By [bamkin-ov-lestaa] at [2007-9-29 19:53:58]
# 1
The gaussian and laplacians are seperable so you usually do not need to general a full 2D kernelyou normally only need to create two 1D kernels that can be applied seperatly.matfud
matfuda at 2007-7-15 21:52:06 > top of Java-index,Other Topics,Algorithms...
# 2
I only need to know how to calculate a gaussian and laplacian kernals. Thank you NEway
bamkin-ov-lestaa at 2007-7-15 21:52:06 > top of Java-index,Other Topics,Algorithms...
# 3
> I only need to know how to calculate a gaussian and> laplacian kernals. Thank you NEwayYou want someone to write a method to compute gaussiankernel tables of arbitrary size for you for 4 duke dollars.Good luck :)
ectosphenoa at 2007-7-15 21:52:06 > top of Java-index,Other Topics,Algorithms...
# 4

public class Kernels {

public static void main(String[] args) {

double[][] result = gauss(41,41,5.0);

printKernel(result);

}

public static void printKernel(double[][] k) {

for(int j=0;j<k.length;j++) {

for(int i=0;i<k[j].length;i++) {

System.out.print(k[j][i]+",");

}

System.out.println();

}

}

// produces a 2D gaussian kernel with a unit height.

public static double[][] gauss(int w, int h, double sd) {

double[][] result = new double[h][w];

if(((w%2)==0) || ((h%2)==0)) throw new IllegalArgumentException("w and h must be odd numbers");

if((w><1)||(h<1)) throw new IllegalArgumentException("w and h must be greater then or equal to

1");

int cx = (w/2);

int cy = (h/2);

for( int j=0;j<h;j++) {

for(int i=0;i<w;i++) {

double r=Math.sqrt(((cx-i)*(cx-i))+((cy-j)*(cy-j)));

result[j][i] = Math.pow(Math.E,-((r*r)/(2.0*(sd*sd))));

}

}

return result;

}

}

Now its up to you to write the laplacien as I cannot be arsed to.

The above is not particularly useful as you normally want a 2D gaussian with a unit volume rather then

a unit height as the one above gives. I just cant remember the scaling factor.

matfud>

matfuda at 2007-7-15 21:52:06 > top of Java-index,Other Topics,Algorithms...
# 5
Thank you
bamkin-ov-lestaa at 2007-7-15 21:52:06 > top of Java-index,Other Topics,Algorithms...
# 6

> > I only need to know how to calculate a gaussian and

> > laplacian kernals. Thank you NEway

>

> You want someone to write a method to compute

> gaussian

> kernel tables of arbitrary size for you for 4 duke

> dollars.

>

> Good luck :)

Just another example of someone passing up the opportunity of challenge and becoming more dependent in the process.

rkippena at 2007-7-15 21:52:06 > top of Java-index,Other Topics,Algorithms...
# 7
Bullshit. I have adapted and wrote many image processing algorithms and was not happy myself about using somebody elses adaption but i am no genius when it comes to pure math / algerbra and did not understand some symbols that Gauss used so i am going to backward-engineer his method.
bamkin-ov-lestaa at 2007-7-15 21:52:06 > top of Java-index,Other Topics,Algorithms...