Here is the code for extract RGb values from a single image.... and now i need to read set of images from a folder , can anyone pls give me idea for that since im very new to java ,,thanks in advance :)
import java.io.*;
import java.awt.*;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
public class GetPixelColor
{
public static void main(String args[]) throws IOException{
File file= new File("lena.jpg");
BufferedImage image = ImageIO.read(file);
int i,j;
int w=800;
int h=800;
int [][] red=new int [h][w];
int [][] green=new int [h][w];
int [][] blue=new int [h][w];
0
for( i=0;i<w;i++)
{
for( j=0;j<h;j++)
{
int clr= image.getRGB(i,j);
red[i][j] = (clr & 0x00ff0000) >> 16;
green[i][j] = (clr & 0x0000ff00) >> 8;
blue [i][j]= clr & 0x000000ff;
}
}
for(i=0;i<w;i++){
for(j=0;j<h;j++)
{
System.out.println("Red Color value = "+ red[i][j]);
System.out.println("Green Color value = "+ green[i][j]);
System.out.println("Blue Color value = "+ blue[i][j]);
}
}
}
}