TIEMultiBitmap.FindSimilar
Declaration
function FindSimilar(Index: Integer; Threshold: Double = 0.75; Algorithm: TIEVisionImageHashAlgorithm = ievHashPHash): TIEArrayOfInteger; overload;
function FindSimilar(Index: Integer; var Similarities: TIEArrayOfDouble; Threshold: Double = 0.75; Algorithm: TIEVisionImageHashAlgorithm = ievHashPHash): TIEArrayOfInteger; overload;
Description
Returns the indexes of all images that are the same as, or similar to, the image at
Index (requires
IEVision).
Images are compared using a
perceptual hash, so resized, recompressed and slightly edited copies are found.
The result is sorted with the most similar image first.
Index itself is not included.
| Parameter | Description |
| Index | The image to compare with all others |
| Similarities | Returns the similarity (0 to 1) of each returned image, in the same order |
| Threshold | Minimum similarity (0 to 1). 0.75 finds near-duplicates. Use a lower value to find more loosely similar images. See similarity |
| Algorithm | The perceptual hash algorithm. See TIEVisionImageHashAlgorithm |
Note: Every image is hashed on each call, so for repeated searches of large collections it is faster to store the hashes (
GetPerceptualHash) and compare them with
IEVisionCompareHashes.
Example
var
idx: TIEArrayOfInteger;
sims: TIEArrayOfDouble;
i: Integer;
begin
idx := MBitmap.FindSimilar( 0, sims );
for i := 0 to Length( idx ) - 1 do
Memo1.Lines.Add( Format( 'Image %d: %.2f', [ idx[ i ], sims[ i ]] ));
end;
See Also
◼RemoveDuplicates
◼TImageEnMView.FindSimilar
◼GetPerceptualHash