FlowCells

Segments any image on the CPU: few cells, high fidelity, no training.

Segmentation

FlowCells segments images. Given any picture, it divides it into connected cells that follow its shapes and texture, crowding where detail is dense and stretching along edges. It runs on the CPU, needs no training, and takes a couple of seconds. The cells prove themselves by rebuilding the picture: on the standard rocket photograph, 6,374 of them, each with its own small color model, reproduce the frame at 30 dB. Few segments, high fidelity and no GPU make it competitive with the state of the art, and there is little else like it.

The rocket

Six panels of the rocket photograph: the input, the support measure, 6,374 colored cells, the hard affine and ridge reconstruction, the soft finish, and the remaining residual energy, which is concentrated on the launch towers
The 640 × 427 rocket photograph, its support measure, its 6,374 cells, the reconstruction before and after the soft finish, and the error that remains. The frame is rebuilt at 30.009 dB in about two seconds.

Method

FlowCells on a test image of a dark bar across an orange disc: the input, its cartoon and texture, the field of support ellipses, the sites drawn from the measure, and the resulting cells
A test image, its cartoon and texture, the support tensor drawn as ellipses, the sites drawn from its measure, and the cells with their readout.

FlowCells begins from one cartoon and texture decomposition of the image, computed once with BFFT's Meyer model and then held fixed. The cartoon carries region-scale structure and the texture carries fine directional detail. Together with the defect between the cartoon and its smoothed projection, they define a support tensor at every pixel, which says how large a cell may be there and in which direction it may stretch. The tensor's area form is a density: cells crowd where it is high and spread out where it is low.

A long, straight edge can hold one long cell. Along a curve the same cell would leave the feature, so a curvature correction adds population only where a straight support no longer fits. A deterministic low-discrepancy sequence then turns the density into the complete set of sites in one pass, with no requested count, no ranking, and no spawning or deletion.

Three diagrams: one long elliptical cell lying along a straight line; the same cell under a curve, which leaves it by kappa a squared over 2b; and three shorter cells following the curve
A straight feature keeps one long cell. On a curve the same cell departs by κa²/(2b), so the population grows there and nowhere else.

Each site claims ground by anisotropic first arrival through the same geometry, which makes every region connected without a repair pass. One reverse pass through that front returns each site's support to it and lets the site move without changing the topology. Each cell then fits an affine color model in OKLab and, where the residual justifies it, one nonlinear ridge. A final soft step relaxes internal boundaries the image does not support, while the cells still form a partition of unity.

Across five 256-pixel test images, the curvature correction alone improves the reconstruction by 0.43 to 2.68 dB.

Cells

Owner
The site whose support reaches the pixel first.
Runner-up
The neighboring claimant, which makes every interface explicit.
Parent
In the hierarchy, the cartoon cell that contains a texture microcell.
Chart
Normal, tangent and scale coordinates relative to the owner, for local fitting.
Model
The affine fit, with at most one ridge, chosen for the support the cell actually owns.
Residual
The error that remains, attached to its place, where any further refinement begins.

Hierarchy

FlowCells also has a two-level form. Cells are first placed on the cartoon alone at half scale, then their boundaries are refined at full resolution without creating or deleting any. The texture, defined exactly as the image minus that refined cartoon, receives its own microcells. Each belongs to one cartoon parent, competes only with its siblings and never crosses its parent's boundary. Under-resolved microcells split locally and compatible flat ones merge, so the partition never restarts.

Six panels of the rocket photograph: the input, its cartoon, 1,120 cartoon cells outlined in red, the texture energy concentrated on the towers and rocket, 6,029 texture microcells outlined in blue inside the red cartoon cells, and the reconstruction
The rocket photograph, its cartoon and 1,120 cartoon cells; its texture, the 6,029 texture microcells drawn in blue inside their red parents, and the reconstruction at 34.46 dB.

On the rocket, the two levels together rebuild the frame at 34.46 dB in a quarter of a second. The saving grows with the image: on a 1440 × 1799 photograph the hierarchy reaches 34.07 dB in 3.36 seconds with 12,093 cartoon cells, where the single-level method took about 7 seconds and 32,854 cells to reach 35.82 dB.

Uses

Two tools in the BFFT repository build on this structure. A PNG-to-SVG vectorizer organizes an image as coarse owners, full-resolution interfaces and residual children, following the hierarchy above. An experimental JPEG optimizer separates a cartoon from its exact residual texture and grows connected regions of compatible blocks, then smooths color only where the encoded bytes and decoded error show the image can afford it, while still writing ordinary JPEG files.

References