Java: obtenha o RGBA de uma imagem em buffer como uma matriz de número inteiro
Dado um arquivo de imagem, digamos, no formato PNG, como obter uma matriz de int [r, g, b, a] representando o pixel localizado na linha i, coluna j?
Até agora estou começando aqui:
private static int[][][] getPixels(BufferedImage image) {
final byte[] pixels = ((DataBufferByte) image.getRaster().getDataBuffer()).getData();
final int width = image.getWidth();
final int height = image.getHeight();
int[][][] result = new int[height][width][4];
// SOLUTION GOES HERE....
}
Desde já, obrigado!