I'm creating a tool to capture every frame from preview using cameraX (for face recognition purpose)
I found that using ImageAnalysis was the way to go.
Until I tried using the code as recommended :
val imageAnalysisConfig = ImageAnalysisConfig.Builder()
.setTargetResolution(Size(1280, 720))
.setImageReaderMode(ImageAnalysis.ImageReaderMode.ACQUIRE_LATEST_IMAGE)
.build()
val imageAnalysis = ImageAnalysis(imageAnalysisConfig)
imageAnalysis.setAnalyzer({ image: ImageProxy, rotationDegrees: Int ->
viewModel.onAnalyzeImage(image)
})
To which I get the following compile error on setAnalyser method :
None of the following function can be called with the arguments supplied
setAnalyser((command : Runnable!) -> Unit, (image: ImageProxy!, rotationDegrees: Int) -> Unit)