fix: Correctly set video size/aspect ratio for Image Analysis (Frame Processor) (#453)

This commit is contained in:
Andrés Guerrero 2021-09-24 12:01:45 +02:00 committed by GitHub
parent e99da26561
commit 98f58367d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -367,6 +367,7 @@ class CameraView(context: Context, private val frameProcessorThread: ExecutorSer
previewBuilder.setTargetAspectRatio(aspectRatio)
imageCaptureBuilder.setTargetAspectRatio(aspectRatio)
videoCaptureBuilder.setTargetAspectRatio(aspectRatio)
imageAnalysisBuilder.setTargetAspectRatio(aspectRatio)
} else {
// User has selected a custom format={}. Use that
val format = DeviceFormat(format!!)
@ -374,6 +375,7 @@ class CameraView(context: Context, private val frameProcessorThread: ExecutorSer
previewBuilder.setTargetResolution(format.videoSize)
imageCaptureBuilder.setTargetResolution(format.photoSize)
videoCaptureBuilder.setTargetResolution(format.videoSize)
imageAnalysisBuilder.setTargetResolution(format.videoSize)
fps?.let { fps ->
if (format.frameRateRanges.any { it.contains(fps) }) {