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
$hasher = new ImageHash();
$hash = $hasher->hash('test.jpg');
... returns hash in HEX-Format like "3c3e0e1a3a1e1e1e".
tried to convert it: $hash->toBin(), but I'll get fatal error.
Do I have to store the returend hash in the format like in the example (Image 1 hash: 3c3e0e1a3a1e1e1e ), or do I have to convert it to binary format (0011110000111110000011100001101000111010000111100001111000011110)?
Which data type to use for the column to store it in a mysql database for comparision ... varchar(), int()
If I save the hashes in HEX ("3c3e0e1a3a1e1e1e") and try to get the hamming distance, results seems not to be correct.
Results from DB ...
SELECT images.*, BIT_COUNT(hash ^ :hash) as hamming_distance
FROM images
HAVING hamming_distance < 5
... are significantly different from ...
$hasher = new ImageHash(new DifferenceHash());
$distance = $hasher->distance($hash3, $hash4);
The text was updated successfully, but these errors were encountered:
You need to store the hash as an unsigned bigint on MySQL side. (Unfortunately MySQL can't do bitwise operations on varbinary types)
Be careful to keep the number as a string on PHP side because PHP doesn't support unsigned integers and the hash can "overflow" and be cast to float when using the Hash::toInt() method.
$hasher = new ImageHash();
$hash = $hasher->hash('test.jpg');
... returns hash in HEX-Format like "3c3e0e1a3a1e1e1e".
tried to convert it: $hash->toBin(), but I'll get fatal error.
Do I have to store the returend hash in the format like in the example (Image 1 hash: 3c3e0e1a3a1e1e1e ), or do I have to convert it to binary format (0011110000111110000011100001101000111010000111100001111000011110)?
Which data type to use for the column to store it in a mysql database for comparision ... varchar(), int()
If I save the hashes in HEX ("3c3e0e1a3a1e1e1e") and try to get the hamming distance, results seems not to be correct.
Results from DB ...
SELECT images.*, BIT_COUNT(hash ^ :hash) as hamming_distance
FROM images
HAVING hamming_distance < 5
... are significantly different from ...
$hasher = new ImageHash(new DifferenceHash());
$distance = $hasher->distance($hash3, $hash4);
The text was updated successfully, but these errors were encountered: