watermark_embed — IMGFORENSICS watermark op

Data kinds: image2d × phashimage2d

Call: import imgforensics; imgforensics.watermark_embed(image, bits, strength: 'float' = 0.1, wavelet: 'str' = 'haar', level: 'int' = 1) -> 'np.ndarray' (or opsimgforensics.get("watermark_embed"))

Usage

DWT-DCT watermark embedding. Returns the watermarked image `(H, W). image2d`.

> The detailed description below is the original text — the summary and the headings are translated.

1 段 DWT(既定 haar)の LL 副帯域を 8x8 に切り、各ブロックの直交 DCT-II の

中帯域係数の対 `(3,1)(1,3)` の大小関係で 1 ビットを表す

(Hsu & Wu 1999 の中帯域係数対法)。差が `strength` 未満なら差が

`strength` になるまで 対称に動かす(片方だけ動かすとブロックの

エネルギーが偏る)。抽出に原画像は要らない(ブラインド)。

容量は `(LL の高さ // 8) * (LL の幅 // 8) ビット。bits` がそれより短ければ

先頭から埋め、残りのブロックは触らない。長ければ :class:ValueError

`bits は bool の 1-D(phash` 語彙)。0/1 の int 配列も受けるが、

float は受けない(丸めの向きを黙って決めない)。

強度と画質のトレードオフは :func:watermark_capacity が掃引して表で返す。

実測(256x256 のテクスチャ画像・128 ビット、LL は 128x128 = 容量 256 ビット。

`tests/test_imgforensics.py::test_watermark_strength_psnr_tradeoff`):

========= ========== ====== ================= =================

strength PSNR (dB) BER BER(JPEG 品質 90) BER(JPEG 品質 75)

========= ========== ====== ================= =================

0.02 45.48 0.000 0.008 0.195

0.05 44.48 0.000 0.000 0.008

0.10 42.95 0.000 0.000 0.000

0.20 40.32 0.000 0.000 0.000

0.40 36.37 0.000 0.000 0.000

========= ========== ====== ================= =================

これがトレードオフの実体である。無加工なら最弱の 0.02 でも誤り 0 だが、

JPEG 品質 75 を通すと 19.5% が化ける。既定の 0.1 は「品質 75 まで誤り 0、

PSNR 42.95 dB」の点として選んである(`clipped` はどの強度でも 0)。

PyWavelets 必須(:class:ImportError)。

References (sample data, literature)

• Sample-data catalog (download URLs / licences) — 2-D uses skimage.data (BSD/public domain) plus synthetic images; 3-D lists download URLs for real data sources (Stanford, PDS, …).

• Operator provenance and references — the sources of the research/methods this op family came from.

• The canonical algorithm (author, year) and its uses are named in the family usage guide above.

Runnable examples (verified samples that actually call this op)

image_forensics_auditpy -3.11 examples/image_forensics_audit.py

Ops the type connects to (they accept image2d as input)

perceptual_hash · fingerprint_correlate · error_level_map · jpeg_quality_estimate · jpeg_ghost_map · noise_inconsistency_map · copy_move_regions · watermark_extract

Same category (watermark)

watermark_extract · watermark_capacity


*Provenance: imgforensics.py — IMGFORENSICS operator registry. This per-op note is generated by tools/opdocs.py md (do not hand-edit).*

© 2026 Kazufumi Furuse — Fullseye operator documentation. Licensed under Apache-2.0.