miércoles, 11 de febrero de 2009

Filtro de Contraste

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

public class Filtro_Cont 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();
int a=2;
int b=50;
int c=255;
for(int i =0; i {
for(int j= 0; j {
int pixel =ip.getPixel(i,j);
pixel = (int)(pixel*a+b);
if (pixel >c)
{
pixel=c;
}
ip.putPixel(i,j,pixel);
}
}
}
}

No hay comentarios: