Canny edge extractor: converts each Image to greyscale, runs hysteresis edge detection over a configurable threshold pair and Sobel aperture, and emits a binary edge Mask aligned to the input frame.
Typical backends
A structural edge mask is extracted per frame and used to drive a crop of the region of interest from the source image.
Edge masks from recorded video are drawn back over the frames for a live edge overlay.
Caveats
- I/O contractThe output is a binary
Mask, not a 3-channel Image, so a consumer expecting an RGB edge map (for example a diffusion ControlNet) needs a separate mask-to-image conversion. - CompatibilityA non-greyscale input goes through a BGR-to-grey conversion before edge detection, so non-photographic inputs are still interpreted under the BGR colour assumption.
- FallbackAn empty
Image short-circuits to an empty Mask without invoking the detector. - Hard constraintThe Sobel aperture must be 3, 5, or 7; any other value aborts the call inside the detector.
- Parameter interactionThe low and high thresholds form a hysteresis pair: pixels above the upper threshold are always kept and pixels above the lower one only when connected to a strong edge, so setting them equal degenerates to a single threshold; the L2 gradient option trades a little speed for a more accurate gradient norm.
- State lifetimeAll parameters are captured once at first invocation; runtime changes have no effect and require a redeploy.