Reputation: 29
I want to get the white balancing value at runtime while the user opens the camera. I want to show user some message if the current white balance value is not in some specified range.
Upvotes: 2
Views: 557
Reputation: 773
Create a CameraCaptureSession.CaptureCallback callback and implement its function like
private val captureCallbackListener: CameraCaptureSession.CaptureCallback =
object : CameraCaptureSession.CaptureCallback() {
override fun onCaptureStarted(..){}
override fun onCaptureProgressed(..){}
override fun onCaptureCompleted(
session: CameraCaptureSession,
request: CaptureRequest,
result: TotalCaptureResult
) {
Log.d(TAG, "onCaptureCompleted White Balance: ${result.get(CaptureResult.COLOR_CORRECTION_MODE)} and ${result.get(CaptureResult.COLOR_CORRECTION_GAINS)} and ${result.get(CaptureResult.COLOR_CORRECTION_TRANSFORM)}")
}
}
These logs above will provide you all info related to White Balance. Pass this callback while creating camera preview in cameraCaptureSessions!!.setRepeatingRequest as
cameraCaptureSessions!!.setRepeatingRequest(
captureRequestBuilder!!.build(),
captureCallbackListener,
mBackgroundHandler
)
Upvotes: 1