react-native-image-stitcher 0.14.2 → 0.15.1

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.
Files changed (120) hide show
  1. package/CHANGELOG.md +164 -0
  2. package/README.md +35 -0
  3. package/RNImageStitcher.podspec +8 -7
  4. package/android/build.gradle +0 -16
  5. package/android/src/main/cpp/CMakeLists.txt +2 -63
  6. package/android/src/main/cpp/image_stitcher_jni.cpp +14 -0
  7. package/android/src/main/cpp/keyframe_gate_jni.cpp +13 -0
  8. package/android/src/main/java/io/imagestitcher/rn/BatchStitcher.kt +285 -3
  9. package/android/src/main/java/io/imagestitcher/rn/IncrementalStitcher.kt +180 -1162
  10. package/android/src/main/java/io/imagestitcher/rn/KeyframeGate.kt +29 -0
  11. package/android/src/main/java/io/imagestitcher/rn/RNImageStitcherPackage.kt +0 -4
  12. package/android/src/main/java/io/imagestitcher/rn/RNSARCameraView.kt +129 -71
  13. package/android/src/main/java/io/imagestitcher/rn/RNSARSession.kt +49 -0
  14. package/cpp/keyframe_gate.cpp +82 -23
  15. package/cpp/keyframe_gate.hpp +31 -2
  16. package/cpp/stitcher.cpp +208 -28
  17. package/cpp/tests/CMakeLists.txt +18 -12
  18. package/cpp/tests/keyframe_timebudget_test.cpp +65 -0
  19. package/cpp/tests/warp_guard_test.cpp +48 -0
  20. package/cpp/warp_guard.hpp +41 -0
  21. package/dist/camera/Camera.d.ts +31 -16
  22. package/dist/camera/Camera.js +11 -3
  23. package/dist/camera/CameraView.js +93 -3
  24. package/dist/camera/CaptureStitchStatsToast.d.ts +15 -2
  25. package/dist/camera/CaptureStitchStatsToast.js +27 -7
  26. package/dist/camera/PanoramaSettings.d.ts +10 -223
  27. package/dist/camera/PanoramaSettings.js +6 -28
  28. package/dist/camera/PanoramaSettingsBridge.d.ts +1 -24
  29. package/dist/camera/PanoramaSettingsBridge.js +3 -102
  30. package/dist/camera/PanoramaSettingsModal.js +7 -1
  31. package/dist/camera/buildPanoramaInitialSettings.d.ts +11 -0
  32. package/dist/camera/buildPanoramaInitialSettings.js +4 -0
  33. package/dist/camera/cameraErrorMessages.d.ts +32 -0
  34. package/dist/camera/cameraErrorMessages.js +53 -0
  35. package/dist/camera/selectCaptureDevice.d.ts +5 -1
  36. package/dist/camera/selectCaptureDevice.js +22 -2
  37. package/dist/camera/useCapture.js +38 -0
  38. package/dist/index.d.ts +5 -8
  39. package/dist/index.js +11 -34
  40. package/dist/stitching/incremental.d.ts +1 -117
  41. package/dist/stitching/stitchVideo.d.ts +0 -35
  42. package/dist/types.d.ts +0 -87
  43. package/ios/Sources/RNImageStitcher/IncrementalStitcher.swift +96 -674
  44. package/ios/Sources/RNImageStitcher/IncrementalStitcherBridge.swift +9 -12
  45. package/ios/Sources/RNImageStitcher/KeyframeGate.swift +14 -0
  46. package/ios/Sources/RNImageStitcher/KeyframeGateBridge.h +7 -0
  47. package/ios/Sources/RNImageStitcher/KeyframeGateBridge.mm +6 -0
  48. package/ios/Sources/RNImageStitcher/OpenCVKeyframeCollector.h +2 -2
  49. package/ios/Sources/RNImageStitcher/OpenCVKeyframeCollector.mm +3 -3
  50. package/ios/Sources/RNImageStitcher/OpenCVStitcher.h +28 -60
  51. package/ios/Sources/RNImageStitcher/OpenCVStitcher.mm +180 -921
  52. package/ios/Sources/RNImageStitcher/RNSARCameraView.swift +82 -7
  53. package/ios/Sources/RNImageStitcher/RNSARSession.swift +10 -35
  54. package/ios/Sources/RNImageStitcher/Stitcher.swift +84 -35
  55. package/ios/Sources/RNImageStitcher/StitcherBridge.m +13 -0
  56. package/ios/Sources/RNImageStitcher/StitcherBridge.swift +132 -5
  57. package/package.json +3 -2
  58. package/src/camera/Camera.tsx +44 -23
  59. package/src/camera/CameraView.tsx +113 -4
  60. package/src/camera/CaptureStitchStatsToast.tsx +58 -14
  61. package/src/camera/PanoramaSettings.ts +16 -289
  62. package/src/camera/PanoramaSettingsBridge.ts +3 -114
  63. package/src/camera/PanoramaSettingsModal.tsx +14 -1
  64. package/src/camera/__tests__/PanoramaSettingsBridge.test.ts +3 -188
  65. package/src/camera/__tests__/buildPanoramaInitialSettings.test.ts +41 -0
  66. package/src/camera/__tests__/cameraErrorMessages.test.ts +76 -0
  67. package/src/camera/__tests__/selectCaptureDevice.test.ts +33 -0
  68. package/src/camera/buildPanoramaInitialSettings.ts +17 -0
  69. package/src/camera/cameraErrorMessages.ts +84 -0
  70. package/src/camera/selectCaptureDevice.ts +28 -3
  71. package/src/camera/useCapture.ts +44 -1
  72. package/src/index.ts +11 -40
  73. package/src/stitching/incremental.ts +3 -140
  74. package/src/stitching/stitchVideo.ts +0 -26
  75. package/src/types.ts +0 -95
  76. package/android/src/main/cpp/stitcher_jsi_install_jni.cpp +0 -227
  77. package/android/src/main/java/io/imagestitcher/rn/IncrementalFirstwinsEngine.kt +0 -1081
  78. package/android/src/main/java/io/imagestitcher/rn/StitcherJsiInstallerModule.kt +0 -103
  79. package/android/src/main/java/io/imagestitcher/rn/StitcherWorkletRuntime.kt +0 -256
  80. package/cpp/stitcher_frame_jsi.cpp +0 -214
  81. package/cpp/stitcher_frame_jsi.hpp +0 -108
  82. package/cpp/stitcher_proxy_jsi.cpp +0 -109
  83. package/cpp/stitcher_proxy_jsi.hpp +0 -46
  84. package/cpp/stitcher_worklet_dispatch.cpp +0 -103
  85. package/cpp/stitcher_worklet_dispatch.hpp +0 -71
  86. package/cpp/stitcher_worklet_registry.cpp +0 -91
  87. package/cpp/stitcher_worklet_registry.hpp +0 -146
  88. package/cpp/tests/stitcher_worklet_registry_test.cpp +0 -195
  89. package/dist/stitching/IncrementalStitcherView.d.ts +0 -41
  90. package/dist/stitching/IncrementalStitcherView.js +0 -157
  91. package/dist/stitching/StitcherWorkletRegistry.d.ts +0 -117
  92. package/dist/stitching/StitcherWorkletRegistry.js +0 -78
  93. package/dist/stitching/ensureStitcherProxyInstalled.d.ts +0 -8
  94. package/dist/stitching/ensureStitcherProxyInstalled.js +0 -81
  95. package/dist/stitching/useFrameProcessor.d.ts +0 -119
  96. package/dist/stitching/useFrameProcessor.js +0 -196
  97. package/dist/stitching/useFrameStream.d.ts +0 -34
  98. package/dist/stitching/useFrameStream.js +0 -234
  99. package/dist/stitching/useThrottledFrameProcessor.d.ts +0 -33
  100. package/dist/stitching/useThrottledFrameProcessor.js +0 -132
  101. package/ios/Sources/RNImageStitcher/OpenCVIncrementalStitcher.h +0 -474
  102. package/ios/Sources/RNImageStitcher/OpenCVIncrementalStitcher.mm +0 -1328
  103. package/ios/Sources/RNImageStitcher/OpenCVSlitScanStitcher.h +0 -103
  104. package/ios/Sources/RNImageStitcher/OpenCVSlitScanStitcher.mm +0 -3285
  105. package/ios/Sources/RNImageStitcher/RNSARWorkletRuntime.h +0 -128
  106. package/ios/Sources/RNImageStitcher/RNSARWorkletRuntime.mm +0 -313
  107. package/ios/Sources/RNImageStitcher/SaveFrameAsJpegPlugin.mm +0 -185
  108. package/ios/Sources/RNImageStitcher/StitcherFrameHostObject.h +0 -60
  109. package/ios/Sources/RNImageStitcher/StitcherFrameHostObject.mm +0 -214
  110. package/ios/Sources/RNImageStitcher/StitcherJsiInstaller.h +0 -42
  111. package/ios/Sources/RNImageStitcher/StitcherJsiInstaller.mm +0 -160
  112. package/src/stitching/IncrementalStitcherView.tsx +0 -198
  113. package/src/stitching/StitcherWorkletRegistry.ts +0 -156
  114. package/src/stitching/__tests__/StitcherWorkletRegistry.test.ts +0 -176
  115. package/src/stitching/__tests__/ensureStitcherProxyInstalled.test.ts +0 -94
  116. package/src/stitching/__tests__/useThrottledFrameProcessor.test.ts +0 -178
  117. package/src/stitching/ensureStitcherProxyInstalled.ts +0 -141
  118. package/src/stitching/useFrameProcessor.ts +0 -226
  119. package/src/stitching/useFrameStream.ts +0 -271
  120. package/src/stitching/useThrottledFrameProcessor.ts +0 -145
