dataeval.core.phash_d4

dataeval.core.phash_d4(image)

Compute orientation-invariant perceptual hash using DCT.

Computes phash for all 8 dihedral group transformations (4 rotations × 2 flip states) and returns the lexicographically smallest hash as the canonical representative.

Parameters:
image : Array3D

An image in CxHxW format. Can be a 3D list, or array-like object.

Returns:

Canonical hex string hash invariant to rotation and mirroring, or empty string if image is too small or not spatial data.

Return type:

str

See also

phash

Standard orientation-sensitive perceptual hash

dhash_d4

Orientation-invariant difference hash

Notes

This hash is invariant to: - 90°, 180°, 270° rotations - Horizontal and vertical flips - Any combination of rotation and flip

The canonical hash is the lexicographically smallest hash among all 8 orientations, ensuring that any orientation of the same image produces the identical hash.

Computation cost is ~8x that of regular phash.