Fit the background brightness from the photo border and subtract it, so side-lit photos threshold cleanly. The clicked pixel (or, without a click, the border) decides whether the piece is darker or lighter, replacing the invert checkbox. Adds the MDF-on-wood-floor photo as a regression fixture. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
977 B
Markdown
28 lines
977 B
Markdown
# Real photo fixtures
|
|
|
|
Regression photos for `detect()`. Each entry in `manifest.json` is checked by `tests/fixtures.test.ts`.
|
|
|
|
To add one:
|
|
|
|
1. Take a top-down photo of a scrap piece with something of known length visible.
|
|
2. Rotate it upright and resize it so the long side is at most 2000 px. Save as JPEG.
|
|
EXIF orientation is ignored by the test decoder.
|
|
3. Measure the real piece's bounding box in mm.
|
|
4. Open the photo in the app, set the scale, and note px/mm, the threshold you used, and,
|
|
if needed, a seed point (shown in image px).
|
|
5. Add an entry:
|
|
|
|
```json
|
|
{
|
|
"file": "plywood-1.jpg",
|
|
"threshold": null,
|
|
"seed": null,
|
|
"pxPerMm": 3.21,
|
|
"expected": { "widthMm": 412, "heightMm": 287, "holes": 2 },
|
|
"toleranceMm": 8
|
|
}
|
|
```
|
|
|
|
`threshold: null` means Otsu's automatic value. `holes` is optional; leave it out when
|
|
background texture creates noise holes. Without a known scale, use `pxPerMm: 1` and sizes in px. `seed` is `{ "x": ..., "y": ... }` or `null`.
|