保存图像后有绿色调。表面支架上的预览图像看起来很正常。我该怎么做才能删除它?
mCamera.setPreviewCallback(new Camera.PreviewCallback() {
@Override
public void onPreviewFrame(byte[] data, Camera camera) {
try {
if (saveImg) {
int width = parameters.getPreviewSize().width;
int height = parameters.getPreviewSize().height;
YuvImage yuv = new YuvImage(data, parameters.getPreviewFormat(), width, height, null);
ByteArrayOutputStream out = new ByteArrayOutputStream();
yuv.compressToJpeg(new Rect(0, 0, width, height), 100, out);
byte[] bytes = out.toByteArray();
final Bitmap bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.length);
File file = new File(Environment.getExternalStorageDirectory() + "/newimage.png");
ByteArrayOutputStream os = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, os);
byte[] blobArray = os.toByteArray();
FileOutputStream fos = new FileOutputStream(file);
fos.write(blobArray);
fos.close();
答案 0 :(得分:0)
我最终为白平衡设置此值以删除绿色:
parameters.set("whitebalance", WHITE_BALANCE_FLUORESCENT);
mCamera.setParameters(parameters);