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

View File

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