@andresxid/xid_camera_ocr_sdk_react 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 +24 -0
- package/README.md +223 -0
- package/dist/LICENSE-OpenCV.txt +202 -0
- package/dist/NOTICE-OpenCV.txt +43 -0
- package/dist/cv-worker.js +670 -0
- package/dist/index.cjs +2 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +459 -0
- package/dist/index.d.ts +459 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/opencv.js +51 -0
- package/package.json +79 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.0
|
|
4
|
+
|
|
5
|
+
Initial release of `@andresxid/xid_camera_ocr_sdk_react`, forked from `@andresxid/extract-sdk-*` 0.4.0.
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Theming: 14 `--xco-*` CSS variables through the `theme` prop, and exported `XCO_VARS`.
|
|
10
|
+
- Texts: per-key `texts` prop with es-MX defaults (`DEFAULT_TEXTS_ES`) and `DEFAULT_TEXTS_EN`.
|
|
11
|
+
- Tips card (`showTips`, default on) shown during `starting`/`loading_detector` before the first completed capture, hidden on `streaming`, dismissible with its button, and shown again on every `error` even if dismissed earlier.
|
|
12
|
+
- Zero-config Vite 5.4+, 6 and 7 (no `optimizeDeps` or `worker` setting), proven by the packed-tarball consumer matrix.
|
|
13
|
+
- `workerUrl` option (with `opencvUrl`) so CJS and non-Vite consumers can self-host `cv-worker.js` and `opencv.js`.
|
|
14
|
+
- Full demo (`examples/full-demo`) with a laboratorio signing backend.
|
|
15
|
+
|
|
16
|
+
### Removed
|
|
17
|
+
|
|
18
|
+
- The deprecated 0.4.0 APIs: `useOpenCV`, `detectDocument`, `classifyByAspect`, `assessQuality`, `CVWorkerClient.detect`.
|
|
19
|
+
- The Vue wrapper.
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Renamed the public names: `<XidCameraOcr />`, `useXidCameraOcr()`, `XidCameraOcrSession`, `XidCameraOcrSessionOptions`, root class `xid-camera-ocr`, inner classes `xco-*`, keyframes `xco-spin`.
|
|
24
|
+
- Vendored OpenCV needs `'unsafe-eval'` in the CSP (see README).
|
package/README.md
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
# @andresxid/xid_camera_ocr_sdk_react
|
|
2
|
+
|
|
3
|
+
React component and headless hook that capture an identity document in the browser: camera, on-device OpenCV edge detection, quality checks and an auto-shutter. It returns a rectified JPEG to your `onUpload` callback and knows nothing about your backend.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
The package is published as restricted. Add a token to your project `.npmrc` (keep the real token in the `NPM_TOKEN` environment variable, never in the file):
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm add @andresxid/xid_camera_ocr_sdk_react
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Peer dependencies: `react >=18` and `react-dom >=18`. There are no runtime dependencies. The library supports Node >= 18 (the full demo and the Vite consumer harness need Node >= 20.19 because they run Vite 7).
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
```tsx
|
|
22
|
+
import { XidCameraOcr } from '@andresxid/xid_camera_ocr_sdk_react';
|
|
23
|
+
|
|
24
|
+
export function Capture() {
|
|
25
|
+
return (
|
|
26
|
+
<XidCameraOcr
|
|
27
|
+
onUpload={async (blob, detectedType) => {
|
|
28
|
+
const form = new FormData();
|
|
29
|
+
form.append('document', blob, 'capture.jpg');
|
|
30
|
+
const res = await fetch('/api/extract', { method: 'POST', body: form });
|
|
31
|
+
if (!res.ok) throw new Error(`Upload failed: HTTP ${res.status}`);
|
|
32
|
+
return res.json();
|
|
33
|
+
}}
|
|
34
|
+
onResult={(result) => console.log(result)}
|
|
35
|
+
onError={(err) => console.error(err)}
|
|
36
|
+
/>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`onUpload` receives the rectified JPEG `Blob` and a shape hint (`'INE' | 'PASSPORT_MX' | 'OTHER' | null`). It must return the backend JSON. The hint is a card shape, not a document-type claim: your backend decides the real type.
|
|
42
|
+
|
|
43
|
+
Need your own UI? `useXidCameraOcr(options)` is the headless hook. It returns `videoRef`, `status`, `frame`, `result`, `error`, `start`, `stop`, `captureNow` and `retake`; attach `videoRef` to a `<video playsInline muted>` and render whatever you like. `XidCameraOcrSession` is the framework-free class underneath both.
|
|
44
|
+
|
|
45
|
+
## Backend pattern
|
|
46
|
+
|
|
47
|
+
The browser never holds a credential. It posts the JPEG to **your** backend, and your backend signs and forwards the request as `multipart/form-data` with the file in the `document` field:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
POST /v1/documents/extract
|
|
51
|
+
Authorization: Bearer mvk_<KEY_ID>
|
|
52
|
+
X-Xid-Timestamp: <ISO-8601 UTC, e.g. 2026-10-29T18:04:05.123Z>
|
|
53
|
+
X-Xid-Signature: <base64 Ed25519 signature>
|
|
54
|
+
Origin: <your allowed origin>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- The signed message is the canonical string `${METHOD}\n${PATH}\n${TIMESTAMP}` (for example `POST\n/v1/documents/extract\n2026-10-29T18:04:05.123Z`). The body is not signed.
|
|
58
|
+
- The timestamp must be within 5 minutes of the server clock.
|
|
59
|
+
- The secret key is a 32-byte Ed25519 seed, base64-encoded. Keep it on the server only (an environment variable, never in the browser bundle).
|
|
60
|
+
|
|
61
|
+
A minimal Node signer (Node >= 18, no dependencies):
|
|
62
|
+
|
|
63
|
+
```js
|
|
64
|
+
import { createPrivateKey, sign } from 'node:crypto';
|
|
65
|
+
|
|
66
|
+
const PKCS8_ED25519_PREFIX = Buffer.from('302e020100300506032b657004220420', 'hex');
|
|
67
|
+
const seed = Buffer.from(process.env.SECRET_KEY_B64, 'base64'); // 32 bytes
|
|
68
|
+
const privateKey = createPrivateKey({ key: Buffer.concat([PKCS8_ED25519_PREFIX, seed]), format: 'der', type: 'pkcs8' });
|
|
69
|
+
|
|
70
|
+
export function signedHeaders(method, path, { keyId, origin }) {
|
|
71
|
+
const ts = new Date().toISOString();
|
|
72
|
+
const signature = sign(null, Buffer.from(`${method}\n${path}\n${ts}`), privateKey);
|
|
73
|
+
return {
|
|
74
|
+
Authorization: `Bearer mvk_${keyId}`,
|
|
75
|
+
'X-Xid-Timestamp': ts,
|
|
76
|
+
'X-Xid-Signature': signature.toString('base64'),
|
|
77
|
+
Origin: origin,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Forward the browser's file with these headers (`form` is a `FormData` holding the JPEG under `document`):
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
const path = '/v1/documents/extract';
|
|
86
|
+
const upstream = await fetch(`${XID_ENDPOINT}${path}`, {
|
|
87
|
+
method: 'POST',
|
|
88
|
+
headers: signedHeaders('POST', path, { keyId: KEY_ID, origin: ORIGIN }),
|
|
89
|
+
body: form,
|
|
90
|
+
});
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Theming
|
|
94
|
+
|
|
95
|
+
Pass a `theme` object. The component writes a `--xco-*` custom property to its root only for the keys you set; everything else uses the default below. You can also set the variables from plain CSS on any ancestor.
|
|
96
|
+
|
|
97
|
+
```tsx
|
|
98
|
+
<XidCameraOcr theme={{ accent: '#0057ff', radius: '20px', fontFamily: 'Inter, sans-serif' }} onUpload={upload} />
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
| Variable | Default | Used by |
|
|
102
|
+
|---|---|---|
|
|
103
|
+
| `--xco-accent` | `#22c55e` | Detected-and-ready outline, spinner arc |
|
|
104
|
+
| `--xco-warning` | `#eab308` | Outline while the frame is detected but not yet stable |
|
|
105
|
+
| `--xco-danger` | `#ef4444` | Outline with no document, and on error |
|
|
106
|
+
| `--xco-background` | `#000` | Camera container background |
|
|
107
|
+
| `--xco-mask` | `rgba(0,0,0,0.4)` | Dim area outside the guide |
|
|
108
|
+
| `--xco-hint-bg` | `rgba(0,0,0,0.7)` | Hint banner background |
|
|
109
|
+
| `--xco-hint-fg` | `white` | Hint banner text |
|
|
110
|
+
| `--xco-button-bg` | `rgba(255,255,255,0.92)` | Retake button and tips dismiss button background |
|
|
111
|
+
| `--xco-button-fg` | `#111` | Retake and dismiss button text |
|
|
112
|
+
| `--xco-shutter` | `rgba(255,255,255,0.9)` | Shutter ring |
|
|
113
|
+
| `--xco-overlay-bg` | `rgba(0,0,0,0.78)` | Status overlay and tips card background |
|
|
114
|
+
| `--xco-overlay-fg` | `white` | Status overlay and tips card text |
|
|
115
|
+
| `--xco-font-family` | `system-ui, -apple-system, sans-serif` | All text |
|
|
116
|
+
| `--xco-radius` | `12px` | Guide rectangle, hint banner, tips card and its dismiss button |
|
|
117
|
+
|
|
118
|
+
`XCO_VARS` (the same table as data) and the `XidCameraOcrTheme` / `XcoThemeKey` types are exported. The retake button keeps a fixed 22px pill radius, and the shutter's inner disc, its translucent glass and the spinner track are fixed (solid or translucent white); they are not themable.
|
|
119
|
+
|
|
120
|
+
The inner `xco-*` class names are an implementation detail and **not** a supported API; theme through the variables.
|
|
121
|
+
|
|
122
|
+
## Texts
|
|
123
|
+
|
|
124
|
+
Every visible string can be overridden per key with the `texts` prop (`Partial<HintCopy>`). Missing (or `null`/`undefined`) keys fall back to the es-MX default; an empty string is kept as given. For English start from the exported `DEFAULT_TEXTS_EN`:
|
|
125
|
+
|
|
126
|
+
```tsx
|
|
127
|
+
import { XidCameraOcr, DEFAULT_TEXTS_EN } from '@andresxid/xid_camera_ocr_sdk_react';
|
|
128
|
+
|
|
129
|
+
<XidCameraOcr texts={DEFAULT_TEXTS_EN} onUpload={upload} />
|
|
130
|
+
<XidCameraOcr texts={{ done: 'Captured!' }} onUpload={upload} />
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
| Key | Default (es-MX) |
|
|
134
|
+
|---|---|
|
|
135
|
+
| `idle` | Toca para activar la cámara |
|
|
136
|
+
| `starting` | Abriendo la cámara… |
|
|
137
|
+
| `loading_detector` | Preparando la cámara… |
|
|
138
|
+
| `no_document` | Coloca tu identificación dentro del recuadro |
|
|
139
|
+
| `too_small` | Acerca más tu identificación |
|
|
140
|
+
| `too_dark` | Hay poca luz, busca un lugar más iluminado |
|
|
141
|
+
| `glare` | Hay un reflejo, inclina un poco tu identificación |
|
|
142
|
+
| `blurry` | Espera a que la cámara enfoque |
|
|
143
|
+
| `hold_still` | No te muevas… |
|
|
144
|
+
| `ready` | ¡Perfecto! No te muevas |
|
|
145
|
+
| `capturing` | Tomando la foto… |
|
|
146
|
+
| `uploading` | Revisando tu identificación… |
|
|
147
|
+
| `done` | ¡Listo! |
|
|
148
|
+
| `error` | Algo salió mal, inténtalo de nuevo |
|
|
149
|
+
| `detector_unavailable` | Toma la foto con el botón blanco |
|
|
150
|
+
| `retake` | Tomar otra vez |
|
|
151
|
+
| `capture` | Tomar foto |
|
|
152
|
+
| `tip_light` | Busca un lugar con buena luz |
|
|
153
|
+
| `tip_glare` | Evita reflejos: no apuntes una lámpara directo a tu identificación |
|
|
154
|
+
| `tip_focus` | Espera a que la cámara enfoque; la foto se toma sola |
|
|
155
|
+
| `tips_dismiss` | Entendido |
|
|
156
|
+
|
|
157
|
+
The tips card (`tip_light`, `tip_glare`, `tip_focus`, `tips_dismiss`) shows while the camera starts or the detector loads (`starting`, `loading_detector`) before the first completed capture, and hides once the status is `streaming`. The user can dismiss it with its button, but it returns on every `error` even if it was dismissed earlier. Hide it entirely with `showTips={false}`.
|
|
158
|
+
|
|
159
|
+
## Options
|
|
160
|
+
|
|
161
|
+
`XidCameraOcrProps` (the hook accepts the same options except the view props):
|
|
162
|
+
|
|
163
|
+
| Prop | Type | Default | Notes |
|
|
164
|
+
|---|---|---|---|
|
|
165
|
+
| `onUpload` | `(blob, detectedType) => Promise<ExtractResult>` | required | Your backend call |
|
|
166
|
+
| `onFrameAnalyzed` | `(state: FrameState) => void` | | Every analysed frame |
|
|
167
|
+
| `onCaptured` | `(blob, detectedType) => void` | | Right after the shutter |
|
|
168
|
+
| `onResult` | `(result) => void` | | After `onUpload` resolves |
|
|
169
|
+
| `onError` | `(err: Error) => void` | | Camera, detector or upload failure |
|
|
170
|
+
| `autoStart` | `boolean` | `true` | Start the stream on mount |
|
|
171
|
+
| `autoCapture` | `boolean` | `true` | Auto-shutter on a stable, good frame |
|
|
172
|
+
| `documentTypes` | `DocumentType[]` | `['INE', 'PASSPORT_MX']` | Sizes the fallback guide; does not filter detection |
|
|
173
|
+
| `stableFramesRequired` | `number` | `10` | Stable frames before auto-capture |
|
|
174
|
+
| `captureQuality` | `number` | `0.92` | JPEG quality, 0 to 1 |
|
|
175
|
+
| `captureResolution` | `'standard' \| 'high'` | `'standard'` | Long side 1024 px or 1600 px |
|
|
176
|
+
| `opencvUrl` | `string` | packaged `opencv.js` | Self-hosted `dist/opencv.js`; required with `workerUrl` for CJS and non-Vite bundlers (see Known limitations) |
|
|
177
|
+
| `workerUrl` | `string` | packaged `cv-worker.js` | Self-hosted `dist/cv-worker.js`, spawned as a module worker; required with `opencvUrl` for CJS and non-Vite bundlers |
|
|
178
|
+
| `theme` | `XidCameraOcrTheme` | `{}` | See Theming |
|
|
179
|
+
| `texts` | `Partial<HintCopy>` | es-MX defaults | See Texts |
|
|
180
|
+
| `showTips` | `boolean` | `true` | Tips card |
|
|
181
|
+
| `hideStatusOverlay` | `boolean` | `false` | Hides everything drawn over the video: guide and detected outline, hint banner (including the tap-to-start button), shutter, retake button, loader and tips card |
|
|
182
|
+
| `className`, `style` | | | On the root `xid-camera-ocr` element |
|
|
183
|
+
|
|
184
|
+
## Status lifecycle
|
|
185
|
+
|
|
186
|
+
`idle` -> `starting` -> `loading_detector` -> `streaming` -> `capturing` -> `uploading` -> `done` | `error`.
|
|
187
|
+
|
|
188
|
+
- `stopped` is reached after `stop()`.
|
|
189
|
+
- One capture per run: after `done` or `error`, `retake()` stops and restarts the run to arm the shutter again.
|
|
190
|
+
- If OpenCV cannot load, the status stays `streaming` with the frame hint `detector_unavailable`: auto-capture is off but the manual shutter still works.
|
|
191
|
+
|
|
192
|
+
## Vite
|
|
193
|
+
|
|
194
|
+
Vite 5.4+, 6 and 7 work with a plain config: no `optimizeDeps`, `worker` or other SDK-specific setting. The worker and `opencv.js` are referenced by package-specifier asset URLs that Vite resolves in dev and in builds. This is verified by an automated Vite 5/6/7 consumer test in our CI tooling (pnpm Vite 5/6/7 dev and preview, npm Vite 7 dev and preview, and Vite 7 under the CSP below).
|
|
195
|
+
|
|
196
|
+
## Content Security Policy
|
|
197
|
+
|
|
198
|
+
The strict policy the automated consumer test runs under:
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
default-src 'self'; script-src 'self' 'unsafe-eval' 'wasm-unsafe-eval'; worker-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' blob:; connect-src 'self'
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
Why each directive:
|
|
205
|
+
|
|
206
|
+
- `default-src 'self'`: the baseline; everything not listed below is same-origin only.
|
|
207
|
+
- `script-src 'self' 'wasm-unsafe-eval'`: `wasm-unsafe-eval` lets OpenCV instantiate its WebAssembly.
|
|
208
|
+
- `script-src ... 'unsafe-eval'`: the vendored `opencv.js` embind layer builds functions from strings at startup. Without it the detector fails to start and the hint becomes `detector_unavailable` (manual capture still works). Removing the need for it requires rebuilding OpenCV with `-sDYNAMIC_EXECUTION=0`.
|
|
209
|
+
- `worker-src 'self'`: the detector runs in a module worker served from your origin (no `blob:` or `data:` workers).
|
|
210
|
+
- `style-src 'self' 'unsafe-inline'`: the component injects inline keyframes; without it only the spinner animation stops.
|
|
211
|
+
- `img-src 'self' blob:`: the component itself loads no images. `blob:` is only needed if your page previews the captured `Blob` with `URL.createObjectURL`; drop it otherwise.
|
|
212
|
+
- `connect-src 'self'`: your upload endpoint on the same origin. Add your API origin here if it differs.
|
|
213
|
+
|
|
214
|
+
## Known limitations
|
|
215
|
+
|
|
216
|
+
- **Detection quality (0.4.0 gate not met).** The detector was inherited from 0.4.0 and has not been improved here. On the detection eval, hand-occlusion IoU is 0.492 against a 0.90 threshold and clutter IoU is 0.534 against 0.80. The false-positive rate is unmeasured. Keep the manual shutter reachable and treat auto-capture as a convenience, not a guarantee.
|
|
217
|
+
- **Phone validation.** Phone validation (iOS Safari / Android Chrome) is in progress; results will be published in a later release.
|
|
218
|
+
- **CJS build needs `workerUrl` and `opencvUrl`.** The CJS bundle resolves `import.meta.url` against the document, not the package. CJS consumers must serve `dist/cv-worker.js` and `dist/opencv.js` from their own origin (copy them from `node_modules/@andresxid/xid_camera_ocr_sdk_react/dist/`) and pass both URLs; otherwise the detector cannot start and only manual capture works. ESM consumers on Vite need nothing.
|
|
219
|
+
- **Non-Vite bundlers are untested** (webpack, Rollup alone, esbuild, Next.js). Host `dist/cv-worker.js` and `dist/opencv.js` yourself and pass both `workerUrl` and `opencvUrl`; otherwise only manual capture works.
|
|
220
|
+
|
|
221
|
+
## License
|
|
222
|
+
|
|
223
|
+
UNLICENSED, proprietary to XID. The bundled OpenCV (`dist/opencv.js`) is Apache-2.0; its notices ship in `dist/LICENSE-OpenCV.txt` and `dist/NOTICE-OpenCV.txt`.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
opencv.js (opencv-core-imgproc.js) — third-party notice
|
|
2
|
+
|
|
3
|
+
This file contains OpenCV 4.10.0 (https://github.com/opencv/opencv, tag 4.10.0,
|
|
4
|
+
commit 71d3237a093b60a27601c20e9ee6c3e52154e8b1).
|
|
5
|
+
Copyright (C) OpenCV contributors. Licensed under the Apache License, Version 2.0;
|
|
6
|
+
the full licence text is in LICENSE-OpenCV.txt.
|
|
7
|
+
|
|
8
|
+
Modified: this is a custom whitelist build, not an upstream release. Only the core and
|
|
9
|
+
imgproc modules are compiled, and only the functions listed in the SDK's
|
|
10
|
+
tools/opencv-build/opencv_js.config.py get JavaScript bindings. It was compiled to
|
|
11
|
+
WebAssembly with Emscripten 3.1.64 by tools/opencv-build (build.sh / Dockerfile). The UMD
|
|
12
|
+
wrapper was patched (`Module = {}` -> `var Module = {}`) so it is valid strict-mode ESM.
|
|
13
|
+
|
|
14
|
+
Artifact: vendor/opencv-core-imgproc.js
|
|
15
|
+
sha256: a76095316514442b4b6a240c311ddaf535b6dfa07c547a7092dca7356f03e0de
|
|
16
|
+
|
|
17
|
+
The build also links zlib 1.3.1, bundled by OpenCV as 3rdparty/zlib, under the zlib
|
|
18
|
+
licence reproduced below.
|
|
19
|
+
|
|
20
|
+
--- zlib licence (3rdparty/zlib/LICENSE at the same OpenCV commit) ---
|
|
21
|
+
|
|
22
|
+
Copyright notice:
|
|
23
|
+
|
|
24
|
+
(C) 1995-2022 Jean-loup Gailly and Mark Adler
|
|
25
|
+
|
|
26
|
+
This software is provided 'as-is', without any express or implied
|
|
27
|
+
warranty. In no event will the authors be held liable for any damages
|
|
28
|
+
arising from the use of this software.
|
|
29
|
+
|
|
30
|
+
Permission is granted to anyone to use this software for any purpose,
|
|
31
|
+
including commercial applications, and to alter it and redistribute it
|
|
32
|
+
freely, subject to the following restrictions:
|
|
33
|
+
|
|
34
|
+
1. The origin of this software must not be misrepresented; you must not
|
|
35
|
+
claim that you wrote the original software. If you use this software
|
|
36
|
+
in a product, an acknowledgment in the product documentation would be
|
|
37
|
+
appreciated but is not required.
|
|
38
|
+
2. Altered source versions must be plainly marked as such, and must not be
|
|
39
|
+
misrepresented as being the original software.
|
|
40
|
+
3. This notice may not be removed or altered from any source distribution.
|
|
41
|
+
|
|
42
|
+
Jean-loup Gailly Mark Adler
|
|
43
|
+
jloup@gzip.org madler@alumni.caltech.edu
|