Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Modeled after https://github.com/chongwar/image-sort/blob/d19d990809c3caf5d4219aa3497df8ca760e0fcc/_hash.py#L83
This PR needs more work before it's ready to merge, but I think I'm done working on it. I'm leaving this PR in-case someone else wants to run with it.
Completed
MomentsHash.java
#distance()
works similarly to hammingDistance(), howeverdistance()
returns a double. Internally it works very differently, so the class does not extendHash
, nor is it compatible with otherHash
objects.ColorMomentsHash.java
#hash2(File imageFile)
calculates aMomentsHash
.#hash2(File imageFile, int[] weights)
is similar to the previous hash2, but allows the weights of hue, saturation, and value to be specified.Incomplete
Since our hash needs to return a
MomentsHash
instead of a normalHash
, this class should not extendHashingAlgorithm
as it does now because it can't use#hash()
. (I tried to get this alg to working with hamming distance but had no success). Instead it either needs to have stuff copied from HashingAlgorithm directly into its class, or a new class needs to be added that bothColorMomentsHash
andHashingAlgorithm
can extend.Other notes
Despite not matching the formatting of the other algs, ColorMomentsHash does seem to work and its performance is in the ballpark of the others.