Postprocessing: resize earlier to:

- make later steps independent of original image size
- save performance on later steps
This commit is contained in:
Pierre-Yves Nicolas
2025-07-26 15:52:27 +02:00
parent 1784c2abea
commit fad6802ed7

View File

@@ -98,11 +98,11 @@ fun extractDocument(originalBitmap: Bitmap, quad: Quad, rotationDegrees: Int): B
val outputSize = Size(targetWidth.toDouble(), targetHeight.toDouble()) val outputSize = Size(targetWidth.toDouble(), targetHeight.toDouble())
Imgproc.warpPerspective(inputMat, outputMat, transform, outputSize) 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 rotated = rotate(enhanced, rotationDegrees)
val resized = resize(rotated, 1500.0)
return toBitmap(resized) return toBitmap(rotated)
} }
fun resize(original: Mat, targetMax: Double): Mat { fun resize(original: Mat, targetMax: Double): Mat {