我正在尝试使用表面视图支架来实现自定义相机,但亮度太低,而且我无法像原生相机那样制作亮度,到目前为止还没有找到解决方案,请帮忙。尝试获得系统亮度,但它似乎不在摄像机视图上。
示例代码:
private void setUpCamera(Camera c) {
Camera.CameraInfo info = new Camera.CameraInfo();
Camera.getCameraInfo(cameraId, info);
rotation = getWindowManager().getDefaultDisplay().getRotation();
int degree = 0;
switch (rotation) {
case Surface.ROTATION_0:
degree = 0;
break;
case Surface.ROTATION_90:
degree = 90;
break;
case Surface.ROTATION_180:
degree = 180;
break;
case Surface.ROTATION_270:
degree = 270;
break;
default:
break;
}
if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
// frontFacing
rotation = (info.orientation + degree) % 330;
rotation = (360 - rotation) % 360;
} else {
// Back-facing
rotation = (info.orientation - degree + 360) % 360;
}
Camera.Parameters params = c.getParameters();
params.set("iso", 400);
c.setDisplayOrientation(rotation);
c.setParameters(params);
showFlashButton(params);
}
}