I’m am trying to read a .bmp file called circle1 that in is a package that has been imported to the class that contains the following method.
So far I have the following code, but when I run the following code I get:
javax.imageio.llOException: Can’t read input file!
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);
}
In straight SDK using
Class.getResourceAsStream()is what you need instead ofFile.If in Spring use
ResourceLocator.getResource("classpath:circle1.bmp");