react-native-rectangle-doc-scanner 0.37.0 → 0.38.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.
@@ -219,7 +219,7 @@ const DocScanner = ({ onCapture, overlayColor = '#e7a649', autoCapture = true, m
219
219
  console.log('[DocScanner] area', area, 'ratio', areaRatio);
220
220
  }
221
221
  // Skip if area ratio is too small or too large
222
- if (areaRatio < 0.02 || areaRatio > 0.95) {
222
+ if (areaRatio < 0.005 || areaRatio > 0.95) {
223
223
  continue;
224
224
  }
225
225
  step = `contour_${i}_arcLength`;
@@ -227,8 +227,11 @@ const DocScanner = ({ onCapture, overlayColor = '#e7a649', autoCapture = true, m
227
227
  const { value: perimeter } = react_native_fast_opencv_1.OpenCV.invoke('arcLength', contour, true);
228
228
  const approx = react_native_fast_opencv_1.OpenCV.createObject(react_native_fast_opencv_1.ObjectType.PointVector);
229
229
  let approxArray = [];
230
- // Try epsilon values from 0.3% to 6% of perimeter for better corner detection
231
- const epsilonValues = [0.003, 0.005, 0.007, 0.009, 0.011, 0.013, 0.015, 0.018, 0.02, 0.025, 0.03, 0.04, 0.05, 0.06];
230
+ // Try more epsilon values from 0.1% to 10% for difficult shapes
231
+ const epsilonValues = [
232
+ 0.001, 0.002, 0.003, 0.004, 0.005, 0.006, 0.007, 0.008, 0.009,
233
+ 0.01, 0.012, 0.015, 0.018, 0.02, 0.025, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1
234
+ ];
232
235
  for (let attempt = 0; attempt < epsilonValues.length; attempt += 1) {
233
236
  const epsilon = epsilonValues[attempt] * perimeter;
234
237
  step = `contour_${i}_approxPolyDP_attempt_${attempt}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "0.37.0",
3
+ "version": "0.38.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {
@@ -250,7 +250,7 @@ export const DocScanner: React.FC<Props> = ({
250
250
  }
251
251
 
252
252
  // Skip if area ratio is too small or too large
253
- if (areaRatio < 0.02 || areaRatio > 0.95) {
253
+ if (areaRatio < 0.005 || areaRatio > 0.95) {
254
254
  continue;
255
255
  }
256
256
 
@@ -261,8 +261,11 @@ export const DocScanner: React.FC<Props> = ({
261
261
 
262
262
  let approxArray: Array<{ x: number; y: number }> = [];
263
263
 
264
- // Try epsilon values from 0.3% to 6% of perimeter for better corner detection
265
- const epsilonValues = [0.003, 0.005, 0.007, 0.009, 0.011, 0.013, 0.015, 0.018, 0.02, 0.025, 0.03, 0.04, 0.05, 0.06];
264
+ // Try more epsilon values from 0.1% to 10% for difficult shapes
265
+ const epsilonValues = [
266
+ 0.001, 0.002, 0.003, 0.004, 0.005, 0.006, 0.007, 0.008, 0.009,
267
+ 0.01, 0.012, 0.015, 0.018, 0.02, 0.025, 0.03, 0.04, 0.05, 0.06, 0.07, 0.08, 0.09, 0.1
268
+ ];
266
269
 
267
270
  for (let attempt = 0; attempt < epsilonValues.length; attempt += 1) {
268
271
  const epsilon = epsilonValues[attempt] * perimeter;