Files
remove-ai-watermarks/tests/test_image_math.py
T
Victor KuznetsovandClaude Opus 5.5 1dc70df289 Upgrade to OpenCV 5 with frozen Hershey templates and tighten video marks
- Lock OpenCV 5 and cap NumPy below 2.4 through uv constraint-dependencies so
  PaddleX 3.7 keeps resolving; Dependabot ignores mirror the cap.
- OpenCV 5 draws Hershey putText glyphs differently, so the Dola and Kling
  video templates ship as committed OpenCV 4 renders with a recipe script, and
  the OpenArt alpha recipe now refuses any OpenCV but 4.x.
- Break Sora/Veo cross-matches in favor of Veo under valid Google AI-video
  provenance, and require the full Sora mascot shape for mascot-only matches.
- Let the Doubao engine detect marks tinted by saturated backgrounds.
- Share C2PA claim-generator, credential-level and vendor-platform helpers,
  JPEG suffixes and the DCT basis instead of per-module copies.
- Log model download failures, document the optional GITHUB_TOKEN, mark the
  photo and source classifier model cards archived, and refresh the lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-23 19:19:00 -07:00

19 lines
635 B
Python

"""The shared DCT basis must be the orthonormal DCT-II that OpenCV computes."""
from __future__ import annotations
import cv2
import numpy as np
import pytest
from remove_ai_watermarks._internal.image_math import dct_matrix
@pytest.mark.parametrize("size", [4, 8, 16])
def test_dct_matrix_matches_opencv_dct(size: int) -> None:
matrix = dct_matrix(np, size)
# DCT_ROWS transforms each basis vector e_i separately, so row i is column i of the basis.
np.testing.assert_allclose(matrix, cv2.dct(np.eye(size), flags=cv2.DCT_ROWS).T, atol=1e-12)
np.testing.assert_allclose(matrix @ matrix.T, np.eye(size), atol=1e-12)