Java - OBTENER DATOS (RGB) DE UNA IMAGEN

 
Vista:

OBTENER DATOS (RGB) DE UNA IMAGEN

Publicado por lilu (112 intervenciones) el 09/01/2007 23:30:03
Buenas noches, estoy intentando realizar un programita que obtenga de una imagen .bmp los valores (en números) de sus componentes RGB y guardarlos en un arreglo de bytes o de enteros, tengo este programita:

public class ObtenerDatosImagen {
static int[] losBytes;
public static void main(String[] args) throws Exception{
int r, g, b, x, y, i=0;
int ancho,alto,tamaño;
ColorModel color;
File textura = new File("pared.bmp");
if(!textura.exists()) {
System.err.println("Foto no encontrada");
System.exit(1);
}
final BufferedImage bi = ImageIO.read(textura);
final BufferedImage bfi = new BufferedImage(bi.getWidth(),bi.getHeight(),BufferedImage.TYPE_INT_RGB);
Graphics2D big = bfi.createGraphics();
big.drawImage(bi, 0, 0, new ObtenerDatosImagen());

ancho = bi.getWidth();
alto = bi.getHeight();
tamaño = ancho*alto*3;
losBytes = new int[tamaño];
color = bfi.getColorModel();

for(x=0; x<ancho; x++){
for(y=0; y<alto; y++){
r = color.getRed(bfi.getRGB(x,y));
losBytes[i]=r;
g = color.getGreen(bfi.getRGB(x,y));
losBytes[i+1]=g;
b = color.getBlue(bfi.getRGB(x,y));
losBytes[i+2]=b;
i+=3;
}
}
}
}
Me sale este error: cannot find symbol
symbol : method drawImage(java.awt.image.BufferedImage,int,int,ObtenerDatosImagen)
location: class java.awt.Graphics2D
big.drawImage(bi, 0, 0, new ObtenerDatosImagen());

PORQUE ME SALE ESTE ERROR?.... y aprovechando la pregunta, no tendrán este programita por allí o mejor dicho, alguien me lo puede facilitar por favor si lo tiene, es que estoy full y necesito apurarme con esto……

POR FAVOR Y GRACIAS!!!!
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder