react-native-image-stitcher 0.1.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/CHANGELOG.md +96 -0
- package/LICENSE +201 -0
- package/NOTICE +21 -0
- package/README.md +189 -0
- package/RNImageStitcher.podspec +76 -0
- package/android/build.gradle +224 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/cpp/CMakeLists.txt +124 -0
- package/android/src/main/cpp/image_stitcher_jni.cpp +145 -0
- package/android/src/main/cpp/keyframe_gate_jni.cpp +204 -0
- package/android/src/main/java/io/imagestitcher/rn/BatchStitcher.kt +426 -0
- package/android/src/main/java/io/imagestitcher/rn/IncrementalFirstwinsEngine.kt +960 -0
- package/android/src/main/java/io/imagestitcher/rn/IncrementalStitcher.kt +2371 -0
- package/android/src/main/java/io/imagestitcher/rn/KeyframeGate.kt +256 -0
- package/android/src/main/java/io/imagestitcher/rn/QualityChecker.kt +167 -0
- package/android/src/main/java/io/imagestitcher/rn/RNImageStitcherPackage.kt +39 -0
- package/android/src/main/java/io/imagestitcher/rn/RNSARCameraView.kt +558 -0
- package/android/src/main/java/io/imagestitcher/rn/RNSARCameraViewManager.kt +35 -0
- package/android/src/main/java/io/imagestitcher/rn/RNSARSession.kt +784 -0
- package/android/src/main/java/io/imagestitcher/rn/ar/BackgroundRenderer.kt +176 -0
- package/android/src/main/java/io/imagestitcher/rn/ar/ShaderUtil.kt +67 -0
- package/android/src/main/java/io/imagestitcher/rn/ar/YuvImageConverter.kt +201 -0
- package/cpp/ar_frame_pose.h +63 -0
- package/cpp/keyframe_gate.cpp +927 -0
- package/cpp/keyframe_gate.hpp +240 -0
- package/cpp/stitcher.cpp +2207 -0
- package/cpp/stitcher.hpp +275 -0
- package/dist/ar/useARSession.d.ts +102 -0
- package/dist/ar/useARSession.js +133 -0
- package/dist/camera/ARCameraView.d.ts +93 -0
- package/dist/camera/ARCameraView.js +170 -0
- package/dist/camera/Camera.d.ts +134 -0
- package/dist/camera/Camera.js +688 -0
- package/dist/camera/CameraShutter.d.ts +80 -0
- package/dist/camera/CameraShutter.js +237 -0
- package/dist/camera/CameraView.d.ts +65 -0
- package/dist/camera/CameraView.js +117 -0
- package/dist/camera/CaptureControlsBar.d.ts +87 -0
- package/dist/camera/CaptureControlsBar.js +82 -0
- package/dist/camera/CaptureHeader.d.ts +62 -0
- package/dist/camera/CaptureHeader.js +81 -0
- package/dist/camera/CapturePreview.d.ts +70 -0
- package/dist/camera/CapturePreview.js +188 -0
- package/dist/camera/CaptureStatusOverlay.d.ts +75 -0
- package/dist/camera/CaptureStatusOverlay.js +326 -0
- package/dist/camera/CaptureThumbnailStrip.d.ts +87 -0
- package/dist/camera/CaptureThumbnailStrip.js +177 -0
- package/dist/camera/IncrementalPanGuide.d.ts +83 -0
- package/dist/camera/IncrementalPanGuide.js +267 -0
- package/dist/camera/PanoramaBandOverlay.d.ts +107 -0
- package/dist/camera/PanoramaBandOverlay.js +399 -0
- package/dist/camera/PanoramaConfirmModal.d.ts +57 -0
- package/dist/camera/PanoramaConfirmModal.js +128 -0
- package/dist/camera/PanoramaGuidance.d.ts +79 -0
- package/dist/camera/PanoramaGuidance.js +246 -0
- package/dist/camera/PanoramaSettingsModal.d.ts +311 -0
- package/dist/camera/PanoramaSettingsModal.js +611 -0
- package/dist/camera/ViewportCropOverlay.d.ts +46 -0
- package/dist/camera/ViewportCropOverlay.js +67 -0
- package/dist/camera/useCapture.d.ts +111 -0
- package/dist/camera/useCapture.js +160 -0
- package/dist/camera/useDeviceOrientation.d.ts +48 -0
- package/dist/camera/useDeviceOrientation.js +131 -0
- package/dist/camera/useVideoCapture.d.ts +79 -0
- package/dist/camera/useVideoCapture.js +151 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +39 -0
- package/dist/quality/normaliseOrientation.d.ts +36 -0
- package/dist/quality/normaliseOrientation.js +62 -0
- package/dist/quality/runQualityCheck.d.ts +41 -0
- package/dist/quality/runQualityCheck.js +98 -0
- package/dist/sensors/useIMUTranslationGate.d.ts +70 -0
- package/dist/sensors/useIMUTranslationGate.js +235 -0
- package/dist/stitching/IncrementalStitcherView.d.ts +41 -0
- package/dist/stitching/IncrementalStitcherView.js +157 -0
- package/dist/stitching/incremental.d.ts +930 -0
- package/dist/stitching/incremental.js +133 -0
- package/dist/stitching/stitchFrames.d.ts +55 -0
- package/dist/stitching/stitchFrames.js +56 -0
- package/dist/stitching/stitchVideo.d.ts +119 -0
- package/dist/stitching/stitchVideo.js +57 -0
- package/dist/stitching/useIncrementalJSDriver.d.ts +74 -0
- package/dist/stitching/useIncrementalJSDriver.js +199 -0
- package/dist/stitching/useIncrementalStitcher.d.ts +58 -0
- package/dist/stitching/useIncrementalStitcher.js +172 -0
- package/dist/types.d.ts +58 -0
- package/dist/types.js +15 -0
- package/ios/Package.swift +72 -0
- package/ios/Sources/RNImageStitcher/ARCameraViewManager.m +33 -0
- package/ios/Sources/RNImageStitcher/ARCameraViewManager.swift +40 -0
- package/ios/Sources/RNImageStitcher/ARSessionBridge.m +55 -0
- package/ios/Sources/RNImageStitcher/ARSessionBridge.swift +149 -0
- package/ios/Sources/RNImageStitcher/IncrementalStitcher.swift +2727 -0
- package/ios/Sources/RNImageStitcher/IncrementalStitcherBridge.m +85 -0
- package/ios/Sources/RNImageStitcher/IncrementalStitcherBridge.swift +625 -0
- package/ios/Sources/RNImageStitcher/KeyframeGate.swift +328 -0
- package/ios/Sources/RNImageStitcher/KeyframeGateBridge.h +141 -0
- package/ios/Sources/RNImageStitcher/KeyframeGateBridge.mm +278 -0
- package/ios/Sources/RNImageStitcher/OpenCVIncrementalStitcher.h +473 -0
- package/ios/Sources/RNImageStitcher/OpenCVIncrementalStitcher.mm +1326 -0
- package/ios/Sources/RNImageStitcher/OpenCVKeyframeCollector.h +97 -0
- package/ios/Sources/RNImageStitcher/OpenCVKeyframeCollector.mm +296 -0
- package/ios/Sources/RNImageStitcher/OpenCVSlitScanStitcher.h +103 -0
- package/ios/Sources/RNImageStitcher/OpenCVSlitScanStitcher.mm +3285 -0
- package/ios/Sources/RNImageStitcher/OpenCVStitcher.h +238 -0
- package/ios/Sources/RNImageStitcher/OpenCVStitcher.mm +1880 -0
- package/ios/Sources/RNImageStitcher/QualityChecker.swift +252 -0
- package/ios/Sources/RNImageStitcher/QualityCheckerBridge.m +26 -0
- package/ios/Sources/RNImageStitcher/QualityCheckerBridge.swift +72 -0
- package/ios/Sources/RNImageStitcher/RNSARCameraView.swift +114 -0
- package/ios/Sources/RNImageStitcher/RNSARSession.swift +1111 -0
- package/ios/Sources/RNImageStitcher/Stitcher.swift +243 -0
- package/ios/Sources/RNImageStitcher/StitcherBridge.m +28 -0
- package/ios/Sources/RNImageStitcher/StitcherBridge.swift +246 -0
- package/package.json +73 -0
- package/react-native.config.js +34 -0
- package/scripts/opencv-version.txt +1 -0
- package/scripts/postinstall-fetch-binaries.js +286 -0
- package/src/ar/useARSession.ts +210 -0
- package/src/camera/.gitkeep +0 -0
- package/src/camera/ARCameraView.tsx +256 -0
- package/src/camera/Camera.tsx +1053 -0
- package/src/camera/CameraShutter.tsx +292 -0
- package/src/camera/CameraView.tsx +157 -0
- package/src/camera/CaptureControlsBar.tsx +204 -0
- package/src/camera/CaptureHeader.tsx +184 -0
- package/src/camera/CapturePreview.tsx +318 -0
- package/src/camera/CaptureStatusOverlay.tsx +391 -0
- package/src/camera/CaptureThumbnailStrip.tsx +277 -0
- package/src/camera/IncrementalPanGuide.tsx +328 -0
- package/src/camera/PanoramaBandOverlay.tsx +498 -0
- package/src/camera/PanoramaConfirmModal.tsx +206 -0
- package/src/camera/PanoramaGuidance.tsx +327 -0
- package/src/camera/PanoramaSettingsModal.tsx +1357 -0
- package/src/camera/ViewportCropOverlay.tsx +81 -0
- package/src/camera/useCapture.ts +279 -0
- package/src/camera/useDeviceOrientation.ts +140 -0
- package/src/camera/useVideoCapture.ts +236 -0
- package/src/index.ts +53 -0
- package/src/quality/.gitkeep +0 -0
- package/src/quality/normaliseOrientation.ts +79 -0
- package/src/quality/runQualityCheck.ts +131 -0
- package/src/sensors/useIMUTranslationGate.ts +347 -0
- package/src/stitching/.gitkeep +0 -0
- package/src/stitching/IncrementalStitcherView.tsx +198 -0
- package/src/stitching/incremental.ts +1021 -0
- package/src/stitching/stitchFrames.ts +88 -0
- package/src/stitching/stitchVideo.ts +153 -0
- package/src/stitching/useIncrementalJSDriver.ts +273 -0
- package/src/stitching/useIncrementalStitcher.ts +252 -0
- package/src/types.ts +78 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
/**
|
|
4
|
+
* ARCameraView — AR-backed alternative to ``<CameraView>`` for
|
|
5
|
+
* audits that need pose-aware capture (panorama mode, packet
|
|
6
|
+
* detection). Renders the ARKit camera feed via the native
|
|
7
|
+
* `RNSARCameraView` UIView; the underlying ARSession is the
|
|
8
|
+
* SDK singleton (`RNSARSession.shared`), shared between the
|
|
9
|
+
* preview and the pose log that feeds Phase 5 stitching + Phase 6
|
|
10
|
+
* measurement.
|
|
11
|
+
*
|
|
12
|
+
* Why a separate component (vs. a polymorphic CameraView)?
|
|
13
|
+
* 1. **Different imperative API.** The vision-camera-backed
|
|
14
|
+
* CameraView exposes `takePhoto / startRecording` via its ref
|
|
15
|
+
* (Phase 5 will add equivalents to this component, but they
|
|
16
|
+
* route through ARFrame.capturedImage + AVAssetWriter rather
|
|
17
|
+
* than vision-camera's APIs).
|
|
18
|
+
* 2. **Camera-access conflict.** ARKit and AVCaptureSession
|
|
19
|
+
* can't share the camera. Forcing the host to pick one
|
|
20
|
+
* component over the other (instead of toggling a prop on a
|
|
21
|
+
* shared component) makes the conflict impossible to misuse —
|
|
22
|
+
* you can't accidentally mount both at the same time.
|
|
23
|
+
* 3. **Lifecycle clarity.** The native side starts the AR
|
|
24
|
+
* session in `didMoveToWindow`. Mount = start, unmount =
|
|
25
|
+
* stop. No flag-twiddling.
|
|
26
|
+
*
|
|
27
|
+
* This component is preview-only in Phase 4.4. Photo + video
|
|
28
|
+
* capture come in Phase 5 (Step 5 of the AR design plan). Until
|
|
29
|
+
* then, the host's panorama capture flow continues to use
|
|
30
|
+
* vision-camera; ARCameraView is opt-in via a settings flag for
|
|
31
|
+
* developer verification.
|
|
32
|
+
*/
|
|
33
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
34
|
+
if (k2 === undefined) k2 = k;
|
|
35
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
36
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
37
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
38
|
+
}
|
|
39
|
+
Object.defineProperty(o, k2, desc);
|
|
40
|
+
}) : (function(o, m, k, k2) {
|
|
41
|
+
if (k2 === undefined) k2 = k;
|
|
42
|
+
o[k2] = m[k];
|
|
43
|
+
}));
|
|
44
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
45
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
46
|
+
}) : function(o, v) {
|
|
47
|
+
o["default"] = v;
|
|
48
|
+
});
|
|
49
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
50
|
+
var ownKeys = function(o) {
|
|
51
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
52
|
+
var ar = [];
|
|
53
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
54
|
+
return ar;
|
|
55
|
+
};
|
|
56
|
+
return ownKeys(o);
|
|
57
|
+
};
|
|
58
|
+
return function (mod) {
|
|
59
|
+
if (mod && mod.__esModule) return mod;
|
|
60
|
+
var result = {};
|
|
61
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
62
|
+
__setModuleDefault(result, mod);
|
|
63
|
+
return result;
|
|
64
|
+
};
|
|
65
|
+
})();
|
|
66
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
67
|
+
exports.ARCameraView = void 0;
|
|
68
|
+
const react_1 = __importStar(require("react"));
|
|
69
|
+
const react_native_1 = require("react-native");
|
|
70
|
+
// React Native looks up the component by its NATIVE name.
|
|
71
|
+
// iOS: comes from `ARCameraViewManager.m`'s
|
|
72
|
+
// `RCT_EXTERN_MODULE(RNSARCameraViewManager, RCTViewManager)`.
|
|
73
|
+
// Android: comes from `RNSARCameraViewManager.kt`'s
|
|
74
|
+
// `getName() = "RNSARCameraView"`.
|
|
75
|
+
// Both expose the same name; same JS lookup works on both platforms.
|
|
76
|
+
const NativeARCameraView = react_native_1.Platform.OS === 'ios' || react_native_1.Platform.OS === 'android'
|
|
77
|
+
? (0, react_native_1.requireNativeComponent)('RNSARCameraView')
|
|
78
|
+
: null;
|
|
79
|
+
exports.ARCameraView = (0, react_1.forwardRef)(function ARCameraView({ style, guidance }, ref) {
|
|
80
|
+
// Held across the start→stop lifecycle so stopRecording's
|
|
81
|
+
// resolved VideoFile can be delivered via the same callback
|
|
82
|
+
// pair vision-camera uses.
|
|
83
|
+
const recordingCallbacksRef = (0, react_1.useRef)(null);
|
|
84
|
+
(0, react_1.useImperativeHandle)(ref, () => ({
|
|
85
|
+
takePhoto: async (options = {}) => {
|
|
86
|
+
const native = react_native_1.NativeModules.RNSARSession;
|
|
87
|
+
if (!native?.takePhoto) {
|
|
88
|
+
throw new Error('ARCameraView.takePhoto: native RNSARSession module not registered');
|
|
89
|
+
}
|
|
90
|
+
return native.takePhoto({
|
|
91
|
+
path: '',
|
|
92
|
+
quality: options.quality ?? 90,
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
startRecording: (options) => {
|
|
96
|
+
const native = react_native_1.NativeModules.RNSARSession;
|
|
97
|
+
if (!native?.startRecording) {
|
|
98
|
+
options.onRecordingError?.(new Error('ARCameraView.startRecording: native RNSARSession module not registered'));
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
if (recordingCallbacksRef.current !== null) {
|
|
102
|
+
options.onRecordingError?.(new Error('ARCameraView.startRecording: a recording is already in progress'));
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
recordingCallbacksRef.current = options;
|
|
106
|
+
native.startRecording({ path: '' })
|
|
107
|
+
.catch((err) => {
|
|
108
|
+
recordingCallbacksRef.current = null;
|
|
109
|
+
options.onRecordingError?.(err);
|
|
110
|
+
});
|
|
111
|
+
},
|
|
112
|
+
stopRecording: async () => {
|
|
113
|
+
const native = react_native_1.NativeModules.RNSARSession;
|
|
114
|
+
const callbacks = recordingCallbacksRef.current;
|
|
115
|
+
recordingCallbacksRef.current = null;
|
|
116
|
+
if (!native?.stopRecording || !callbacks) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
try {
|
|
120
|
+
const video = await native.stopRecording();
|
|
121
|
+
callbacks.onRecordingFinished?.(video);
|
|
122
|
+
}
|
|
123
|
+
catch (err) {
|
|
124
|
+
callbacks.onRecordingError?.(err);
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
}), []);
|
|
128
|
+
if (!NativeARCameraView
|
|
129
|
+
|| (react_native_1.Platform.OS !== 'ios' && react_native_1.Platform.OS !== 'android')) {
|
|
130
|
+
// Web / unsupported platforms get a clear "not available here"
|
|
131
|
+
// placeholder instead of a silent black rectangle. iOS +
|
|
132
|
+
// Android both ship the native component now.
|
|
133
|
+
return (react_1.default.createElement(react_native_1.View, { style: [styles.placeholder, style], accessibilityLabel: "AR camera unavailable" },
|
|
134
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.placeholderText }, "AR camera is not available on this platform.")));
|
|
135
|
+
}
|
|
136
|
+
return (react_1.default.createElement(react_native_1.View, { style: [styles.root, style] },
|
|
137
|
+
react_1.default.createElement(NativeARCameraView, { style: react_native_1.StyleSheet.absoluteFill }),
|
|
138
|
+
guidance ? (react_1.default.createElement(react_native_1.View, { style: styles.guidance, pointerEvents: "none", accessible: true, accessibilityRole: "text" },
|
|
139
|
+
react_1.default.createElement(react_native_1.Text, { style: styles.guidanceText, numberOfLines: 2 }, guidance))) : null));
|
|
140
|
+
});
|
|
141
|
+
const styles = react_native_1.StyleSheet.create({
|
|
142
|
+
root: {
|
|
143
|
+
flex: 1,
|
|
144
|
+
overflow: 'hidden',
|
|
145
|
+
},
|
|
146
|
+
placeholder: {
|
|
147
|
+
flex: 1,
|
|
148
|
+
alignItems: 'center',
|
|
149
|
+
justifyContent: 'center',
|
|
150
|
+
backgroundColor: '#000',
|
|
151
|
+
},
|
|
152
|
+
placeholderText: {
|
|
153
|
+
color: '#ffffff',
|
|
154
|
+
fontSize: 14,
|
|
155
|
+
},
|
|
156
|
+
guidance: {
|
|
157
|
+
position: 'absolute',
|
|
158
|
+
top: 0,
|
|
159
|
+
left: 0,
|
|
160
|
+
right: 0,
|
|
161
|
+
paddingHorizontal: 16,
|
|
162
|
+
paddingVertical: 10,
|
|
163
|
+
backgroundColor: 'rgba(0, 0, 0, 0.55)',
|
|
164
|
+
},
|
|
165
|
+
guidanceText: {
|
|
166
|
+
color: '#ffffff',
|
|
167
|
+
fontSize: 13,
|
|
168
|
+
},
|
|
169
|
+
});
|
|
170
|
+
//# sourceMappingURL=ARCameraView.js.map
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Camera — the public, props-based camera component for the
|
|
3
|
+
* `react-native-image-stitcher` library (publication target per the
|
|
4
|
+
* 2026-05-15 design doc).
|
|
5
|
+
*
|
|
6
|
+
* One component, both modes:
|
|
7
|
+
* - **Tap shutter** → single photo via vision-camera's takePhoto
|
|
8
|
+
* (non-AR) or ARFrame.capturedImage (AR).
|
|
9
|
+
* - **Hold shutter** → panorama capture; pan-and-release produces
|
|
10
|
+
* a stitched panorama JPEG via the incremental stitcher.
|
|
11
|
+
*
|
|
12
|
+
* One component, both capture sources:
|
|
13
|
+
* - **AR mode** (ARKit / ARCore) — used for pose-aware stitching
|
|
14
|
+
* when the device supports it.
|
|
15
|
+
* - **Non-AR mode** (vision-camera + IMU) — fallback path,
|
|
16
|
+
* forced when the 0.5× ultra-wide lens is selected (AR sessions
|
|
17
|
+
* are tied to a single physical lens; can't switch mid-session).
|
|
18
|
+
*
|
|
19
|
+
* The Camera component owns its runtime state (arPreference, lens,
|
|
20
|
+
* settings). Parent props are read as INITIAL VALUES at mount; the
|
|
21
|
+
* parent listens for state changes via the callback props. This
|
|
22
|
+
* "uncontrolled" model matches React's `<input>` convention and
|
|
23
|
+
* matches the design doc's intent (NF — component owns runtime state,
|
|
24
|
+
* parent persists via callbacks if desired).
|
|
25
|
+
*
|
|
26
|
+
* Scope note (step 2 of the SDK extract plan):
|
|
27
|
+
* - Props-driven API for both photo + panorama modes — DONE here.
|
|
28
|
+
* - Lens chip + AR toggle UI (U1) — DONE here.
|
|
29
|
+
* - `showSettingsButton` gates the existing PanoramaSettingsModal — DONE.
|
|
30
|
+
* - Imperative ref methods (`takePhoto()`, `startPanorama()`,
|
|
31
|
+
* `stopPanorama()`) — deferred; the built-in shutter button is the
|
|
32
|
+
* primary affordance for v0.1.0.
|
|
33
|
+
* - Forward-looking props (`defaultCompositingResolMP`,
|
|
34
|
+
* `defaultRegistrationResolMP`, `defaultSeamEstimationResolMP`)
|
|
35
|
+
* are accepted but currently no-ops — those fields don't exist on
|
|
36
|
+
* PanoramaSettings yet. They're declared so the public API is
|
|
37
|
+
* stable before they wire through; the wiring is a follow-up.
|
|
38
|
+
*
|
|
39
|
+
* See: docs/site-content/design/2026-05-15-react-native-image-stitcher-publication.md
|
|
40
|
+
*/
|
|
41
|
+
import React from 'react';
|
|
42
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
43
|
+
export type CaptureSource = 'ar' | 'non-ar';
|
|
44
|
+
export type CameraLens = '1x' | '0.5x';
|
|
45
|
+
export type StitchMode = 'auto' | 'panorama' | 'scans';
|
|
46
|
+
export type Blender = 'multiband' | 'feather';
|
|
47
|
+
export type SeamFinder = 'graphcut' | 'skip';
|
|
48
|
+
export type Warper = 'plane' | 'cylindrical' | 'spherical';
|
|
49
|
+
/**
|
|
50
|
+
* Result emitted via `onCapture`. Discriminated union keyed on
|
|
51
|
+
* `type` so consumers handle both photo and panorama outputs through
|
|
52
|
+
* one callback path.
|
|
53
|
+
*
|
|
54
|
+
* Identifier `CameraCaptureResult` (vs. the SDK's existing
|
|
55
|
+
* `CaptureResult` from `../types`) is intentional — the existing
|
|
56
|
+
* CaptureResult shape has SDK-specific fields (deviceMetadata,
|
|
57
|
+
* qualityReport, deviceUuid) that don't belong in the public RN
|
|
58
|
+
* library's surface. Step 3 (symbol rename) will retire the
|
|
59
|
+
* historical SDK-specific names; for now we keep both types
|
|
60
|
+
* side-by-side so the existing host code continues to work.
|
|
61
|
+
*/
|
|
62
|
+
export type CameraCaptureResult = {
|
|
63
|
+
type: 'photo';
|
|
64
|
+
uri: string;
|
|
65
|
+
width: number;
|
|
66
|
+
height: number;
|
|
67
|
+
} | {
|
|
68
|
+
type: 'panorama';
|
|
69
|
+
uri: string;
|
|
70
|
+
width: number;
|
|
71
|
+
height: number;
|
|
72
|
+
framesRequested: number;
|
|
73
|
+
framesIncluded: number;
|
|
74
|
+
framesDropped: number;
|
|
75
|
+
finalConfidenceThresh: number;
|
|
76
|
+
durationMs: number;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Errors surfaced via `onError`. Classified codes so consumers can
|
|
80
|
+
* branch on the kind of failure (toast vs retry vs report).
|
|
81
|
+
*/
|
|
82
|
+
export type CameraErrorCode = 'CAMERA_PERMISSION_DENIED' | 'CAMERA_DEVICE_UNAVAILABLE' | 'PHOTO_CAPTURE_FAILED' | 'PANORAMA_START_FAILED' | 'PANORAMA_FINALIZE_FAILED' | 'STITCH_NEED_MORE_IMGS' | 'STITCH_HOMOGRAPHY_FAIL' | 'STITCH_CAMERA_PARAMS_FAIL' | 'STITCH_OOM' | 'UNKNOWN';
|
|
83
|
+
export declare class CameraError extends Error {
|
|
84
|
+
readonly code: CameraErrorCode;
|
|
85
|
+
readonly cause?: unknown;
|
|
86
|
+
constructor(code: CameraErrorCode, message: string, cause?: unknown);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Frames-dropped info delivered via `onFramesDropped`. Fires once
|
|
90
|
+
* per panorama capture if the C+D progressive-confidence retry loop
|
|
91
|
+
* inside cv::Stitcher dropped one or more input frames.
|
|
92
|
+
*/
|
|
93
|
+
export interface FramesDroppedInfo {
|
|
94
|
+
requested: number;
|
|
95
|
+
included: number;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Camera component props. See the design doc's "Component API"
|
|
99
|
+
* section for the full rationale per field.
|
|
100
|
+
*/
|
|
101
|
+
export interface CameraProps {
|
|
102
|
+
defaultCaptureSource?: CaptureSource;
|
|
103
|
+
defaultLens?: CameraLens;
|
|
104
|
+
defaultStitchMode?: StitchMode;
|
|
105
|
+
defaultBlender?: Blender;
|
|
106
|
+
defaultSeamFinder?: SeamFinder;
|
|
107
|
+
defaultWarper?: Warper;
|
|
108
|
+
defaultFlowNoveltyPercentile?: number;
|
|
109
|
+
defaultFlowEvalEveryNFrames?: number;
|
|
110
|
+
defaultFlowMaxTranslationCm?: number;
|
|
111
|
+
defaultKeyframeMaxCount?: number;
|
|
112
|
+
defaultKeyframeOverlapThreshold?: number;
|
|
113
|
+
/** Forward-looking — wires through to cv::Stitcher's compositingResol
|
|
114
|
+
* once PanoramaSettings exposes the field (currently a no-op). */
|
|
115
|
+
defaultCompositingResolMP?: number;
|
|
116
|
+
/** Forward-looking — see above. */
|
|
117
|
+
defaultRegistrationResolMP?: number;
|
|
118
|
+
/** Forward-looking — see above. */
|
|
119
|
+
defaultSeamEstimationResolMP?: number;
|
|
120
|
+
enablePhotoMode?: boolean;
|
|
121
|
+
enablePanoramaMode?: boolean;
|
|
122
|
+
showSettingsButton?: boolean;
|
|
123
|
+
style?: StyleProp<ViewStyle>;
|
|
124
|
+
onCapture?: (result: CameraCaptureResult) => void;
|
|
125
|
+
onCaptureSourceChange?: (source: CaptureSource) => void;
|
|
126
|
+
onLensChange?: (lens: CameraLens) => void;
|
|
127
|
+
onFramesDropped?: (info: FramesDroppedInfo) => void;
|
|
128
|
+
onError?: (err: CameraError) => void;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The public `<Camera>` component.
|
|
132
|
+
*/
|
|
133
|
+
export declare function Camera(props: CameraProps): React.JSX.Element;
|
|
134
|
+
//# sourceMappingURL=Camera.d.ts.map
|