你好我想創造一個PROGRAMM讀取的圖像中的RGB值和後輸出的Excel,像這樣---圖像>http://www.boydevlin.co.uk/images/screenshots/eascreen04.png填充一個ArrayList與圖像的每個像素
爲了實現這一我想我已經從圖像中每個像素的RGB值讀取到一個ArrayList 我想將它保存在以下順序
例5x5px圖片
01,02,03,04,05
06,07,08,09,10
11,12,13,14,15
.......
我媒體鏈接有這一點,但它不工作出正確可能有人helpe我與algorrithm
public class Engine {
private int x = 0;
private int y = 0;
private int count = 50;
private boolean isFinished = false;
ArrayList<Color> arr = new ArrayList<Color>();
public void process(){
BufferedImage img = null;
try {
img = ImageIO.read(new File("res/images.jpg"));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
System.out.println("img file not found");
}
while(isFinished = false){
int rgb = img.getRGB(x, y);
Color c = new Color(rgb);
arr.add(c);
System.out.println("y:"+ y);
x++;}
if(x == 49){
y++;
x = 0;
}else if(x == 49 && y == 49){
isFinished = true;
}
}
};
你得到什麼錯誤? – jmrodrigg 2013-04-22 09:53:01