我想开发一个使用android相机API的应用程序。但是当我拍摄使用应用程序图像的图像变得模糊。为什么图像模糊?
图片使用谷歌的相机应用:使用
图片我的相机应用:
相机参数部分:
Camera.Parameters param;
param = camera.getParameters();
param.setFocusMode(Parameters.FOCUS_MODE_FIXED);
param.setPictureFormat(ImageFormat.JPEG);
param.setJpegQuality(100);
camera.setParameters(param);
camera.startPreview();
图片回调部分:
public void onPictureTaken(byte[] data, Camera camera) {
bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
camera.release();
preview.setVisibility(View.INVISIBLE);
image.setVisibility(View.VISIBLE);
image.setImageBitmap(bitmap);
File pictureFile = getOutputMediaFile();
if (pictureFile == null) {
Log.d("PictureCall",
"Error creating media file, check storage permissions");
return;
}
try {
FileOutputStream fos = new FileOutputStream(pictureFile);
fos.write(data);
fos.close();
} catch (FileNotFoundException e) {
Log.d("File Excep :", "File not found: " + e.getMessage());
} catch (IOException e) {
Log.d("File Excep :", "Error accessing file: " + e.getMessage());
}
}
http://stackoverflow.com/a/5163778/3330969。 – Kedarnath 2015-04-06 12:10:44
您是否正在储存预览图像? – Stan 2015-04-06 12:12:07
我已经尝试过,但它不起作用。 – patrick 2015-04-06 12:12:19