我想用 Raspberry PI Camara 拍一些照片。这工作正常。但是在将图片保存到 PI 后,我无法加载它们……这是我加载图像的代码:
BufferedImage imgBuff = null;
try {
imgBuff = ImageIO.read(new File(saveFile + picName));
} catch (IOException e) {
e.printStackTrace();
}
PlanarImage imgPI = PlanarImage.wrapRenderedImage(imgBuff);
这里有一个例外:javax.imageio.IIOException: Can't read input file!但是图像存在......这是我如何拍照的代码:
try {
StringBuilder sb = new StringBuilder(raspistillPath);
sb.append(" -n -bm");
sb.append(" -t " + picTimeout);
sb.append(" -w " + picWidth);
sb.append(" -h " + picHeight);
sb.append(" -q " + picQuality);
sb.append(" -e " + picType);
sb.append(" -o " + saveFile + picName);
Runtime.getRuntime().exec(sb.toString());
Thread.sleep(picTimeout);
} catch (Exception e) {
System.exit(e.hashCode());
}