react-native-rectangle-doc-scanner 13.4.0 → 13.5.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.
|
@@ -210,8 +210,10 @@ class DocumentDetector {
|
|
|
210
210
|
|
|
211
211
|
val median = computeMedian(blurredMat)
|
|
212
212
|
val sigma = 0.33
|
|
213
|
-
|
|
214
|
-
|
|
213
|
+
// Increased thresholds for high-res (1280x960) to reduce noise
|
|
214
|
+
// This makes edge detection less sensitive, focusing on strong edges only
|
|
215
|
+
val cannyLow = max(50.0, (1.0 - sigma) * median).coerceAtLeast(100.0)
|
|
216
|
+
val cannyHigh = max(150.0, (1.0 + sigma) * median).coerceAtLeast(200.0)
|
|
215
217
|
|
|
216
218
|
// Apply Canny edge detection with adaptive thresholds for better corner detection.
|
|
217
219
|
Imgproc.Canny(blurredMat, cannyMat, cannyLow, cannyHigh)
|
|
@@ -437,20 +439,20 @@ class DocumentDetector {
|
|
|
437
439
|
return false
|
|
438
440
|
}
|
|
439
441
|
|
|
442
|
+
// TEMPORARILY DISABLED: Enhanced filters were too strict
|
|
443
|
+
// TODO: Re-enable with more lenient thresholds after testing
|
|
444
|
+
/*
|
|
440
445
|
// Enhanced validation: Check corner angles (should be close to 90°)
|
|
441
|
-
// Made more lenient: 50°-130° (was 60°-120°)
|
|
442
446
|
if (!hasValidCornerAngles(rectangle)) {
|
|
443
447
|
return false
|
|
444
448
|
}
|
|
445
449
|
|
|
446
450
|
// Enhanced validation: Check edge straightness
|
|
447
|
-
// Made more lenient: 20° tolerance (was 15°)
|
|
448
451
|
if (!hasValidEdgeStraightness(rectangle, srcMat)) {
|
|
449
452
|
return false
|
|
450
453
|
}
|
|
451
454
|
|
|
452
455
|
// Enhanced validation: Check margin from view edges (avoid detecting screen borders)
|
|
453
|
-
// Made more lenient: 3% margin (was 5%)
|
|
454
456
|
val margin = minDim * 0.03
|
|
455
457
|
if (rectangle.topLeft.x < margin || rectangle.topLeft.y < margin ||
|
|
456
458
|
rectangle.topRight.x > srcMat.cols() - margin || rectangle.topRight.y < margin ||
|
|
@@ -458,6 +460,7 @@ class DocumentDetector {
|
|
|
458
460
|
rectangle.bottomRight.x > srcMat.cols() - margin || rectangle.bottomRight.y > srcMat.rows() - margin) {
|
|
459
461
|
return false
|
|
460
462
|
}
|
|
463
|
+
*/
|
|
461
464
|
|
|
462
465
|
return true
|
|
463
466
|
}
|