for(int x = 0; x < w; x++)
{
for(int y = 0; y < h; y++)
{
int rgb = bimg.getRGB(x,y);
//byte r = (byte) ((rgb & 0x00ff0000) >> 16);
//byte g = (byte) ((rgb & 0x0000ff00) >> 8);
//byte b = (byte) (rgb & 0x000000ff);
pixels[x][y] = ((int) rgb) & 0xff;
}
}
processImage();
for(int x = 0; x < w; x++)
{
for(int y = 0; y < h; y++)
{
int rgb = (pixels[x][y] | 0xff);
bimg.setRGB(x, y, rgb);
//byte r = (byte) ((rgb & 0x00ff0000) >> 16);
//byte g = (byte) ((rgb & 0x0000ff00) >> 8);
//byte b = (byte) (rgb & 0x000000ff);
}
}
I am learning how to process image in java. I want to know if the codes above are correct in processing grayscale jpeg image?