miércoles, 18 de febrero de 2009

histograma de filtro

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.filter.*;
public class Filter_Plugin1 implements PlugInFilter{
ImagePlus imp;
public int setup(String arg, ImagePlus imp) {
this.imp = imp;
return DOES_ALL;
}
public void run(ImageProcessor ip) {
int [ ]H=ip.getHistogram();
int w=ip.getWidth();
int h=ip.getHeight();
int k=256;
int a,b ;
for(int i=1;iH[i]=H[i-1]+H[i];
}
for(int i=0;ifor(int j=0;ja=ip.getPixel(i,j);
b=(int)(a*(k-1)/(w*h));
ip.putPixel(i,j,b);
}
}
}
}

No hay comentarios: