Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable camera auto white balancing #88

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package dk.scuffed.whiteboardapp.pipeline.stages.input_stages

import android.annotation.SuppressLint
import android.content.Context
import android.graphics.SurfaceTexture
import android.hardware.camera2.CameraMetadata
import android.hardware.camera2.CaptureRequest
import android.opengl.GLES11Ext
import android.opengl.GLES20
import android.os.Handler
import android.util.Size
import android.view.Surface
import androidx.camera.camera2.interop.Camera2Interop
import androidx.camera.core.AspectRatio.RATIO_16_9
import androidx.camera.core.CameraSelector
import androidx.camera.core.CameraSelector.LENS_FACING_BACK
Expand All @@ -26,6 +30,7 @@ import java.util.concurrent.CompletableFuture
/**
* Outputs the camera onto a OpenGL framebuffer
*/
@SuppressLint("UnsafeOptInUsageError")
internal class CameraXStage(
context: Context,
pipeline: IPipeline,
Expand Down Expand Up @@ -55,9 +60,14 @@ internal class CameraXStage(

mainThreadHandler.post {
run {
val preview = Preview.Builder()
val previewBuilder = Preview.Builder()
.setTargetAspectRatio(RATIO_16_9)
.build()


val camera2InterOp = Camera2Interop.Extender(previewBuilder)
camera2InterOp.setCaptureRequestOption(CaptureRequest.CONTROL_AWB_MODE, CameraMetadata.CONTROL_AWB_MODE_SHADE)

val preview = previewBuilder.build()

preview.setSurfaceProvider { request ->
val surface = Surface(cameraSurfaceTexture)
Expand Down