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

Hashing triangles #6

Open
DonaldTsang opened this issue Nov 29, 2019 · 3 comments
Open

Hashing triangles #6

DonaldTsang opened this issue Nov 29, 2019 · 3 comments

Comments

@DonaldTsang
Copy link

This might sound off, but is there a way of hashing equilateral triangles?
I raised an issue on pippy360/transformationInvariantImageSearch#4 (comment) regarding using triangular hashes to aid in affine invariant image hashing through triangle networks (see https://pippy360.github.io/transformationInvariantImageSearch/ for examples)
Maybe breakdown the triangle into a grid of "trixels" (triangular pixels) and do the usual hashes that are done with normal square pixels with some alterations? (length 8 grid = 256 trixels)
p_189_grid

@faustomorales
Copy link
Contributor

This sounds interesting. I don't immediately know how to adapt existing hashes this way -- but that doesn't mean it's impossible, of course. That said, if you come up with a test implementation, it would be nice to see how the benchmarking results shake out. You may want to include more extreme rotations in the test transformations in order to get a more complete evaluation.

@DonaldTsang
Copy link
Author

DonaldTsang commented Dec 4, 2019

Could you explain to me how each of the current square hashes work? I know that dHash is undoable for triangles but what about aHash and pHash/wHash? For aHash it is just detecting trixels that are lighter than the verage and for pHash/wHash there are systems that allows for Cosine/Wavelet transform that are done on triangles.
See:

Also Marr-Hildreth, BlockMean, ColorMoment and PDQHash are relatively new, so there may be explanation as to how it should be done for trixels.

@DonaldTsang
Copy link
Author

DonaldTsang commented Dec 18, 2019

According to http://www.gingerling.co.uk/image-and-attribution-identification-game-using-blockhash-and-elog-io/ Block Mean hashes like blockhash.io actually uses median like how aHash operates, but with different params, in that case both aHash and Block Mean hash can be done in the same way.
For Marr–Hildreth it is all about detecting lines in the square (or in this case a triangle) https://en.wikipedia.org/wiki/Marr%E2%80%93Hildreth_algorithm and I think it is possible to modify this into detecting edges in triangles, through 4-trixel or even 16-trixel kernels.
PDQ hashes is basically a convolution that requires a 2 dimensional DCT according to https://github.com/facebook/ThreatExchange/blob/master/hashing/hashing.pdf
Color Moment is still unknown.

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

No branches or pull requests

2 participants