jueves, 26 de febrero de 2009

Umbralización

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

public class Filtro_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 i =0; i< f; i++)
{
for(int j= 0; j< c; j++)
{
int pixel =ip.getPixel(x,y);

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

No hay comentarios: