dataeval.core.pchash

dataeval.core.pchash(image)

Performs a perceptual hash on an image by resizing to a square NxN image using the Lanczos algorithm where N is 32x32 or the largest multiple of 8 that is smaller than the input image dimensions. The resampled image is compressed using a discrete cosine transform and the lowest frequency component is encoded as a bit array of greater or less than median value and returned as a hex string.

Parameters:
image : NDArray

An image as a numpy array in CxHxW format

Returns:

The hex string hash of the image using perceptual hashing, or empty string if the image is too small to be hashed

Return type:

str