quat_correlate — QUAT match op

데이터 종류: qimage × qimageqimage

호출: import quatimage; quatimage.quat_correlate(qimage, template) -> 'np.ndarray'(또는 opsquat.get("quat_correlate"))

사용법

사원수 상호상관 `sum_s conj(a(s)) * b(s+t)`. → (H, W, 4).

> 아래 상세 설명은 원문입니다 —— 요약과 제목은 번역되어 있습니다.

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.

자세한 사용 가이드

quaternion_monogenic 패밀리 가이드

참고(샘플 데이터·문헌)

• 샘플 데이터 카탈로그(DL URL / 라이선스) —— 2-D 는 skimage.data(BSD/public)+ 합성, 3-D 는 실데이터 소스(Stanford/PDS 등)의 DL URL.

• 연산자의 내력·참고문헌 —— 이 연산자 족의 바탕이 된 연구/기법의 출처.

• 알고리즘의 정전(저자·연도)과 용도는 위의 패밀리 사용 가이드에 적혀 있습니다.

실행 가능한 예제(이 연산자를 실제로 호출하는 검증된 샘플)

quaternion_monogenicpy -3.11 examples/quaternion_monogenic.py

타입이 이어지는 다음 연산자(qimage 를 입력으로 받는 것)

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

같은 카테고리(match)


*Provenance: quatimage.py — QUAT 연산자 레지스트리. 이 op 노트는 tools/opdocs.py md 가 자동 생성합니다(직접 편집하지 마세요).*

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