We want to take a picture on a Pepper Robot and save it (somehow) -> The first idea is to compress to .jpg file.
TakePicture action is taken from QISDK tutorial, then we create the File as given below:
File file = new File("image.jpg");
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
try {
FileOutputStream out = new FileOutputStream(file);
getPicture().compress(Bitmap.CompressFormat.JPEG, 100, out);
// getPicture() is The Bitmap we get from TakePicture Action.
Log.i("COMPRESSED", "SUCCES");
out.close();
} catch (IOException e) {
Log.i("COMPRESSED", "FAIL");
e.printStackTrace();
}
But the code throws exception IOException Read-only file system. That means, that the Robot environment prevents from creating/writing files, which I believe is for the safety reasons. But the picture in Bitmap format is not what we want.
Is there any possible work-around or solutions to this problem?
new File("image.jpg");That can not work. You cannot use a file name only. You need to supply a full path. - blackapps