jueves, 26 de febrero de 2009

Filtro para Umbralizar Imagenes

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

public class Umbra implements PlugInFilter
{
ImagePlus imp;

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

public void run(ImageProcessor ip)
{
int f=ip.getWidth();
int c=ip.getHeight();
for(int x =0; x
{
for(int y= 0; y
{
int pixel =ip.getPixel(x,y);

if (pixel <40){
pixel=0;
}else if(pixel>=40){
pixel=255;
}
ip.putPixel(x,y,pixel);
}
}
}
}

No hay comentarios: