Skip to content

Commit fad6802

Browse files
committed
Postprocessing: resize earlier to:
- make later steps independent of original image size - save performance on later steps
1 parent 1784c2a commit fad6802

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

app/src/main/java/org/mydomain/myscan/DocumentDetection.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ fun extractDocument(originalBitmap: Bitmap, quad: Quad, rotationDegrees: Int): B
9898
val outputSize = Size(targetWidth.toDouble(), targetHeight.toDouble())
9999
Imgproc.warpPerspective(inputMat, outputMat, transform, outputSize)
100100

101-
val enhanced = enhanceCapturedImage(outputMat)
101+
val resized = resize(outputMat, 1500.0)
102+
val enhanced = enhanceCapturedImage(resized)
102103
val rotated = rotate(enhanced, rotationDegrees)
103-
val resized = resize(rotated, 1500.0)
104104

105-
return toBitmap(resized)
105+
return toBitmap(rotated)
106106
}
107107

108108
fun resize(original: Mat, targetMax: Double): Mat {

0 commit comments

Comments
 (0)