Touch up a photo

Method

How the refusal is measured

A tap that cannot finish the job says so and changes nothing. Here is the test it runs, the corpus it is checked against, and the numbers — 87.0 % precision, 69.9 % recall — generated, never retyped.

The method, in plain words

  1. A tap makes a disc. Its radius is the long edge of the file divided by 56, held between 14 and 56 pixels; on these 14-pixel tiles it is 14 px.
  2. Before anything is written, the tool reads a ring of untouched picture just outside the disc. Its average is the colour of the surroundings.
  3. Inside the disc it takes the third of the pixels furthest from that colour — the thing you tapped. A speck two pixels across would vanish in an average; the distant third keeps it.
  4. If more than 8 % of the ring still looks like that thing, the thing carries on past the disc. The tap is refused and nothing is changed.
  5. A Patch loop is read the same way, on the band outside the loop, in sixteen sectors round it, so a pole leaving through two sides is caught even when the loop is long.

Three examples from the corpus

TileWhat it isRing measuredOutcome
sky-specks-01A dark speck on a pale sky0.0 %Filled
poles-01A pole crossing the disc24.1 %Refused: too big for one tap
level, upright stripesStructure exactly uprightno tilt readRefused: nothing reads as off level

The same stripes turned by 3° read as 2.5°: the reading works in quarter-degree steps and is smoothed over five of them.

The numbers

MeasureValue
Tiles in the corpus312
Cut (share of the ring)8 %
Precision — of the taps refused, how many needed a region87.0 %
Recall — of the tiles that needed a region, how many were refused69.9 %
Over-refusal — of the tiles one tap could fix, how many were refused8.9 %
Find specks — proposals that were a planted speck79.7 % (102 of 128)
Find specks — planted specks it ringed98.1 % (102 of 104)
Measured2026-10-24

By class

ClassTilesCalled right
sky specks2626 (100.0 %)
sensor dust2626 (100.0 %)
raindrops2626 (100.0 %)
wires263 (11.5 %)
poles2626 (100.0 %)
foliage2615 (57.7 %)
brickwork2613 (50.0 %)
fabric2625 (96.2 %)
text2626 (100.0 %)
skin2626 (100.0 %)
products2626 (100.0 %)
scanned paper2616 (61.5 %)

What the numbers say

  • Thin wires and pen lines are mostly not refused by a tap: a line two or three pixels wide is too small a share of the disc for the ring to see. That is what the Heal stroke is for — drag along a line instead of tapping it.
  • Brickwork and foliage are where the cut is least sure. The seam shows a smear before you save; a refusal is not the only safeguard.
  • A tool that refuses too often is worse than one that promises too much, so over-refusal is published beside recall. Both are held by a test: a change to the engine that moves either below its floor fails the build.

What the corpus is, and is not

312 tiles in twelve classes — sky specks, sensor dust, raindrops, wires, poles, foliage, brickwork, fabric, text, skin, products and scanned paper — drawn by this site's own code from fixed seeds. Each label is true by construction: the thing under the tap either stops inside one disc or carries on past it. That makes the corpus reproducible, free of anyone else's photographs, and a fair test of the arithmetic. It is not a set of real photographs, and real photographs are harder; a photographed corpus, labelled by two people, is still to come.

Try the refusal yourself on Remove spots from a photo, or draw a loop on Remove small objects from a photo.

Photographic visual for Refusal Test

Refusal Test