martes, 27 de enero de 2009

HISTOGRAMA (IMPLEMENTACION EN JAVA)

import ij.*;
import ij.process.*;
import ij.gui.*;
import java.awt.*;
import ij.plugin.filter.*;

public class Histograma implements PlugInFilter
{
ImagePlus Iplus;

public int setup(String arg, ImagePlus Iplus) {
this.Iplus = Iplus;
return DOES_8G + NO_CHANGES ;
}

public void run(ImageProcessor ip)
{

int [] K = new int [256];
int d = ip.getWidth();
int e= ip.getHeight();
for (int v=0 ; v for(int c=0; c {
int i= ip.getPixel(c,v);
K[i]=K[i]+1;

}}
ImageProcessor histIp= new ByteProcessor (500,500);
histIp.setValue(255);
histIp.fill();
for( int cont=0; cont<256; cont++)
{
int i=K[cont]/75;
for(int j=0;j {
histIp.putPixel(cont, j, 0);
}
}
ImagePlus histIm=new ImagePlus (" ", histIp);
histIm.show();
histIm.updateAndDraw();

}

}

No hay comentarios: