Class TypedImageMatcher
- java.lang.Object
-
- dev.brachtendorf.jimagehash.matcher.TypedImageMatcher
-
- Direct Known Subclasses:
ConsecutiveMatcher,DatabaseImageMatcher,PersistentImageMatcher,SingleImageMatcher
public abstract class TypedImageMatcher extends Object
Image matchers are a collection of classes which bundle the hashing operation of one or multipleHashingAlgorithmsand expose functionalities to compare multiple images with each other.TypedImageMatchers accept hashing algorithms with additional configuration details attached to each entry.
- Author:
- Kilian
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classTypedImageMatcher.AlgoSettingsSettings used while computing if an algorithms consideres two images to be a close match
-
Field Summary
Fields Modifier and Type Field Description protected LinkedHashMap<HashingAlgorithm,TypedImageMatcher.AlgoSettings>stepsContains multiple hashing algorithms applied in the order they were added to the image matcher
-
Constructor Summary
Constructors Constructor Description TypedImageMatcher()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddHashingAlgorithm(HashingAlgorithm algo, double threshold)Append a new hashing algorithm which will be executed after all hash algorithms passed the test.voidaddHashingAlgorithm(HashingAlgorithm algo, double threshold, boolean normalized)Append a new hashing algorithm which will be executed after all hash algorithms passed the test.voidclearHashingAlgorithms()Remove all hashing algorithms used by this image matcher instance.booleanequals(Object obj)Map<HashingAlgorithm,TypedImageMatcher.AlgoSettings>getAlgorithms()Return an immutable map copy of the algorithms currently used in the matcher.inthashCode()booleanremoveHashingAlgo(HashingAlgorithm algo)Removes the hashing algorithms from the image matcher.
-
-
-
Field Detail
-
steps
protected LinkedHashMap<HashingAlgorithm,TypedImageMatcher.AlgoSettings> steps
Contains multiple hashing algorithms applied in the order they were added to the image matcher
-
-
Method Detail
-
addHashingAlgorithm
public void addHashingAlgorithm(HashingAlgorithm algo, double threshold)
Append a new hashing algorithm which will be executed after all hash algorithms passed the test.The same algorithm may only be added once. Attempts to add an identical algorithm will instead update the settings of the old instance.
This method assumes the normalized hamming distance. If the definite distance shall be used take a look at
addHashingAlgorithm(HashingAlgorithm, double, boolean)- Parameters:
algo- The algorithms to be addedthreshold- maximum normalized hamming distance between hashes in order to pass as identical image
-
addHashingAlgorithm
public void addHashingAlgorithm(HashingAlgorithm algo, double threshold, boolean normalized)
Append a new hashing algorithm which will be executed after all hash algorithms passed the test.The same algorithm may only be added once to an image hasher. Attempts to add an identical algorithm will instead update the settings of the old instance.
- Parameters:
algo- The algorithms to be addedthreshold- the threshold the hamming distance may be in order to pass as identical image.normalized- Weather the normalized or default hamming distance shall be used. The normalized hamming distance will be in range of [0-1] while the hamming distance depends on the length of the hash
-
removeHashingAlgo
public boolean removeHashingAlgo(HashingAlgorithm algo)
Removes the hashing algorithms from the image matcher.- Parameters:
algo- the algorithm to be removed- Returns:
- true if the algorithms was removed, false otherwise
-
clearHashingAlgorithms
public void clearHashingAlgorithms()
Remove all hashing algorithms used by this image matcher instance. At least one algorithm has to be supplied before imaages can be checked for similarity
-
getAlgorithms
public Map<HashingAlgorithm,TypedImageMatcher.AlgoSettings> getAlgorithms()
Return an immutable map copy of the algorithms currently used in the matcher. This map is a hard copy of the hashmap and does not updated if the underlying collection gets altered- Returns:
- A map containing all algorithms used in this matcher
-
-