如何解决Android CameraX - 手动更改曝光持续时间和 ISO和白平衡温度和色调
我在我的项目中使用 CameraX。我已经创建了预览用例和图像捕获用例。
val cameraProviderFuture = ProcessCameraProvider.getInstance(requireActivity())
cameraProviderFuture.addListener({
// Used to bind the lifecycle of cameras to the lifecycle owner
val cameraProvider: ProcessCameraProvider = cameraProviderFuture.get()
val aspectRatio = aspectRatio()
val preview = Preview.Builder()
.setTargetAspectRatio(aspectRatio)
.build()
.also {
it.setSurfaceProvider(binding.viewFinder.surfaceProvider)
}
val cameraSelector = CameraSelector.DEFAULT_BACK_CAMERA
imageCapture = ImageCapture.Builder()
.setTargetAspectRatio(aspectRatio)
.build()
try {
// Unbind use cases before rebinding
cameraProvider.unbindAll()
// Bind use cases to camera
camera = cameraProvider.bindToLifecycle(
this,cameraSelector,preview,imageCapture)
} catch(exc: Exception) {
Log.e(TAG,"Use case binding failed",exc)
}
},ContextCompat.getMainExecutor(requireActivity()))
在 CameraX 中实现曝光
ExposureState exposureState = camera.getCameraInfo().getExposureState()
if (!exposureState.isExposureCompensationSupported()) return
Range<Integer> range = exposureState.getExposureCompensationRange()
if (range.contains(index)){
camera.getCameraControl().setExposureCompensationIndex(index)}
如何在 CameraX API 中实现 ISO 和白平衡(温度和色调)?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。