在使用Camera2拍摄安卓系统的图像时,要获得绝对最大的曝光率和灵敏度,可以按照以下步骤进行操作:
CameraManager manager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
来获取CameraManager对象。String[] cameraIds = manager.getCameraIdList();
来获取当前设备上可用的摄像头列表。manager.openCamera(cameraId, stateCallback, null);
来打开摄像头。CaptureRequest.Builder builder = cameraDevice.createCaptureRequest(CameraDevice.TEMPLATE_PREVIEW);
来创建CaptureRequest.Builder对象。builder.set(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_OFF);
来设置曝光模式为手动模式。然后,通过调用builder.set(CaptureRequest.SENSOR_SENSITIVITY, maxSensitivity);
来设置灵敏度为最大值。cameraDevice.createCaptureSession(Arrays.asList(surface), sessionStateCallback, null);
来创建CaptureSession,并将预览Surface传递给它。session.setRepeatingRequest(builder.build(), captureCallback, null);
来设置CaptureRequest和CaptureSession。通过以上步骤,就可以在使用Camera2拍摄安卓系统的图像时获得绝对最大的曝光率和灵敏度。
领取专属 10元无门槛券
手把手带您无忧上云