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
@@ -69,41 +69,6 @@ export interface StitchVideoOptions {
69
69
  * Right choice on low-RAM devices or with `feather`.
70
70
  */
71
71
  seamFinderType?: 'graphcut' | 'skip';
72
- /**
73
- * Phase 5: pose-driven stitching. When present and non-empty,
74
- * the native stitcher skips features → matching → BundleAdjuster
75
- * and builds cv::detail::CameraParams directly from each pose's
76
- * intrinsics + quaternion. Each entry has the shape returned
77
- * by `NativeModules.RNSARSession.snapshotPoseLog()`:
78
- *
79
- * { tx, ty, tz, qx, qy, qz, qw,
80
- * fx, fy, cx, cy,
81
- * imageWidth, imageHeight,
82
- * timestampMs, trackingState }
83
- *
84
- * Frames whose closest pose is beyond a 100 ms tolerance are
85
- * dropped before stitching; if fewer than 2 remain the call
86
- * rejects with `opencv-failed-1032` so the host can fall back
87
- * to the feature-matched path (re-call `stitchVideo` without
88
- * `poses`).
89
- */
90
- poses?: Array<{
91
- tx: number;
92
- ty: number;
93
- tz: number;
94
- qx: number;
95
- qy: number;
96
- qz: number;
97
- qw: number;
98
- fx: number;
99
- fy: number;
100
- cx: number;
101
- cy: number;
102
- imageWidth: number;
103
- imageHeight: number;
104
- timestampMs: number;
105
- trackingState: number;
106
- }>;
107
72
  }
108
73
  /**
109
74
  * Stitch a recorded video file into a single panoramic JPEG.
package/dist/types.d.ts CHANGED
@@ -35,93 +35,6 @@ export interface DeviceMetadata {
35
35
  cameraId: string;
36
36
  flashEnabled: boolean;
37
37
  }
38
- /**
39
- * v0.9.0 Layer 3 — one sampled frame delivered by `useFrameStream`
40
- * to the JS-thread handler.
41
- *
42
- * The JPEG file at `jpegPath` is the stream's own copy. Hosts that
43
- * need long-term retention MUST copy the file synchronously inside
44
- * the handler — the same path may be overwritten by a subsequent
45
- * sample (slot reuse — see the hook's docstring for the rotation
46
- * policy).
47
- */
48
- export interface SampledFrame {
49
- /** Absolute filesystem path to the JPEG. No `file://` prefix. */
50
- jpegPath: string;
51
- /**
52
- * Pose at sample time. `translation` is `undefined` in non-AR
53
- * mode (gyro provides rotation only; no spatial anchor).
54
- */
55
- pose: {
56
- rotation: [number, number, number, number];
57
- translation?: [number, number, number];
58
- };
59
- /** Frame timestamp (ms; per the v0.8.0 StitcherFrame contract). */
60
- timestamp: number;
61
- /** JPEG width / height in pixels. */
62
- width: number;
63
- height: number;
64
- }
65
- /**
66
- * v0.9.0 Layer 3 — options for `useFrameStream`.
67
- *
68
- * For worklet-native processing without JPEG roundtrip (OCR via
69
- * Vision/ML Kit, TFLite ML, LiDAR depth), use
70
- * `useThrottledFrameProcessor` (Layer 2) instead.
71
- */
72
- export interface FrameStreamOptions {
73
- /**
74
- * Target sampling rate in Hertz. Clamped to `[0.5, 10]`. The
75
- * Layer 2 throttle gate enforces the rate inside the worklet;
76
- * ticks too close together are dropped silently.
77
- *
78
- * Clamp upper bound (10 Hz) is intentionally lower than Layer 2's
79
- * (30 Hz) — beyond 10 Hz the per-frame JPEG encode + JS-bridge
80
- * cost dominates the wall-clock budget. Hosts that need higher
81
- * rates should be on Layer 2 with their own JPEG encoder call
82
- * (or no JPEG at all).
83
- */
84
- sampleHz: number;
85
- /**
86
- * JPEG quality (0-100). Default 75. Clamped silently to
87
- * `[1, 100]` by the underlying `save_frame_as_jpeg` native plugin.
88
- */
89
- quality?: number;
90
- /**
91
- * Directory to write JPEG files into. Defaults to a per-app
92
- * `<cache>/rnis-frame-stream/` subdirectory. The directory is
93
- * `mkdir -p`'d on first use; hosts that supply an existing
94
- * absolute path are responsible for its lifecycle.
95
- */
96
- outputDir?: string;
97
- }
98
- /**
99
- * v0.9.0 Layer 2 — options for `useThrottledFrameProcessor`.
100
- *
101
- * Wraps v0.8.0's `useFrameProcessor` with a monotonic-time throttle
102
- * gate so the supplied worklet fires at most `sampleHz` times per
103
- * second. Use for sub-frame-rate worklet-native processing — native
104
- * OCR (Vision.framework / ML Kit), TFLite ML detection, LiDAR depth
105
- * processing — where the bbox / depth payloads are small enough to
106
- * bridge to JS via `runOnJS`.
107
- *
108
- * For JS-thread JPEG consumers (file-path OCR libraries, cloud
109
- * upload, thumbnail UI), use `useFrameStream` (Layer 3) instead.
110
- */
111
- export interface ThrottledFrameProcessorOptions {
112
- /**
113
- * Target sampling rate in Hertz. Clamped to `[0.5, 30]`. Inside
114
- * the worklet a monotonic-time gate enforces the rate; ticks too
115
- * close together are silently dropped.
116
- *
117
- * The clamp upper bound (30 Hz) sits at typical AR rates on
118
- * mid-range Android devices — beyond that, the host should just
119
- * use `useFrameProcessor` directly (no throttle). The clamp
120
- * lower bound (0.5 Hz) prevents accidentally-zero-divide values
121
- * + matches `useFrameStream`'s convention.
122
- */
123
- sampleHz: number;
124
- }
125
38
  export interface CaptureResult {
126
39
  /** Unique device-generated UUID */
127
40
  deviceUuid: string;