← f_ notebook · ideas/f_perona.md

f_perona — Perona-Malik diffusion filter (working name) ​

Status: ⚪ concept only, overlap not fully checked. Captured 2026-11-28 (Claude offline, docs only) from ideas/visualpde_survey.md, where it was the one candidate that is an image processor, not a generator. The equation is observed in VisualPDE's presets.js; the overlap grep was shallow (see Overlap). Nothing tried. A sleeper: unranked until the overlap check is done.

Why this one ​

Perona-Malik is edge-preserving smoothing by nonlinear diffusion: smooth flat regions, leave edges. Every other PDE candidate generates; this one takes a texture in, which matches most of the library (processors, not generators). It also has a time axis, so the same module can run as a slow melting look (as the filter runs, textures flatten into cartoon-like regions) and not only as a one-shot filter.

The equation (VisualPDE PeronaMalik, observed) ​

du/dt = div( exp(-D v) grad u )         v = |grad u|^2   (a second field set from u_x^2 + u_y^2)

u starts from an image (I_T) thresholded by (1 + tanh(5 (1 - I_T - 0.4))) / 2 plus noise sigma (RAND - 0.5); constants D = 5, sigma = 1 (slider 0 to 2); dt 0.0002; spatial step 0.2. The diffusion coefficient exp(-D v) falls as the gradient grows, so edges stop diffusing.

What f_ would offer ​

  • A texture inlet (the image) and a strength (the D above, edge threshold), iterations or rate (how far it has evolved), and a noise seed term.
  • Outlets: the filtered texture; the edge map (the diffusivity itself, exp(-D v)) as a scalar; and possibly the gradient vecfield of the smoothed result.
  • Temporal use: it can run continuously on a live feed, with the image re-injected, so it behaves like a temporal processor like f_dynamics, not a stateless one.

Overlap (partial; not verified) ​

  • A grep of docs/f-reference/module-inventory.md, docs/max-reference/jit_fx.md and jit_fx_vs_ideas.md for "perona" and "anisotrop" found nothing that is edge-preserving diffusion. Matches were f_tf_sharpen, f_vf_glow (anisotropic along a vecfield) and jit.fx.cf.kuwahara (an anisotropic painterly filter). Kuwahara is the likely nearest neighbor (edge-preserving smoothing, a different method); it ships with Max. Whether it covers the use is a question for a Max test, not this note.
  • f_tf_aniso_blur smooths along a tensor axis. The relation to Perona-Malik (also anisotropic, by the gradient) was not read.
  • The jit.fx docs were an offline read of about 24 of 109 ideas files; their inferred items are not verified (CLAUDE.md).

Solver and cost [inferred, unchecked] ​

Explicit real-space like the RD modules, but with a nonlinear diffusivity per step and an extra scalar (v). Each step needs the gradient at neighbors, so a few texture reads per pixel per step. VisualPDE runs it at dt = 0.0002, dx = 0.2: dt / dx^2 = 0.005 per unit diffusivity (derived), so a large substep count per unit model time, which means a real per-frame cost question.

Open questions ​

  1. Does jit.fx.cf.kuwahara, f_tf_aniso_blur or a chain of existing modules already do the job?
  2. Stateless iterations (N steps from the input each frame) versus a temporal state that evolves.
  3. Edge detection function: exp(-D v) versus 1 / (1 + D v) (the other classic form); only the first is in the clone.
  4. Whether it belongs under PDE, Color / Tone, or Space & Optics. It is a PDE, but its job is processing.

Gate ​

P-pattern-gen (loosely). Menu home undecided (G-menu).