react-native-rectangle-doc-scanner 0.46.0 → 0.47.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.
- package/dist/DocScanner.js +14 -3
- package/package.json +1 -1
- package/src/DocScanner.tsx +13 -3
package/dist/DocScanner.js
CHANGED
|
@@ -285,9 +285,20 @@ const DocScanner = ({ onCapture, overlayColor = '#e7a649', autoCapture = true, m
|
|
|
285
285
|
// Bilateral filter for edge-preserving smoothing (better quality than Gaussian)
|
|
286
286
|
step = 'bilateralFilter';
|
|
287
287
|
reportStage(step);
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
288
|
+
try {
|
|
289
|
+
const tempMat = react_native_fast_opencv_1.OpenCV.createObject(react_native_fast_opencv_1.ObjectType.Mat);
|
|
290
|
+
react_native_fast_opencv_1.OpenCV.invoke('bilateralFilter', mat, tempMat, 9, 75, 75);
|
|
291
|
+
mat = tempMat;
|
|
292
|
+
}
|
|
293
|
+
catch (error) {
|
|
294
|
+
if (__DEV__) {
|
|
295
|
+
console.warn('[DocScanner] bilateralFilter unavailable, falling back to GaussianBlur', error);
|
|
296
|
+
}
|
|
297
|
+
step = 'gaussianBlurFallback';
|
|
298
|
+
reportStage(step);
|
|
299
|
+
const blurKernel = react_native_fast_opencv_1.OpenCV.createObject(react_native_fast_opencv_1.ObjectType.Size, 5, 5);
|
|
300
|
+
react_native_fast_opencv_1.OpenCV.invoke('GaussianBlur', mat, mat, blurKernel, 0);
|
|
301
|
+
}
|
|
291
302
|
step = 'Canny';
|
|
292
303
|
reportStage(step);
|
|
293
304
|
// Configurable Canny parameters for adaptive edge detection
|
package/package.json
CHANGED
package/src/DocScanner.tsx
CHANGED
|
@@ -352,9 +352,19 @@ export const DocScanner: React.FC<Props> = ({
|
|
|
352
352
|
// Bilateral filter for edge-preserving smoothing (better quality than Gaussian)
|
|
353
353
|
step = 'bilateralFilter';
|
|
354
354
|
reportStage(step);
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
355
|
+
try {
|
|
356
|
+
const tempMat = OpenCV.createObject(ObjectType.Mat);
|
|
357
|
+
OpenCV.invoke('bilateralFilter', mat, tempMat, 9, 75, 75);
|
|
358
|
+
mat = tempMat;
|
|
359
|
+
} catch (error) {
|
|
360
|
+
if (__DEV__) {
|
|
361
|
+
console.warn('[DocScanner] bilateralFilter unavailable, falling back to GaussianBlur', error);
|
|
362
|
+
}
|
|
363
|
+
step = 'gaussianBlurFallback';
|
|
364
|
+
reportStage(step);
|
|
365
|
+
const blurKernel = OpenCV.createObject(ObjectType.Size, 5, 5);
|
|
366
|
+
OpenCV.invoke('GaussianBlur', mat, mat, blurKernel, 0);
|
|
367
|
+
}
|
|
358
368
|
|
|
359
369
|
step = 'Canny';
|
|
360
370
|
reportStage(step);
|