このカラーイメージを白黒に変換したいだけですが、これを行う方法はわかりません。私はちょうどピクセルを取得する方法を知っています。手伝って頂けますか?イメージをJavaの白黒(グレースケール)カラーに変換する方法
private BufferedImage image;
private int[][]rgbValue;
public void setRgbValue(BufferedImage image){
int width = image.getWidth();
int height = image.getHeight();
rgbValue = new int[width*height][3];
int counter = 0;
for(int i=0 ; i<width ; i++){
for(int j=0 ; j<height ; j++){
int color = image.getRGB(i, j);
int red = (color & 0x00ff0000) >> 16;
int green = (color & 0x0000ff00) >> 8;
int blue = (color & 0x000000ff);
rgbValue[counter][0] = red;
rgbValue[counter][1] = green;
rgbValue[counter][2] = blue;
counter++;
}
}
}
このコードと組み合わせるにはどうすればよいですか?
temp = red;
red = green;
green = blue;
blue = temp;
temp = 0;
rgb[i] = ((red << 16)) + ((green << 8)) + (blue);
if(rgb[i] <= 0x670000){
rgb[i] = 0x000000;
} else {
rgb[i] = 0xffffff;
}
OPは、私は、このスタックの項目にいくつかの方法を欠場した場合、それはその私がその日に世界大戦2は兵士であること逃すようなことかもしれウェブブラウザ –