Decompose: Implement real auto-digitize engine #3
Labels
No labels
blocked:commit-ready-failed
blocked:gate-fetch
blocked:gate-lint
blocked:gate-plan
blocked:gate-research
blocked:needs-attention
blocked:needs-decision
blocked:needs-human
blocked:no-changes
blocked:verify-failed
bug
deferred
feature-request
in-progress
needs-decompose
needs-triage
quickfix
security/medium
triage-approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Mark/Kimi_Agent_Brother_10_Digitizing_App#3
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Auto-Digitize Engine — Research & Engineering Spec
Context
The Workspace page already has the data model for an auto-digitize engine:
src/components/workspace/types.tsdefinesStitchObject,ColorRegion,StitchType, and theWorkspaceStateshape.src/components/workspace/useWorkspace.tsdefinesautoDigitizeSettings(withstitchPreference, density,minStitchLength) and theSET_AUTO_DIGITIZE_SETTING/SET_STITCH_OBJECTSactions.src/components/workspace/LeftToolbar.tsxregisters theauto-digitizetool (Wand2 icon,Ashortcut) and themanual-stitchtool.src/components/workspace/ExportDialog.tsxandAppHeader.tsxconsumestitchObjectsto drive the export flow.The stub in
useWorkspace.tsproduces fakeColorRegion[]after a timer fires. Realdigitizing has to convert the input raster into a hierarchy of stitch objects that a
Brother Entrepreneur PR-10 10-needle machine can actually sew.
Why this can't be a single ticket: the pipeline is image processing → geometry →
binary serialization. Each stage has independent libraries, failure modes, and
acceptance criteria. Conflating them into one ticket produces a partial implementation
that ships nothing usable.
Target
Given an uploaded raster image (PNG/JPG, ≤ 4MP for v1), produce a
StitchObject[]that:
running stitch for thin detail).
manual re-thread planning that v1 doesn't attempt).
Non-Goals (v1)
Pipeline Stages
The work splits cleanly into 5 stages, ordered by data dependency. Each is a
separate sub-issue with its own research spike, design, and implementation.
P1: Image Ingestion & Color Quantization
Goal: Convert a raster input into a
ColorRegion[]of axis-aligned-ish polygons,each tagged with the dominant quantized color.
Inputs:
Filefrom upload (PNG, JPG, WebP), max 4MP (downscale if larger).Approach candidates:
Outputs:
ColorRegion[]where each region has{ id, polygon: Point[], color: {src: string, paletteIndex: number | null} }. Polygon should be a simple contour(usable by Phase 3/4 stitch generators).
Acceptance:
Files: new
src/lib/digitize/regions.ts, integration insrc/components/workspace/useWorkspace.tsto replace the timer stub.P2: Region Classification
Goal: For each
ColorRegionfrom P1, assign aStitchType('satin' | 'tatami-fill' | 'running' | 'skip').Heuristics:
Used for borders, text, narrow decorative shapes.
not extreme. Used for solid color fills.
outlines and fine detail.
Tunables: expose
satinAspectThreshold,tatamiMinAreaMm2,runningAspectRatioin
autoDigitizeSettingswith sensible defaults.Acceptance:
Files: new
src/lib/digitize/classify.ts, types insrc/components/workspace/types.ts.P3: Satin Column Stitch Generation
Goal: For each region tagged
satinin P2, generate the parallel stitch strokesthat make up a satin column. This is the workhorse of embroidery digitizing — most
logos and text are satin.
Algorithm outline:
parallel stitch pairs.
conventions.
Output:
StitchObject[]of typesatin, each containing a list of{x, y}needle-down points representing the full stitch run.Acceptance:
Files: new
src/lib/digitize/satin.ts.P4: Tatami Fill Stitch Generation
Goal: For each region tagged
tatami-fillin P2, generate parallel stitch rowscovering the region interior with optimal direction.
Algorithm outline:
via
autoDigitizeSettings.fillDirection).density.
coverage for thin fabrics — Brother PR-10 default is on).
Output:
StitchObject[]of typefill.Acceptance:
Files: new
src/lib/digitize/fill.ts.P5: Thread Palette Mapping & Engine Integration
Goal: Map each detected region's color to the closest Brother thread catalog
entry, then wire the full P1→P2→P3/P4 pipeline into the auto-digitize tool's action
handler in the Workspace.
Sub-steps:
/ Brother "Polyneon" 40wt color card used by the machine). Embed as
src/lib/digitize/palette.ts(Lab values for ΔE-2000 distance).src/components/workspace/useWorkspace.tsto invoke the P1→P2→P3/P4pipeline when the auto-digitize tool fires, replacing the timer stub.
src/components/workspace/RightPanel.tsxto show progress / previewbefore committing stitch objects to state.
stitchObjectsthrough to the existing ExportDialog (whichwill be made real in #2).
Acceptance:
stitchObjects[]for atest image.
Files:
src/lib/digitize/palette.ts, modifications touseWorkspace.tsandRightPanel.tsx.Dependencies
stitchObjectswhosesemantics are defined by P3/P4. Export can be implemented in parallel for the
binary serialization side, but full end-to-end testing of #2 needs P1–P4 done.
outputs of P1/P2/P3/P4. P1–P4 themselves ship without tests, but write the code
to be testable (pure functions where possible).
Research Required
This issue is large enough that a research spike is warranted before scheduling
P1–P5. The spike should:
not a runtime dep;
embroidery-ts; custom).P3; direction optimization for P4).
count, thread palette source).
visual fidelity.
A
blocked:needs-decisionshould appear on P1 if the spike isn't complete.Auto-triage: needs decompose
Marked
triage-approved+needs-decompose. decompose-executor will pick this up and break it into implementable sub-issues.Implement real auto-digitize engineto Decompose: Implement real auto-digitize engineMark referenced this issue2026-06-22 15:28:13 +00:00
Mark referenced this issue2026-06-22 15:28:14 +00:00
Mark referenced this issue2026-06-22 15:28:15 +00:00
Mark referenced this issue2026-06-22 15:28:16 +00:00
Mark referenced this issue2026-06-22 15:28:18 +00:00
This issue has been decomposed into the following sub-issues:
ColorRegion[]of axis-aligned-ish polyColorRegionfrom P1, assign aStitchType(`'satin'satinin P2, generate the parallel stitch strtatami-fillin P2, generate parallel stitch rEach sub-issue has been labeled with
triage-approvedand is ready for queue routing.