android-camerax
How does CameraX library can turn ON/OFF the torch?
androidx.camera:camera-core:1.0.0-alpha10 You can check is torch available or not with this: val camera = cameraProvider.bindToLifecycle(lifecycleOwner, cameraSelector, preview, imageAnalyzer) camera.cameraInfo.hasFlashUnit() And you can enable torch with: camera.cameraControl.enableTorch(true)
Converting ImageProxy to Bitmap
You will need to check the image.format to see if it is ImageFormat.YUV_420_888. If so , then you can you use this extension to convert image to bitmap: fun Image.toBitmap(): Bitmap { val yBuffer = planes[0].buffer // Y val vuBuffer = planes[2].buffer // VU val ySize = yBuffer.remaining() val vuSize = vuBuffer.remaining() val nv21 = … Read more