You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I had problems with different sharp versions (which was solved recently in 1.1.0, thanks). While solving this on my side I came up by splitting the problem into
Read and resize image - this could be done by sharp, jimp or canvas
Calculate the dct2d - this might be useful for other things if the inverse function is supported
This drops the sharp dependency and the resize of the image up to the customer/client. This is the tricky part of the rewrite for a lib called sharp-phash ¯_(ツ)_/¯
Old Browsers do not support 64 bit numbers due lack of BigInt support. The hash result are 32 bit high and low values with converters of toBin, toHex and toDec (requires BigInt support).
Since I store and transfer the hash result via JSON documents the result is encoded in 16 byte hex string to save space. The comparison is done char-wise by a 16x16 lookup table. Further, since one major use case is to find similar images, the difference algorithm supports a max bit difference to skip further comparisons if the image differs too much.
RFC
The text was updated successfully, but these errors were encountered:
I had problems with different sharp versions (which was solved recently in 1.1.0, thanks). While solving this on my side I came up by splitting the problem into
I did some rewrite and came up with https://github.com/xemle/sharp-phash/tree/rewrite-phash
This drops the sharp dependency and the resize of the image up to the customer/client. This is the tricky part of the rewrite for a lib called sharp-phash ¯_(ツ)_/¯
The dct2d was rewritten and aligned with the used variable names of the source https://www.mathworks.com/help/images/ref/dct2.html including the idct2d function based on https://www.mathworks.com/help/images/ref/idct2.html
Old Browsers do not support 64 bit numbers due lack of BigInt support. The hash result are 32 bit high and low values with converters of toBin, toHex and toDec (requires BigInt support).
Since I store and transfer the hash result via JSON documents the result is encoded in 16 byte hex string to save space. The comparison is done char-wise by a 16x16 lookup table. Further, since one major use case is to find similar images, the difference algorithm supports a max bit difference to skip further comparisons if the image differs too much.
RFC
The text was updated successfully, but these errors were encountered: