@scanmate/align 0.0.2

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.
@@ -0,0 +1,36 @@
1
+ import type { Matrix3, TransformModel } from '@scanmate/ink';
2
+ import type { Correspondence } from './fit-transform.use-case.js';
3
+ /**
4
+ * RANSAC: fit the model that the largest number of correspondences agree with.
5
+ *
6
+ * Feature matching on a document produces a lot of confident nonsense, because
7
+ * the page is full of things that genuinely look identical — every lowercase
8
+ * "e", every corner of every table cell. Least squares over all of them is
9
+ * dragged wherever the wrong ones point. RANSAC ignores the average: it draws
10
+ * the smallest sample that determines a transform, counts how many of the rest
11
+ * that transform explains, and repeats. A wrong sample agrees with almost
12
+ * nothing; the right one agrees with everything real on the page.
13
+ */
14
+ export interface RansacOptions {
15
+ model: TransformModel;
16
+ /** A correspondence is an inlier when it reprojects within this many pixels. */
17
+ threshold: number;
18
+ maxIterations?: number;
19
+ /** Probability of having drawn at least one all-inlier sample. Drives early exit. */
20
+ confidence?: number;
21
+ /** Below this many inliers the answer is rejected outright. */
22
+ minInliers?: number;
23
+ seed?: number;
24
+ }
25
+ export interface RansacResult {
26
+ matrix: Matrix3;
27
+ /** Indices into the input array. */
28
+ inliers: number[];
29
+ inlierRatio: number;
30
+ iterations: number;
31
+ /** Mean reprojection error over the inliers, in pixels. */
32
+ error: number;
33
+ }
34
+ export declare function ransac(matches: readonly Correspondence[], options: RansacOptions): RansacResult | null;
35
+ export declare function findInliers(matches: readonly Correspondence[], matrix: Matrix3, threshold: number): number[];
36
+ //# sourceMappingURL=ransac.use-case.d.ts.map
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@scanmate/align",
3
+ "version": "0.0.2",
4
+ "description": "Put a scanned or photographed page back onto the original it came from: deskew, rescale and register, trying transform models until one is good enough.",
5
+ "license": "MIT",
6
+ "author": "Eduardo Russo",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/russoedu/scanmate.git",
10
+ "directory": "packages/align"
11
+ },
12
+ "homepage": "https://github.com/russoedu/scanmate/tree/main/packages/align#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/russoedu/scanmate/issues"
15
+ },
16
+ "keywords": [
17
+ "scan",
18
+ "alignment",
19
+ "image-registration",
20
+ "deskew",
21
+ "homography",
22
+ "orb",
23
+ "ransac",
24
+ "document"
25
+ ],
26
+ "type": "module",
27
+ "main": "./dist/index.esm.js",
28
+ "module": "./dist/index.esm.js",
29
+ "types": "./dist/src/index.d.ts",
30
+ "exports": {
31
+ "./package.json": "./package.json",
32
+ ".": {
33
+ "types": "./dist/src/index.d.ts",
34
+ "import": "./dist/index.esm.js",
35
+ "default": "./dist/index.esm.js"
36
+ }
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "!**/*.tsbuildinfo",
41
+ "!**/*.d.ts.map",
42
+ "!**/*.js.map"
43
+ ],
44
+ "dependencies": {
45
+ "@scanmate/ink": "^0.0.2"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public"
49
+ }
50
+ }