dataeval.core.dhash

dataeval.core.dhash(image)

Compute difference hash (dHash) for an image.

Resizes then crops image to 9x8 grayscale and computes horizontal gradient by comparing adjacent pixels, producing a 64-bit hash. Captures relative brightness changes rather than absolute values.

Parameters:
image : Array3D

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

Returns:

Hex string hash of the image, or empty string if image is too small or not spatial data.

Return type:

str

Notes

Difference hash captures gradient information: - Captures structural information via pixel transitions - Complementary to DCT-based pHash (frequency vs gradient domain)

The horizontal gradient approach makes it particularly effective for detecting cropped or slightly shifted versions of images.