Split stitching into a hardware-independent myscan.stitching package
stitch.py and pagegraph.py mixed laser odometry, image registration,
frame correction, canvas handling, pose-graph maths and the two stitchers.
They are now modules of myscan/stitching, which imports nothing from the
device code:
geometry rigid transforms, pose vectors, warp_add
filters grayscale, high-pass, feather weights
correct Corrector: undistortion + flat field (and weighted variant)
odometry LaserOdometry: the laser model and the phase-correlation
override, shared by both stitchers
register ECC, phase correlation, SIFT matching, overlap agreement
canvas growable Canvas, layout, parallel render, normalize/compose
posegraph robust Gauss-Newton, largest connected component
loops keyframes and loop-closure candidates
pagegraph PageGraph, now orchestration only
incremental Stitcher, on the shared Canvas
The stitchers take a Corrector and an odometry object (anything with
predict()) instead of building them, so another device can supply its
own motion prior. live.py drops its own canvas and normalisation for the
shared ones; PageGraph's mosaic check uses the parallel renderer.
Output on scan_text is unchanged (global stitcher identical, incremental
within 1 grey level). stitch.py --live now applies lens correction too
(--no-undistort restores the old output).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,9 +6,15 @@ Linux driver tools for the Hama myScan (00052343) scanner mouse, a Dacuda design
|
||||
- `myscan/xu.py` — UVC extension-unit access: switch between mouse and scan mode, LEDs, exposure
|
||||
- `myscan/frame.py` — fix the lying JPEG header and decode the per-frame sensor record (laser dx/dy)
|
||||
- `myscan/calib.py` — per-device calibration from the mouse's EEPROM: colour gains, flat field, lens undistortion
|
||||
- `myscan/pagegraph.py` — assemble a page from all frames at once: frame-to-frame registration, loop closures
|
||||
between passes, pose-graph optimisation (used by `scan.py` and `stitch.py`)
|
||||
- `myscan/stitch.py` — the older live, frame-by-frame stitcher (`stitch.py --live`) and shared helpers
|
||||
- `myscan/stitching/` — page stitching, independent of the scanner hardware (no device imports), so it can
|
||||
be used elsewhere: `from myscan.stitching import Corrector, PageGraph`. Its modules, lowest level first:
|
||||
`geometry` (rigid transforms, poses), `filters` (grayscale, high-pass, feather weights), `correct`
|
||||
(`Corrector`: lens undistortion + flat field), `odometry` (`LaserOdometry`, the myScan's laser motion
|
||||
prior; another device can pass its own object with `predict()`), `register` (ECC, phase correlation, SIFT
|
||||
matching, overlap check), `canvas` (weighted canvases, page composition, parallel rendering), `posegraph`
|
||||
(robust pose-graph optimisation), `loops` (loop-closure candidates), and the two stitchers built from them:
|
||||
`pagegraph` (`PageGraph`: assembles the page from all frames at once with loop closures between passes;
|
||||
used by `scan.py` and `stitch.py`) and `incremental` (`Stitcher`: frame by frame, `stitch.py --live`)
|
||||
- `tools/scan.py` — scan with the button: `python tools/scan.py` (press to start, press again to stop).
|
||||
`--view [PORT]` serves a live view at `http://<host>:8000/`: the camera, the page as it is stitched
|
||||
(re-solved every 1.5 s, current position outlined), Start/Stop buttons, PNG/JPEG download of the finished
|
||||
|
||||
Reference in New Issue
Block a user