@@ -1,103 +0,0 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- //
3
- // OpenCVFirstWinsCylindricalStitcher.h
4
- //
5
- // Apple-style slit-scan panorama engine. Alternative to
6
- // OpenCVIncrementalStitcher (which is the Samsung-style hybrid
7
- // frame-based approach). Both engines expose the same JS-facing
8
- // API contract; the host picks one via the `engine` flag in start
9
- // options.
10
- //
11
- // What slit-scan does differently:
12
- //
13
- // Hybrid (v9): accepts WHOLE frames at intervals, warps each via
14
- // cylindrical projection, blends with feather over a substantial
15
- // overlap region (~30-50% of frame width).
16
- //
17
- // Slit-scan (v10): continuously samples the camera buffer. For
18
- // each AR frame, takes a NARROW VERTICAL STRIP (typically 30-60
19
- // pixels) whose width tracks the gyro angular delta since the
20
- // last strip. Strips are painted onto the cylindrical canvas at
21
- // their exact angular positions, so the per-strip overlap is just
22
- // 1-3 pixels. The "stitching" problem mostly disappears because
23
- // the overlap region is too narrow to show parallax.
24
- //
25
- // Why both engines:
26
- //
27
- // Slit-scan produces near-perfect output for clean rotational
28
- // pans (Apple Camera-app quality) but is sensitive to gyro drift
29
- // on long pans and to non-rotational motion (operator translates
30
- // their body slightly). Hybrid is more forgiving but has visible
31
- // seams where alignment is imperfect. Field captures decide which
32
- // wins for the actual gesture our reps use.
33
- //
34
-
35
- #import <Foundation/Foundation.h>
36
- #import <CoreVideo/CoreVideo.h>
37
- #import "OpenCVIncrementalStitcher.h" // RLISFrameOutcome, RLISFrameTelemetry, RLISSnapshot
38
-
39
- NS_ASSUME_NONNULL_BEGIN
40
-
41
- @interface OpenCVFirstWinsCylindricalStitcher : NSObject
42
-
43
- - (instancetype)initWithComposeWidth:(NSInteger)composeWidth
44
- composeHeight:(NSInteger)composeHeight
45
- canvasWidth:(NSInteger)canvasWidth
46
- canvasHeight:(NSInteger)canvasHeight
47
- featherPx:(NSInteger)featherPx
48
- frameRotationDegrees:(NSInteger)frameRotationDegrees
49
- useRectilinear:(BOOL)useRectilinear NS_DESIGNATED_INITIALIZER;
50
-
51
- - (instancetype)init NS_UNAVAILABLE;
52
-
53
- /// V15 — set the per-stage correction config. Should be called once
54
- /// after init, before any `ingestPixelBuffer:` call. Subsequent calls
55
- /// replace the config but mid-capture changes can produce inconsistent
56
- /// state (prev features tracked under different settings). Best
57
- /// practice: reset the engine when config changes. If never called,
58
- /// the engine uses a default equivalent to
59
- /// `+[RLISStitcherConfig configForMode:@"slitscan-both"]`.
60
- - (void)setConfig:(RLISStitcherConfig *)config;
61
-
62
- /// V15.0b — set the world-frame plane transform (4×4, column-major,
63
- /// 16 floats). Should be called once a vertical plane has been
64
- /// detected by ARKit and before any subsequent ingest. If never
65
- /// called, the engine ignores `_config.useDetectedPlane` and falls
66
- /// back to pose-driven projection.
67
- - (void)setPlaneTransformFlat:(NSArray<NSNumber *> *)transform16;
68
-
69
- - (RLISFrameTelemetry *)ingestPixelBuffer:(CVPixelBufferRef)pixelBuffer
70
- qx:(double)qx
71
- qy:(double)qy
72
- qz:(double)qz
73
- qw:(double)qw
74
- tx:(double)tx
75
- ty:(double)ty
76
- tz:(double)tz
77
- fx:(double)fx
78
- fy:(double)fy
79
- cx:(double)cx
80
- cy:(double)cy
81
- imageWidth:(NSInteger)imageWidth
82
- imageHeight:(NSInteger)imageHeight
83
- yaw:(double)yaw
84
- pitch:(double)pitch
85
- fovHorizDegrees:(double)fovHorizDegrees
86
- fovVertDegrees:(double)fovVertDegrees
87
- trackingPoor:(BOOL)trackingPoor
88
- NS_SWIFT_NAME(ingest(pixelBuffer:qx:qy:qz:qw:tx:ty:tz:fx:fy:cx:cy:imageWidth:imageHeight:yaw:pitch:fovHorizDegrees:fovVertDegrees:trackingPoor:));
89
-
90
- - (nullable RLISSnapshot *)snapshotWithJpegQuality:(NSInteger)quality
91
- error:(NSError **)error;
92
-
93
- - (nullable RLISSnapshot *)finalizeAtPath:(NSString *)outputPath
94
- jpegQuality:(NSInteger)quality
95
- error:(NSError **)error;
96
-
97
- - (void)reset;
98
-
99
- @property (nonatomic, readonly) NSInteger acceptedCount;
100
-
101
- @end
102
-
103
- NS_ASSUME_NONNULL_END