Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ColorMomentsHash #70

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Add ColorMomentsHash #70

wants to merge 7 commits into from

Conversation

ArrowM
Copy link

@ArrowM ArrowM commented Aug 11, 2023

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(), however distance() returns a double. Internally it works very differently, so the class does not extend Hash, nor is it compatible with other Hash objects.

ColorMomentsHash.java

#hash2(File imageFile) calculates a MomentsHash.
#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 normal Hash, this class should not extend HashingAlgorithm 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 both ColorMomentsHash and HashingAlgorithm 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.

@ArrowM ArrowM mentioned this pull request Aug 11, 2023
3 tasks
@ArrowM ArrowM marked this pull request as draft August 11, 2023 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant