Class ConsecutiveMatcher
- java.lang.Object
-
- dev.brachtendorf.jimagehash.matcher.TypedImageMatcher
-
- dev.brachtendorf.jimagehash.matcher.persistent.PersistentImageMatcher
-
- dev.brachtendorf.jimagehash.matcher.persistent.PersitentBinaryTreeMatcher
-
- dev.brachtendorf.jimagehash.matcher.persistent.ConsecutiveMatcher
-
- All Implemented Interfaces:
Serializable
public class ConsecutiveMatcher extends PersitentBinaryTreeMatcher
Convenience class allowing to chain multiple hashing algorithms to find similar images. The ConsecutiveMatcher keeps the hashes and buffered images in cache.- Author:
- Kilian
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class dev.brachtendorf.jimagehash.matcher.TypedImageMatcher
TypedImageMatcher.AlgoSettings
-
-
Field Summary
-
Fields inherited from class dev.brachtendorf.jimagehash.matcher.persistent.PersitentBinaryTreeMatcher
addedImages, binTreeMap, cacheAddedHashes, cachedHashes
-
Fields inherited from class dev.brachtendorf.jimagehash.matcher.persistent.PersistentImageMatcher
addedImageMap, lockedState
-
Fields inherited from class dev.brachtendorf.jimagehash.matcher.TypedImageMatcher
steps
-
-
Constructor Summary
Constructors Constructor Description ConsecutiveMatcher(boolean cacheAddedHashes)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PriorityQueue<Result<String>>getMatchingImagesInternal(BufferedImage image, String uniqueId)Return a list of images that are considered matching by the definition of this matcher.-
Methods inherited from class dev.brachtendorf.jimagehash.matcher.persistent.PersitentBinaryTreeMatcher
addHashingAlgorithm, addImageInternal, clearHashingAlgorithms, equals, getHash, getMatchingImages, getMatchingImages, hashCode, printAllTrees, removeHashingAlgo
-
Methods inherited from class dev.brachtendorf.jimagehash.matcher.persistent.PersistentImageMatcher
addHashingAlgorithm, addImage, addImage, addImage, addImages, checkLockedState, reconstructState, serializeState
-
Methods inherited from class dev.brachtendorf.jimagehash.matcher.TypedImageMatcher
getAlgorithms
-
-
-
-
Constructor Detail
-
ConsecutiveMatcher
public ConsecutiveMatcher(boolean cacheAddedHashes)
- Parameters:
cacheAddedHashes- Additionally to the binary tree, hashes of added images will be mapped to their uniqueId allowing to retrieve matches of added images without loading the image file from disk. This setting increases memory overhead in exchange for performance.Use this setting if calls to
PersitentBinaryTreeMatcher.getMatchingImages(java.io.File)likely contains an image already added to the match prior.
-
-
Method Detail
-
getMatchingImagesInternal
protected PriorityQueue<Result<String>> getMatchingImagesInternal(BufferedImage image, String uniqueId)
Description copied from class:PersitentBinaryTreeMatcherReturn a list of images that are considered matching by the definition of this matcher.This method is propagated by the super class allowing to utilize caching techniques to avoid reloading known images. Either the bufferedImage or the uniqueId argument is send depending on if the uniqueId is enough to query the hashes using the
PersitentBinaryTreeMatcher.getHash(HashingAlgorithm, String, BufferedImage)method call.- Specified by:
getMatchingImagesInternalin classPersitentBinaryTreeMatcher- Parameters:
image- the buffered image to match or nulluniqueId- the uniqueId of a previously cached image or null- Returns:
- a list of unique id's identifying the previously matched images sorted by distance.
-
-