0

circle1次のメソッドを含むクラスにインポートされたパッケージであるという.bmpファイルを読み取ろうとしています。

これまでのところ、次のコードがありますが、次のコードを実行すると、次のようになります。

javax.imageio.llOException:入力ファイルを読み取れません!

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);
}
4

1 に答える 1

0

ストレートSDKClass.getResourceAsStream()では、の代わりにを使用する必要がありますFile

春に使用する場合ResourceLocator.getResource("classpath:circle1.bmp");

于 2012-10-28T00:57:26.210 に答える