scanic 1.4.0 โ 1.4.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.
- package/README.md +20 -22
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ Traditional web scanning solutions often force a trade-off:
|
|
|
43
43
|
- ๐ฆ **WASM Core**: High-performance Gaussian Blur, Canny Edge Detection, and Dilation.
|
|
44
44
|
- ๐ ๏ธ **Modern API**: Clean, Promise-based API with full **TypeScript** support.
|
|
45
45
|
- ๐ฆ **Featherweight**: Under **100KB** total size (gzipped).
|
|
46
|
-
- ๐ค **Optional ML detector**:
|
|
46
|
+
- ๐ค **Optional ML detector**: switch to a neural corner detector for hard photos with `detector: 'ml'`. It is lazy loaded, needs no extra install, and uses a custom minimal ONNX Runtime build of about 1.5 MB instead of the usual 13 MB. See the [ML detection guide](https://marquaye.github.io/scanic/guide/ml-detection).
|
|
47
47
|
- ๐งช **Production Grade**: Built-in regression tests with physical image baselines.
|
|
48
48
|
|
|
49
49
|
## ๐ What's New
|
|
@@ -52,8 +52,8 @@ See the [**full documentation**](https://marquaye.github.io/scanic), the
|
|
|
52
52
|
[**changelog**](CHANGELOG.md), and the [**releases**](https://github.com/marquaye/scanic/releases)
|
|
53
53
|
for the latest. Recent highlights:
|
|
54
54
|
|
|
55
|
-
- **Optional ML detector
|
|
56
|
-
- **Styleable corner editor
|
|
55
|
+
- **Optional ML detector**: a neural corner detector (`detector: 'ml'`) for hard photos such as cluttered backgrounds, low contrast, or strong perspective. Lazy loaded and opt in. See the [ML detection guide](https://marquaye.github.io/scanic/guide/ml-detection).
|
|
56
|
+
- **Styleable corner editor**: a built-in, touch friendly UI to fine tune detected corners, now fully themeable via CSS variables with a polished default toolbar. See the [corner editor guide](https://marquaye.github.io/scanic/guide/corner-editor).
|
|
57
57
|
- **New docs site** with guides for Web/Node.js/Electron/React/Vue and an interactive in-browser playground.
|
|
58
58
|
|
|
59
59
|
---
|
|
@@ -101,10 +101,10 @@ if (extracted.success) {
|
|
|
101
101
|
}
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
-
### ML
|
|
104
|
+
### ML detection (optional)
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
|
|
106
|
+
On harder photos you can switch to a neural detector that is more robust. It is
|
|
107
|
+
opt in per call with `detector: 'ml'`, and it needs no extra install:
|
|
108
108
|
|
|
109
109
|
```bash
|
|
110
110
|
npm install scanic
|
|
@@ -116,26 +116,24 @@ import { scanDocument } from 'scanic';
|
|
|
116
116
|
const result = await scanDocument(imageElement, { detector: 'ml' });
|
|
117
117
|
if (result.success) {
|
|
118
118
|
console.log(result.corners);
|
|
119
|
-
console.log(result.score); // P(document present), 0
|
|
119
|
+
console.log(result.score); // P(document present), 0 to 1
|
|
120
120
|
}
|
|
121
121
|
```
|
|
122
122
|
|
|
123
|
-
The ONNX Runtime
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
package): a 1.9 MB
|
|
127
|
-
Runtime
|
|
128
|
-
|
|
129
|
-
|
|
123
|
+
The ONNX Runtime JavaScript API is bundled as a lazy chunk (about 50 KB, roughly
|
|
124
|
+
15 KB gzipped) that loads only when you use `detector: 'ml'`. On that first call
|
|
125
|
+
scanic fetches about 2 MB from a CDN (the companion
|
|
126
|
+
[`scanic-ml`](https://www.npmjs.com/package/scanic-ml) package): a 1.9 MB model
|
|
127
|
+
plus a custom minimal ONNX Runtime build of about 1.5 MB, which is roughly 88
|
|
128
|
+
percent smaller than the stock 13 MB runtime while running at the same speed. See
|
|
129
|
+
the [ML detection guide](https://marquaye.github.io/scanic/guide/ml-detection)
|
|
130
|
+
for options, self hosting, and threading.
|
|
130
131
|
|
|
131
|
-
> UMD
|
|
132
|
-
>
|
|
133
|
-
>
|
|
132
|
+
> Using the UMD or `<script>` build? The bundled runtime applies to the ESM build.
|
|
133
|
+
> For ML there, add `onnxruntime-web@1.23.x` to your page yourself, since the UMD
|
|
134
|
+
> format cannot split code into separate chunks.
|
|
134
135
|
|
|
135
|
-
|
|
136
|
-
for the full size/speed story, warm-up, self-hosting, and threading.
|
|
137
|
-
|
|
138
|
-
### Manual Corner Adjustment UI (New)
|
|
136
|
+
### Manual corner adjustment UI
|
|
139
137
|
|
|
140
138
|
Use the built-in corner editor to let users drag corners on mobile and desktop,
|
|
141
139
|
then pass the confirmed corners into extraction.
|
|
@@ -259,7 +257,7 @@ The primary function for detecting and extracting documents.
|
|
|
259
257
|
| `assetBaseUrl` | `string` | jsDelivr `scanic-ml` | Base URL serving the `.wasm` + `.ort` assets. Set to self-host. |
|
|
260
258
|
| `modelUrl` | `string` | `${assetBaseUrl}doccornernet_lean.ort` | Explicit model URL. |
|
|
261
259
|
| `wasmPaths` | `string` | `assetBaseUrl` | Directory for the ORT wasm/loader. |
|
|
262
|
-
| `modelBytes` | `Uint8Array` |
|
|
260
|
+
| `modelBytes` | `Uint8Array` | (none) | Pre fetched model bytes (skips the network). |
|
|
263
261
|
| `numThreads` | `number` | `1` | ORT threads. `>1` needs COOP/COEP headers. |
|
|
264
262
|
| `minScore` | `number` | `0.5` | Minimum P(document) for `success: true`. |
|
|
265
263
|
|