3
그레이 스케일에있는 이미지가 있으면 그 위치에서 그레이 스케일의 픽셀 값을 어떻게 얻을 수 있습니까?BufferedImage - Gray Scale
이 경우 온도는 항상 -16777216
(검정색)으로 출력됩니다.
imgMazeImage = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY);
픽셀이 기본값으로 생성하고 논리적 모두 동일한 색상을 가지고 (검은 색) : 새 빈 이미지를 생성하고 클래스 변수에 할당하는
public void testMethod()
{
int width = imgMazeImage.getWidth();
int height = imgMazeImage.getHeight();
//Assign class variable as a new image with RGB formatting
imgMazeImage = new BufferedImage(width, height, BufferedImage.TYPE_BYTE_GRAY);
for(int i=0; i < width; i ++){
for(int j=0; j < height; j++)
{
//Grab and set the colors one-by-one
inttemp = imgMazeImage.getRGB(j, i);
System.out.println(temp);
}
}
}