Bildverarbeitung_Lausen/Code/plugins/Laplace_2018_11_07.java

38 lines
857 B
Java
Raw Normal View History

2018-11-15 14:47:47 +01:00
import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.filter.*;
public class Laplace_2018_11_07 implements PlugInFilter {
ImagePlus imp;
public int setup(String arg, ImagePlus imp) {
this.imp = imp;
return DOES_ALL;
}
public void run(ImageProcessor ip) {
int width = ip.getWidth();
int height = ip.getHeight();
ImageProcessor copy = ip.duplicate();
int[][] L ={{1,1,1},{1,-8,1},{1,1,1}};
for(int m = 1; m < width - 1; m++) {
for(int n = 1; n < height - 1; n++) {
int p = 0;
for(int i = -1; i <= 1; i++) {
for(int j = -1; j <= 1; j++) {
int I = copy.getPixel(m-i,n-j);
p += I * L[i+1][j+1];
}
}
p = p*10 + 128; // Irgendein Faktor
ip.putPixel(m,n,p);
}
}
}
}