ImageEn, unit iexBitmaps

TIEBitmap.GetPerceptualHash

TIEBitmap.GetPerceptualHash

Declaration

function GetPerceptualHash(Algorithm: TIEVisionImageHashAlgorithm = ievHashPHash): AnsiString;

Description

Returns a perceptual hash of the image as a hexadecimal string (requires IEVision).
Unlike GetHash, which changes completely if a single pixel changes, a perceptual hash stays (almost) the same when the image is resized, recompressed, slightly blurred or has its brightness changed, so it can be used to find similar and near-duplicate images.
Compare hashes with IEVisionCompareHashes. Only hashes created with the same Algorithm can be compared.

The image is not modified.

Example

// Is the image a near-duplicate of the other?
hash1 := ImageEnView1.IEBitmap.GetPerceptualHash();
hash2 := ImageEnView2.IEBitmap.GetPerceptualHash();
if IEVisionCompareHashes( hash1, hash2 ) >= 0.75 then
  ShowMessage( 'Same image' );

See Also

◼IEVisionCompareHashes
◼TIEVisionImageHasher
◼FindSimilar
◼CompareWith
◼ComputeImageEquality
◼compute