在java中读取.bmp文件时引发的LLOEXCTION
我正在尝试读取一个名为在java中读取.bmp文件时引发的LLOEXCTION,java,exception,Java,Exception,我正在尝试读取一个名为circle1的.bmp文件,它是一个已导入到包含以下方法的类中的包 到目前为止,我有以下代码,但当我运行以下代码时,我得到: javax.imageio.llOException:无法读取输入文件 public void setUp()引发IOException { //最小重叠分数>16); 绿色输入数据[x][y]=(字节)(颜色>>8); //蓝色[x][y]=(字节)(颜色); } } this.inputData=绿色inputData; System.out.
circle1
的.bmp文件,它是一个已导入到包含以下方法的类中的包
到目前为止,我有以下代码,但当我运行以下代码时,我得到:
javax.imageio.llOException:无法读取输入文件
public void setUp()引发IOException
{
//最小重叠分数>24);
//红色[x][y]=(字节)(颜色>>16);
绿色输入数据[x][y]=(字节)(颜色>>8);
//蓝色[x][y]=(字节)(颜色);
}
}
this.inputData=绿色inputData;
System.out.println(this.inputData);
}
在straight SDK中,使用是您需要的,而不是文件
如果在Spring中使用ResourceLocator.getResource(“classpath:circle1.bmp”) bmp是在jar中,还是磁盘上的文件?
public void setUp() throws IOException
{
// minimumOverlapScore < synapsesPerSegment(not yet a field)
BufferedImage image = ImageIO.read(new File("circle1.bmp"));
byte[][] greenInputData = new byte[30][40];
for (int x = 0; x < inputData.length; x++)
{
for (int y = 0; y < inputData[x].length; y++)
{
int color = image.getRGB(x, y);
//alpha[x][y] = (byte)(color>>24);
//red[x][y] = (byte)(color>>16);
greenInputData[x][y] = (byte)(color>>8);
//blue[x][y] = (byte)(color);
}
}
this.inputData = greenInputData;
System.out.println(this.inputData);
}