react-native-rectangle-doc-scanner 0.32.0 → 0.33.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.
@@ -184,7 +184,10 @@ const DocScanner = ({ onCapture, overlayColor = '#e7a649', autoCapture = true, m
184
184
  reportStage(step);
185
185
  const { value: area } = react_native_fast_opencv_1.OpenCV.invoke('contourArea', contour, false);
186
186
  // Skip extremely small contours, but keep threshold very low to allow distant documents
187
- if (area < 200) {
187
+ if (typeof area !== 'number' || !isFinite(area)) {
188
+ continue;
189
+ }
190
+ if (area < 50) {
188
191
  continue;
189
192
  }
190
193
  step = `contour_${i}_area`; // ratio stage
@@ -193,7 +196,7 @@ const DocScanner = ({ onCapture, overlayColor = '#e7a649', autoCapture = true, m
193
196
  if (__DEV__) {
194
197
  console.log('[DocScanner] area', area, 'ratio', areaRatio);
195
198
  }
196
- if (areaRatio < 0.00002 || areaRatio > 0.99) {
199
+ if (areaRatio < 0.000005 || areaRatio > 0.995) {
197
200
  continue;
198
201
  }
199
202
  // Use convex hull to simplify contour before polygon approximation
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "0.32.0",
3
+ "version": "0.33.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {
@@ -208,7 +208,11 @@ export const DocScanner: React.FC<Props> = ({
208
208
  const { value: area } = OpenCV.invoke('contourArea', contour, false);
209
209
 
210
210
  // Skip extremely small contours, but keep threshold very low to allow distant documents
211
- if (area < 200) {
211
+ if (typeof area !== 'number' || !isFinite(area)) {
212
+ continue;
213
+ }
214
+
215
+ if (area < 50) {
212
216
  continue;
213
217
  }
214
218
 
@@ -220,7 +224,7 @@ export const DocScanner: React.FC<Props> = ({
220
224
  console.log('[DocScanner] area', area, 'ratio', areaRatio);
221
225
  }
222
226
 
223
- if (areaRatio < 0.00002 || areaRatio > 0.99) {
227
+ if (areaRatio < 0.000005 || areaRatio > 0.995) {
224
228
  continue;
225
229
  }
226
230