quat_correlate — QUAT match op

Datenarten: qimage × qimageqimage

Aufruf: import quatimage; quatimage.quat_correlate(qimage, template) -> 'np.ndarray' (oder opsquat.get("quat_correlate"))

Verwendung

Quaternionische Kreuzkorrelation `sum_s conj(a(s)) * b(s+t)`. → (H, W, 4).

> Die ausführliche Beschreibung unten ist der Originaltext — Zusammenfassung und Überschriften sind übersetzt.

Colour template matching that keeps the colour geometry, not just the

colour magnitude. The scalar part of the result is

`sum (a_R b_R + a_G b_G + a_B b_B)` — exactly the sum of the three

per-channel correlations, i.e. what a channelwise pipeline computes and all

it computes. The *vector* part is `-sum (a x b)`, the accumulated colour

cross-product, and it is zero exactly when the two colour fields are

parallel. So the same call answers "how well does it match?" (scalar part)

and "in what way does the colour fail to line up?" (vector part).

Measured on a 32x32 patch whose colours lie in the red-green plane, matched

against a copy of itself rotated about the blue axis. The scalar part is

`cos(angle)` times the self-correlation, exactly, and

`atan2(|vector|, scalar)` returns the rotation angle:

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

rotation scalar/self ratio `cos(angle)` angle recovered

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

0 deg 1.000000 1.000000 0.000000 deg

30 deg 0.866025 0.866025 30.000000 deg

90 deg 0.000000 0.000000 90.000000 deg

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

with the vector direction at `(0.000, 0.000, -1.000)` — the negative of

the rotation axis, because the conjugate sits on the left of the product. A

channelwise pipeline has no term that can produce any of that: the

cross-products are *cross*-channel products, and three independent channel

correlations never form them. (Verified in the same test: the scalar part

equals the summed per-channel correlation to 0.0 exactly, so the channelwise

baseline recovers the scalar part and nothing else.)

**The exact reading needs the colours to lie in the plane orthogonal to the

rotation axis, and the docstring says so because the general case is

biased.** For a colour field with a component along the axis, the vector part

picks up terms in `a_z` and the recovered angle is wrong: measured on a

uniform-random colour patch rotated 30 degrees about blue, the same formula

returns 22.524 degrees on an axis of `(0.247, 0.419, -0.874)` instead

of `(0, 0, -1)`. That is a quiet wrong number, it is inherent to summing

per-pixel cross products, and it is not detectable from the result — so the

precondition is part of the contract.

Both inputs must be pure quaternion images for any of the above to hold; a

non-zero scalar part is not refused (it is algebraically fine) but it

contributes to both parts and the colour interpretation stops applying.

The correlation is circular (computed with FFTs, like

`filters_freq`'s family): a template near the border wraps around. Pad the

inputs if that matters. Shapes must match exactly; a smaller template must be

zero-padded into the image's shape by the caller, because silently choosing

a padding origin would move the peak.

Raises `ValueError: either input is not a valid (H, W, 4)` field,

or the two shapes differ.

Ausführlicher Anwendungsleitfaden

Leitfaden zur Familie quaternion_monogenic

Referenzen (Beispieldaten, Literatur)

• Katalog der Beispieldaten (Download-URLs / Lizenzen) — 2-D nutzt skimage.data (BSD/Public Domain) plus synthetische Bilder, 3-D nennt Download-URLs echter Datenquellen (Stanford, PDS, …).

• Herkunft und Literatur der Operatoren — die Quellen der Forschung/Verfahren, auf denen diese Operatorfamilie beruht.

• Der kanonische Algorithmus (Autor, Jahr) und seine Anwendungen stehen im Familienleitfaden oben.

Ausführbare Beispiele (verifizierte Samples, die diesen Operator wirklich aufrufen)

quaternion_monogenicpy -3.11 examples/quaternion_monogenic.py

Typkompatible Folge-Operatoren (nehmen qimage als Eingabe)

quaternion_to_rgb · quat_norm · quat_conjugate_image · quat_normalize_image · quat_image_multiply · monogenic_amplitude · monogenic_phase · monogenic_orientation

Gleiche Kategorie (match)


*Provenance: quatimage.py — QUAT Operator-Registry. Diese Notiz wird von tools/opdocs.py md erzeugt (nicht von Hand bearbeiten).*

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