From fad6802ed764f73a6c9b33969c4a2c156545ce50 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Nicolas <6371790+pynicolas@users.noreply.github.com> Date: Sat, 26 Jul 2025 15:52:27 +0200 Subject: [PATCH] Postprocessing: resize earlier to: - make later steps independent of original image size - save performance on later steps --- app/src/main/java/org/mydomain/myscan/DocumentDetection.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/mydomain/myscan/DocumentDetection.kt b/app/src/main/java/org/mydomain/myscan/DocumentDetection.kt index 7bae2ac..c8ae17f 100644 --- a/app/src/main/java/org/mydomain/myscan/DocumentDetection.kt +++ b/app/src/main/java/org/mydomain/myscan/DocumentDetection.kt @@ -98,11 +98,11 @@ fun extractDocument(originalBitmap: Bitmap, quad: Quad, rotationDegrees: Int): B val outputSize = Size(targetWidth.toDouble(), targetHeight.toDouble()) Imgproc.warpPerspective(inputMat, outputMat, transform, outputSize) - val enhanced = enhanceCapturedImage(outputMat) + val resized = resize(outputMat, 1500.0) + val enhanced = enhanceCapturedImage(resized) val rotated = rotate(enhanced, rotationDegrees) - val resized = resize(rotated, 1500.0) - return toBitmap(resized) + return toBitmap(rotated) } fun resize(original: Mat, targetMax: Double): Mat {