react-native-rectangle-doc-scanner 3.235.0 → 3.236.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.
|
@@ -138,7 +138,7 @@ class DocumentDetector {
|
|
|
138
138
|
// Find the largest contour that approximates to a quadrilateral
|
|
139
139
|
var largestRectangle: Rectangle? = null
|
|
140
140
|
var largestArea = 0.0
|
|
141
|
-
val minArea = max(
|
|
141
|
+
val minArea = max(600.0, (srcMat.rows() * srcMat.cols()) * 0.001)
|
|
142
142
|
|
|
143
143
|
for (contour in contours) {
|
|
144
144
|
val contourArea = Imgproc.contourArea(contour)
|
|
@@ -242,7 +242,7 @@ class DocumentDetector {
|
|
|
242
242
|
}
|
|
243
243
|
|
|
244
244
|
val minDim = kotlin.math.min(viewWidth.toDouble(), viewHeight.toDouble())
|
|
245
|
-
val angleThreshold = max(
|
|
245
|
+
val angleThreshold = max(40.0, minDim * 0.06)
|
|
246
246
|
|
|
247
247
|
val topYDiff = abs(rectangle.topRight.y - rectangle.topLeft.y)
|
|
248
248
|
val bottomYDiff = abs(rectangle.bottomLeft.y - rectangle.bottomRight.y)
|
|
@@ -253,7 +253,7 @@ class DocumentDetector {
|
|
|
253
253
|
return RectangleQuality.BAD_ANGLE
|
|
254
254
|
}
|
|
255
255
|
|
|
256
|
-
val margin = max(
|
|
256
|
+
val margin = max(80.0, minDim * 0.08)
|
|
257
257
|
if (rectangle.topLeft.y > margin ||
|
|
258
258
|
rectangle.topRight.y > margin ||
|
|
259
259
|
rectangle.bottomLeft.y < (viewHeight - margin) ||
|
package/package.json
CHANGED