i'm trying to mask non-green and alpha channels from images. The following code worked for single image but when i tried working for multiple images i get a black image as output, instead of green. Can anyone help me?
Code:public class green
{
private Vector<Integer> w = null;
private Vector<Integer> h = null;
private int pixelCol;
private BufferedImage[] g=null;
public BufferedImage[] MaskNongreen(BufferedImage bi[]) // input images array
{
w = new Vector<Integer>();
h = new Vector<Integer>();
g=new BufferedImage[bi.length];
for(int i=0;i<bi.length;i++)
{
w.add(bi[i].getWidth());
h.add(bi[i].getHeight());
g[i]=new BufferedImage(w.get(i),h.get(i),bi[i].getType());
for (int x=0; x < w.size(); x++)
{
for (int y = 0; y <h.size(); y++)
{
pixelCol=bi[i].getRGB(x,y);
pixelCol &= 0x0FF00FF00; //masks nongreen and alpha
g[i].setRGB(x, y, pixelCol);
}
}
}
return g;
}
}
