ImageEn, unit IEVision

TIEVisionImageHasher

TIEVisionImageHasher

Declaration

TIEVisionImageHasher = interface(TIEVisionBase)

Description

An interface to calculate and compare perceptual image hashes, which are used to find similar and near-duplicate images.
Unlike a cryptographic hash (e.g. GetHash), which changes completely if a single pixel changes, a perceptual hash stays (almost) the same when an image is resized, recompressed, slightly blurred or has its brightness changed.

Create it with createImageHasher, specifying the algorithm. Hashes can only be compared with others made by the same algorithm.

For most purposes it is easier to use: GetPerceptualHash, IEVisionCompareHashes, FindSimilar, FindSimilar and RemoveDuplicates.

Example

Also see: Automated Samples
// Compare two images
hasher := IEVisionLib().createImageHasher( ievHashPHash );
hash1 := hasher.compute( ImageEnView1.IEBitmap.GetIEVisionImage() );
hash2 := hasher.compute( ImageEnView2.IEBitmap.GetIEVisionImage() );
if hasher.similarity( hash1, hash2 ) >= 0.75 then
  ShowMessage( 'The images are the same or very similar' );

Methods and Properties

Public Method  compare
Public Method  compute
Public Method  getAlgorithm
Public Method  similarity

See Also

◼createImageHasher
◼IEVisionHashToStr
◼IEVisionStrToHash