ComfyUI Node

PAGE

The edge detector that doesn't give up on faint edges

By JPrevots·Created 2 years ago·Updated 2 years ago· 1
PAGE
  • image
  • IMAGE
mu_10.00
mu_20.35
sigma_10.05
sigma_20.70
mu_1_strength0.80
mu_2_strength0.80
sigma_LPF0.10
thresh_min0.00
thresh_max0.90
morph_flagtrue

You know how Canny gives you crisp lines but just stares past a soft, hazy edge - a shadow, a fog line, a watermark? PAGE is the node from the PhyCV family built for exactly that fight. Its full name is Phase-Stretch Adaptive Gradient-field Extractor, and the word that matters is "adaptive": where Canny applies one scale and calls it done, PAGE runs two phase filters at once so it catches edges of wildly different widths and contrasts in the same pass. It was born in the UCLA research world for biomedical and satellite imagery, where edges don't have the decency to be clean.

It's not machine learning in the neural-net sense. No weights, no model files, no API key. PAGE is a classical signal-processing transform - physics-inspired computer vision - and it runs entirely on the phycv library, the same pack that powers its siblings PST and VEViD.

How it works

Most edge detectors differentiate pixels. PAGE works in the phase domain instead. The image's frequency spectrum gets pushed through two band-pass phase filters: a normally-distributed one with center mu_1 and width sigma_1 (tuned for fine detail), and a log-normal one with center mu_2 and width sigma_2 (tuned for coarse structure). Each filter has its own phase strength - mu_1_strength and mu_2_strength - which sets how hard it pushes the phase response. Two filters is the whole trick: a faint edge that one scale misses still shows up in the other.

After the filters, sigma_LPF smooths the result, thresh_min and thresh_max gate which edge magnitudes survive, and morph_flag cleans up holes and specks. Read the thresholds the counterintuitive way: PAGE keeps edges below thresh_min and above thresh_max, and suppresses the mushy middle band.

The inputs that matter

  • image - any ComfyUI IMAGE, one at a time.
  • mu_1 / sigma_1 (defaults 0 / 0.05) - the fine filter. Narrow sigma = fine detail.
  • mu_2 / sigma_2 (defaults 0.35 / 0.7) - the coarse filter. Broad sigma = big structure.
  • mu_1_strength / mu_2_strength (defaults 0.8 each) - how hard each filter pushes. This is the dial you actually turn when the map looks empty or overblown.
  • thresh_min / thresh_max (defaults 0 / 0.9) - edge-strength gate.

The output is a single IMAGE: the edge map. Unlike PST and VEViD, PAGE has no kernel-visualization output - it's pure extraction, and that's what makes it the cleanest of the three to wire into something.

Where it fits

Feed the edge map into a ControlNet the same way you'd feed a Canny or lineart preprocessor output. If your subject is full of soft boundaries - fur, smoke, hair, an overcast photo - PAGE keeps the structure Canny flattens into noise. You can also drop it before img2img to push a source's contours. The cost of the adaptive magic is fiddliness: the defaults are research-oriented, so budget a few minutes of threshold poking before it sings.

Install

Both ways are the usual song:

# Option 1: ComfyUI Manager → Custom Nodes → search "ComfyUI-PhyCV" → install → restart

# Option 2: manual
cd ComfyUI/custom_nodes
git clone https://github.com/JPrevots/ComfyUI-PhyCV
# restart ComfyUI

Dependencies: torch, torchvision, opencv-python, and phycv (the UCLA library) - Manager pulls them in. Nothing to download from HuggingFace, no checkpoints.

The gotchas

The big one, and it applies to every node in this pack: it's CUDA-only. The code instantiates the GPU implementations with a hardcoded torch.device("cuda") - no CPU or MPS fallback. On a CPU-only box or a Mac it will throw the moment you run it. Also feed it one image at a time: the node squeezes and reshapes the tensor assuming a single frame, so a batched IMAGE (like video frames) comes out scrambled.

One honest warning: this repo ships without a README - the Comfy Registry lists it at a tidy v1.0.1 and that's about the whole documentation story. It works, but you're the documentation. Nobody's posting tutorials about it, either. The upside of being obscure is that when it clicks, you've got an edge detector most workflows don't have.

CategoryPhyCV

Inputs (11)

NameTypeDefaultDescription
imageIMAGE
mu_1FLOAT0.00
mu_2FLOAT0.35
sigma_1FLOAT0.05
sigma_2FLOAT0.70
mu_1_strengthFLOAT0.80
mu_2_strengthFLOAT0.80
sigma_LPFFLOAT0.10
thresh_minFLOAT0.00
thresh_maxFLOAT0.90
morph_flagBOOLEANtrue

Outputs (1)

NameTypeDescription
IMAGEIMAGE