REF · METHOD

Box-Counting Dimension

Turning "how rough is it" into a number somebody else can check

Cited from: Topic 32, Scale Invariance and Fractals

01The Question It Poses

"This coast is more ragged than that one." "This material is more porous." "The vessels on this scan are sparser." You can see all of these at a glance and say almost nothing about what you are seeing. Classical geometry is no help: in the Euclidean scheme any curve has dimension 1 no matter how many turns it takes, and any surface has dimension 2 no matter how many holes it carries. Roughness falls straight through that language.

Box counting asks: can we build a quantity that returns 1 for a smooth curve, 2 for something that fills the plane, and something in between for things in between? And it must be computable from a real photograph or a real map, with no prior knowledge of how the figure was generated. That last condition is the entire reason it beats the self-similarity recipe (magnify by k, get N copies): the recipe needs the generating rule, and in practice all you have is a picture.

02The Rules

  1. Lay the figure over a grid of boxes of side ε.
  2. Count how many boxes the figure touches — touching counts as 1, no matter how much of the box is covered. Call it N(ε).
  3. Shrink ε (halving is common, or dividing by a fixed factor) and return to step 2, building up a series of (ε, N(ε)) pairs.
  4. Plot log(1/ε) on the horizontal axis against log N(ε) on the vertical.
  5. Take the slope of the straight portion of that plot. That is the box-counting dimension D. Formally, D is the limit of log N(ε) ÷ log(1/ε) as ε goes to zero.

The words "straight portion" in step 5 are the heart of the method and the step most often skipped. Real data always bends at both ends of the log-log plot: when boxes approach the size of the whole figure, N flattens out; when they approach the pixel size of the image (or the grain size of the material), you are counting your resolution rather than the shape. Only the middle stretch carries a slope, and a report has to state where that stretch starts and ends.

03What You See When It Runs

Calibrate first on three figures whose answers are known: a straight diagonal (should give 1), a filled square (should give 2), and a Koch curve (exactly log4÷log3 ≈ 1.26).

One grid, three figures a straight line side 12 → 10 side 6  → 20 D ≈ 0.97 a filled square side 12 → 100 side 6  → 400 D ≈ 2.00 the Koch curve side 12 → 24 side 6  → 56 D ≈ 1.22 Halve the side: the line doubles, the square quadruples, the Koch curve goes up 2.3×. The exponent of that factor is the dimension.
Halve the box side and the three counts rise by 2×, 4× and 2.3×. Different exponents, different dimensions.

Put all four grid sizes on log-log axes and each of the three gives a straight line with its own slope. That is the whole reason the method is usable.

The three sets on log-log axes — the slope is the dimension straight line D≈0.97 filled square D≈2.00 Koch curve D≈1.22 12 6 3 1.5 box side (smaller to the right) → boxes hit (log) Where the lines sit does not matter; only the slopes do. The Koch curve is exactly 1.26 and measures 1.22 here — the systematic shortfall you get on a finite drawing.
How high a line sits depends on how big the figure is and says nothing about dimension; only the slope means anything.

Look at the Koch column: the exact answer is 1.26 and the plot measures 1.22. That gap is not a drawing error, it is the method's systematic bias — over a finite figure and a finite range of box sizes, box counting always undershoots slightly. Closing the gap means shrinking the boxes by several more orders of magnitude, which real data rarely allows. So any reported D should be read as "the slope within this scaling window", not as an intrinsic property of the figure.

04What It Explains

Terrain and coastlines. Ranking coasts by D matches what the eye says (South Africa around 1.05, the west coast of Britain around 1.25, the Norwegian fjords around 1.52), and the number tells you directly how much switching rulers will cost you: the larger D is, the more the measured length jumps when you change map resolution.

Porous materials and interfaces. The pore structure of catalyst supports, activated carbon and battery electrodes has a box-counting dimension that tracks specific surface area. What engineering usually cares about is not D itself but the change in D — how far apart two process routes put the same material is how much more crumpled one of them made the interface.

Morphological measures in medical imaging. Retinal vessel networks, trabecular bone, tumour margins and bronchial trees have all been quantified this way. The value is that it converts "looks sparser, looks more irregular" into a continuous variable that can enter a statistical model, instead of a reader's subjective score.

The geometry of critical systems. The cluster that has just spanned a percolation lattice has a fractal dimension known exactly in two dimensions: 91/48 ≈ 1.90 → ref · Percolation. Results like that double as calibration objects: if your code cannot recover 1.90 on a simulated percolation cluster, the problem is your code, not your data.

What It Cannot Explain

Further Reading