IEVisionCompareHashes
Declaration
function IEVisionCompareHashes(const Hash1, Hash2: AnsiString; Algorithm: TIEVisionImageHashAlgorithm = ievHashPHash): Double;
Description
Returns the similarity of two perceptual hash strings (created with
GetPerceptualHash or
IEVisionHashToStr) in the range 0 (unrelated) to 1 (identical).
A result of 0.75 or higher means the images are the same or near-duplicates. See
similarity.
Both hashes must have been created with
Algorithm, otherwise an exception is raised.
Example
// Is the image already in our database?
hash := ImageEnView1.IEBitmap.GetPerceptualHash();
for i := 0 to ssStoredHashes.Count - 1 do
if IEVisionCompareHashes( hash, AnsiString( ssStoredHashes[ i ] )) >= 0.75 then
ShowMessage( 'Similar to image ' + IntToStr( i ));
See Also
◼GetPerceptualHash
◼TIEVisionImageHasher