react-native-rectangle-doc-scanner 3.243.0 → 3.244.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -368,6 +368,8 @@ class CameraController(
|
|
|
368
368
|
|
|
369
369
|
private fun analyzeImage(image: Image) {
|
|
370
370
|
val rotationDegrees = computeRotationDegrees()
|
|
371
|
+
val imageWidth = image.width
|
|
372
|
+
val imageHeight = image.height
|
|
371
373
|
val inputImage = try {
|
|
372
374
|
InputImage.fromMediaImage(image, rotationDegrees)
|
|
373
375
|
} catch (e: Exception) {
|
|
@@ -390,15 +392,19 @@ class CameraController(
|
|
|
390
392
|
else -> boxToRectangle(mlBox)
|
|
391
393
|
}
|
|
392
394
|
|
|
393
|
-
val frameWidth = if (rotationDegrees == 90 || rotationDegrees == 270)
|
|
394
|
-
val frameHeight = if (rotationDegrees == 90 || rotationDegrees == 270)
|
|
395
|
+
val frameWidth = if (rotationDegrees == 90 || rotationDegrees == 270) imageHeight else imageWidth
|
|
396
|
+
val frameHeight = if (rotationDegrees == 90 || rotationDegrees == 270) imageWidth else imageHeight
|
|
395
397
|
onFrameAnalyzed?.invoke(smoothRectangle(rectangle), frameWidth, frameHeight)
|
|
396
398
|
}
|
|
397
399
|
.addOnFailureListener { e ->
|
|
398
400
|
Log.e(TAG, "[CAMERA2] ML Kit detection failed", e)
|
|
399
401
|
}
|
|
400
402
|
.addOnCompleteListener {
|
|
401
|
-
|
|
403
|
+
try {
|
|
404
|
+
image.close()
|
|
405
|
+
} catch (e: Exception) {
|
|
406
|
+
Log.w(TAG, "[CAMERA2] Failed to close image", e)
|
|
407
|
+
}
|
|
402
408
|
analysisInFlight.set(false)
|
|
403
409
|
}
|
|
404
410
|
}
|
package/package.json
CHANGED