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.
@@ -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
- const tempMat = react_native_fast_opencv_1.OpenCV.createObject(react_native_fast_opencv_1.ObjectType.Mat);
289
- react_native_fast_opencv_1.OpenCV.invoke('bilateralFilter', mat, tempMat, 9, 75, 75);
290
- mat = tempMat;
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "0.46.0",
3
+ "version": "0.47.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {
@@ -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
- const tempMat = OpenCV.createObject(ObjectType.Mat);
356
- OpenCV.invoke('bilateralFilter', mat, tempMat, 9, 75, 75);
357
- mat = tempMat;
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);