feat: trim textured background (wood grain) touching a smooth piece

Keep the piece's smooth core, then grow it back to restore the true edges.
Removes the wood-knot and grain leaks on the MDF-on-floor photo. Pieces that
are textured themselves are left untouched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
immortaly007andClaude Opus 5.5 committed 2026-10-15 15:25:53 +02:00
1 parent 077c3cc31d
commit e925ce66d5
4 files changed
+112 -11

No files matched your search

+2 -2
View File
@@ -1,4 +1,4 @@
import { detectPrepared, prepareImage, preparedThreshold, type PreparedImage } from './detect';
import { detectPrepared, disposePrepared, prepareImage, preparedThreshold, type PreparedImage } from './detect';
import { prepareForExport } from './geometry';
import { loadPhoto } from './load-image';
import { shapeFromPolygons } from './margin';
@@ -69,7 +69,7 @@ export class AppState {
}
private prepare() {
this.prepared?.gray.delete();
if (this.prepared) disposePrepared(this.prepared);
const { cv, image } = this;
this.prepared = cv && image ? prepareImage(cv, image) : null;
this.threshold = cv && this.prepared ? preparedThreshold(cv, this.prepared) : DEFAULT_THRESHOLD;