A drawn or scanned pattern is a picture of strokes, not a list of machine moves. Engraving wood from hand-drawn artwork is the sharpest case: flourishes branch mid-line, stroke widths vary, and the width of each stroke is really a cutting depth. A contour tells you where edges run, but the tool must follow the middle of each stroke and cut as deep as the stroke is wide. This guide shows the pipeline that gets you there: threshold, thin to a one-pixel skeleton, trace the skeleton as a graph, calibrate pixels to millimetres, then size every cut from its stroke width. You leave with the depth formula, a worked sign example, the interference limit and a pre-cut checklist.
Why the outline is not the toolpath
A contour is a bookkeeping of edges. Follow one with a cutter and you trace a single side of each stroke, doubling the path length and leaving an uncut ridge down the middle. The line a stroke-shaped toolpath needs is the medial axis: the set of points that sit equidistant from the nearest edges on both sides. Skeletonization computes it by peeling the filled region inward, one boundary layer at a time, until what remains is a one-pixel-wide remnant that keeps each stroke's reach and its connections.
Width matters as much as position here, because in carved artwork the stroke width encodes the cutting depth. A contour loses that: it reports the boundary, not the half-width at each point. If your current work stops at converting contour coordinates to point arrays, you have the boundary; the pipeline below starts from the filled image instead and recovers the middle line and the width in one pass.
Text set in ordinary fonts is boundary art by design, so thinning letters gives wobbly, off-centre results. The shortcut for type is a single-line font that emits centerline engraving G-code directly; reserve skeletonization for scanned hand lettering and drawn ornaments.
The pipeline: threshold, thin, trace, calibrate
Six steps take a pattern image to a depth-tagged path file:
- Threshold the image to binary, strokes as foreground. Pick the method from the image's own histogram; the auto-threshold methods for grayscale images cover the choices.
- Clean it: a median filter kills scan noise, a morphological close bridges hairline gaps in scanned ink, and an opening removes speckles that would otherwise become fake branches.
- Thin the foreground to a one-pixel skeleton.
- Measure width: a distance transform over the filled image records, for every skeleton point, the distance to the nearest background pixel. Local stroke width is twice that distance.
- Trace the skeleton as a graph and order the moves.
- Calibrate and emit: convert pixels to millimetres, attach a depth to every branch from its width, and write the path file your code reads and writes for the engraver.
Calibration and resolution obey one relation:
Keep at least 10 pixels across the narrowest stroke you intend to cut; below that, strokes merge and thinning invents branches.
Thinning to a one-pixel skeleton
Skeletonization erodes the foreground layer by layer but never lets an erosion disconnect or shorten a stroke; what survives is the medial axis. Implementations that also return the distance-transform value at each skeleton point hand you the half-width of the stroke there. Read the width of a branch by taking the maximum value along it; that maximum is the number your depth calculation uses.
Two clean-ups separate a usable path set from a hairball. First, prune: thinning grows short spurs wherever width changes or noise pinches a stroke, so delete any branch shorter than about three times its local stroke width; a real flourish branch is longer than that by design. Second, simplify: fit lines and arcs through the skeleton points with a tolerance of 0.5-1 px, which absorbs the ±1 px jitter thinning leaves without rounding away small features.
Endpoints, junctions and the order of cuts
The skeleton is a graph. Points with one neighbour are endpoints (degree 1); points with three or more are junctions (degree ≥ 3); the runs between them are branches. Tracing rules that hold up on real ornament artwork:
- Start at an endpoint and walk the branch to its junction.
- At a junction, continue into the longest unvisited branch; the shortest is the cheapest to come back for.
- Between separate strokes, jump to the nearest unvisited endpoint; nearest-neighbour ordering roughly halves air moves against reading the skeleton in scan order.
- Cut all branches of one depth class before stepping Z down again; grouped depths mean far fewer vertical cycles.
Depth and endpoint shapes come straight from the graph. Each branch carries the width its distance-transform maximum gives, so each branch gets its own depth. Where branches meet, give the shared junction the deepest of the depths meeting it, so no shallow re-cut mars a deep groove. Endpoint shape is a decision, not an artifact: stop on the point for a square end, or sweep a semicircle of radius = half the local stroke width around the endpoint at full depth for a rounded end. Simply stopping lets the bit's cone leave a V-shaped pit, which reads as a third kind of end. Pass through a junction without lifting only when the junction's stroke width is at least the groove width at that depth; otherwise lift, rapid, and re-enter.
Worked example: a 60° V-bit on a 300 × 200 mm carved sign
Inputs, with their sources:
- Field: 300 mm × 200 mm, the sign blank; the engraving task itself sets this.
- Image: 3000 × 2000 px with the pattern filling the frame; the capture setting from the section below.
- Stroke measurement: distance-transform maximum of 15 px on a test branch; pipeline output.
- Tool: V-bit with a 60° included angle, a standard engraving geometry; a 90° bit is the other common choice.
The rule, in words: pixel scale divides the field by the pixel count, and a V-bit of included angle θ widens its groove by 2·tan(θ/2) for every millimetre of depth, so the depth that fills a stroke of width w exactly is w divided by 2·tan(θ/2).
Arithmetic:
- Scale: 300 mm / 3000 px = 0.1 mm/px.
- Width: w = 2 × 15 px × 0.1 mm/px = 3.0 mm.
- Depth, 60° bit: 3.0 mm / (2 × tan 30°) = 3.0 mm / 1.1547 = 2.60 mm.
- Depth, 90° bit: 3.0 mm / (2 × tan 45°) = 3.0 mm / 2 = 1.50 mm.
- Depth quantization: ±1 px is ±0.1 mm of width, which is ±0.09 mm of depth.
Decision: cut this branch 2.60 mm deep with the 60° bit, expecting ±0.09 mm of depth scatter from pixel quantization alone. Widths of 2 mm and more take their full computed depth on a sign this size; narrower strokes meet the interference limit first.
| Stroke width | Depth, 60° bit | Depth, 90° bit |
|---|---|---|
| 1.0 mm | 0.87 mm | 0.50 mm |
| 2.0 mm | 1.73 mm | 1.00 mm |
| 3.0 mm | 2.60 mm | 1.50 mm |
| 4.0 mm | 3.46 mm | 2.00 mm |
Interference: how deep before strokes merge
At full depth a V-bit's groove is as wide as the stroke it fills, which is fine until two strokes sit close together. Two grooves merge when the distance between their centerlines is less than the groove width. Take the densest hatch on the same sign: branches 2.5 mm apart center to center. At the 2.60 mm depth above, each groove is 2 × 2.60 mm × 0.5774 = 3.0 mm wide, more than the 2.5 mm spacing, so the hatch would fuse into a ribbon.
The fix is arithmetic, not judgement: cap those branches at d_max = s / (2·tan(θ/2)) = 2.5 mm / 1.1547 = 2.17 mm, and program 2.1 mm there. If the design cannot lose depth, steepen the tool: with a 30° bit, d_max = 2.5 mm / (2 × tan 15°) = 2.5 mm / 0.5359 = 4.7 mm, so the full 2.60 mm cut passes. Add the bit's tip flat, typically 0.1-0.2 mm on engraving bits, to the groove width when strokes sit within half a millimetre of the limit. Check the densest region of every design before committing depths.
Capturing the artwork square and sharp
Physical patterns, whether the carver's own drawings or an existing piece to reproduce, need a calibrated image. Shoot top-down with the lens axis square to the board, keep the sheet flat, and light it evenly; a 1 mm height step across a 300 mm field already bends the scale by about 0.3%. Calibrate against a ruler lying in the pattern's plane rather than trusting the nominal field: mm per pixel = known length / measured length in px. If the camera sits at an angle, correct the warp first; mapping pixel coordinates through a homography is the standard fix.
For the resolution budget: 0.1 mm/px over 300 mm needs 3000 px across, so 3000 × 2000 px covers the worked sign exactly, and a 6 MP sensor supplies that. Mono sensors give cleaner thresholds for ink-on-paper artwork, and a polarized light source kills glare from varnished wood and pencil sheen.
- Interface
- GigE
- Resolution
- 6-10 MP
- Interface
- GigE
- Resolution
- Up to 3 MP
The MV-SC5060XM-08M-WBN covers a whole sign in one frame; the LS-SMC-0063 suits smaller tiles, with its integrated white light polarized for glossy surfaces. If you are assembling the capture rig from parts, start at the camera step of the configurator.
Running the pipeline beside the machine
The pipeline is ordinary image code: threshold, thinning, distance transform, graph walk. You read the image and your code writes the path file; no vision software brand sits in the middle. Where the design is fixed and simple, an on-device decision in one of the smart cameras is enough. Where panels change per shift, or the light and trigger wiring live in the same box, a compact vision controller next to the engraver runs the trace continuously and switches the illumination itself.
- LAN ports
- 3-4 LAN ports
- USB 3 ports
- 2 USB 3 ports
- Light outputs
- 4 built-in channels
- Memory
- 8 GB
Hand-off is a coordinate transform, not a new problem: the same conversion that sends image coordinates to robot coordinates for servo moves sends branch points to a router or gantry in its work coordinate system. Calibration fixes the scale; the machine's origin fixes the offset.
More worked vision-to-machine cases sit on the applications topic page.
Where the centerline answer is wrong
Four cases call for a different tool:
- Solid filled areas, a logo block or a filled leaf, are shapes, not strokes. Offset the contour inward instead; the skeleton of a fat blob is arbitrary and wobbles.
- Halftone and photographic shading has no strokes to center. Threshold it as a region and clear it with a hatch fill, or leave it out.
- Width that varies along one stroke still works, but depth must follow it: quantize width into depth steps of about 0.5 mm of width and emit one segment per step.
- Strokes under about 10 px wide at capture resolution merge with their neighbours. Raise the resolution; do not sharpen your way out.
Broken ink lines are the borderline case: a morphological close of 2-3 px bridges hairline gaps before thinning, but a close wider than that starts welding neighbouring strokes together. Tune the close on your worst scan, not your best.
Checks before you cut
- Threshold: polarity checked on a corner; the narrowest stroke survives at 10 px or more.
- Calibration: ruler line in the pattern's plane; scale re-measured at two opposite corners and agreeing within 1%.
- Skeleton: one branch per drawn stroke; spurs pruned; endpoints landing on the drawn endpoints.
- Depths: each branch's depth from the width table; junctions assigned the deepest meeting depth; dense regions checked against the merge limit.
- First article: dry run above the stock, then a scrap cut, then measure the groove width against the design width before the real blank goes in.
If a design fails one of these, send us the scan and its stroke-width range through the contact page and we will walk the pipeline with you. To price the capture and compute side of the cell, the system configurator walks camera, lens, light and controller in order; importing raster artwork into CAM for a first path is covered step by step in configuring engraving geometry from a JPEG image.
Questions
Can I engrave from the outline instead of the centerline?
Yes, for shapes you want hollowed: an outline path with an inward offset gives a controlled floor width on a closed logo or leaf. On stroke art the outline runs twice per stroke and carries no width information, so it cannot assign a depth. Keep both tools: centerline for line art where width encodes depth, contour-offset for solid fills.
How accurate is the traced path compared with the drawing?
Thinning snaps strokes to the pixel grid, so expect ±1 px of jitter, which is ±0.1 mm at 0.1 mm per pixel; fitting lines and arcs with a 0.5-1 px tolerance smooths it without rounding small features. The larger error source is capture, not thinning: an out-of-plane sheet or an angled camera shifts the scale, so calibrate against a ruler in the pattern's plane.
What image resolution does centerline extraction need?
Plan for at least 10 pixels across the narrowest stroke you must cut. At 0.1 mm per pixel, a 1 mm stroke is 10 px wide, and a 300 × 200 mm sign then needs 3000 × 2000 px, which a 6 MP sensor covers exactly. Below that, thin strokes merge and thinning invents false branches; raise the resolution rather than tuning thresholds.
Do I need to skeletonize text set in ordinary fonts?
No. Ordinary fonts are boundary art, and thinning letters produces wobbly, off-centre strokes that lose the typeface's weight. Use a single-line engraving font, whose glyph skeletons are drawn in and which emits the centerline path directly, and skeletonize only scanned hand lettering. In a mixed design, keep font text and traced artwork as separate path groups and assign depths independently.
How do I handle a stroke whose width changes along its length?
The distance transform stores a half-width at every skeleton point, so depth can follow the stroke instead of averaging it. Quantize the width into steps, for example 0.5 mm of width per depth step, and emit one path segment per step at its own depth. Adjacent steps need a tool lift unless they differ by less than the bit's tip flat.


