FrequencyImageWatermarker<T>
Models & Types · AiDotNet.Safety.Watermarking
Keyed Fourier-ring image watermarker: adds a key-derived pattern to a ring-shaped (annular) band of the image’s Fourier spectrum and detects it by correlation.
Inheritance: ModelBase<T, Vector<T>, Vector<T>> → SafetyModuleBase<T> → ImageSafetyModuleBase<T> → ImageWatermarkerBase<T> → FrequencyImageWatermarker<T>
For Beginners
the Fourier spectrum describes an image as ripples of different sizes and directions. This watermark slightly strengthens or weakens the medium-sized ripples in a secret pattern. The change is invisible, but anyone with the key can check whether the ripples follow the pattern.
How It Works
Follows Tree-Ring watermarks (Wen et al., 2023), which write a key into a circular region of a Fourier spectrum. The key occupies the mid-frequency annulus (normalized radius 0.08-0.4), one independent +/-1 value per coefficient, which is Tree-Ring’s random-key variant. Tree-Ring’s ring-constant variant (one value per ring) is not used: it has one degree of freedom per ring, so two different keys correlate at about 1/sqrt(rings) and a strongly marked image would be “detected” by strangers’ keys too. Tree-Ring places its key in the initial noise of a diffusion model and detects it by inverting the sampler; this class applies the key to a finished image’s own spectrum instead, so it works on any image without a generator. It is a post-hoc watermark, not Tree-Ring’s generation-time one.
The key value is added to the real part of each coefficient and of its conjugate partner (-u, -v), so the change
to the image is real. Detection correlates one coefficient of each conjugate pair against the key; coefficients on
the first row and column are excluded because image borders and straight gradients concentrate energy there.
Images larger than MaxTileSize pixels per side are marked tile by tile.
Constructors
| Constructor | Summary |
|---|---|
FrequencyImageWatermarker(double watermarkStrength, string key) |
Initializes a new Fourier-ring image watermarker. |
Properties
| Property | Summary |
|---|---|
string ModuleName { get; } |