嗨我们如何识别空白图像(白色图像),
BufferReaderImage im = ImageIO.read("samplePath");
我传递的图像是空的,有一些高度和宽度,我想识别它
答案 0 :(得分:0)
此链接可帮助您入门:
Get RGB values of a BufferedImage
特别是,这是相关部分:
BufferedImage image = ImageIO.read(
new URL("http://upload.wikimedia.org/wikipedia/en/2/24/Lenna.png"));
int w = image.getWidth();
int h = image.getHeight();
int[] dataBuffInt = image.getRGB(0, 0, w, h, null, 0, w);
Color c = new Color(dataBuffInt[100]);
System.out.println(c.getRed()); // = (dataBuffInt[100] >> 16) & 0xFF
System.out.println(c.getGreen()); // = (dataBuffInt[100] >> 8) & 0xFF
System.out.println(c.getBlue()); // = (dataBuffInt[100] >> 0) & 0xFF
System.out.println(c.getAlpha()); // = (dataBuffInt[100] >> 24) & 0xFF
然后浏览所有条目并确保有一些不同的值。