mirror of
https://github.com/simon987/fastimagehash.git
synced 2025-04-03 08:53:00 +00:00
Fix whash
This commit is contained in:
parent
a37c08c11b
commit
a0b055cff8
@ -269,6 +269,9 @@ int whash_mem(void *buf, size_t buf_len, uchar *out, const int hash_size, int im
|
||||
if (remove_max_ll) {
|
||||
// Remove low level frequency
|
||||
wave_object w_haar_tmp = wave_init("haar");
|
||||
int max_level = (int) (log((double) img_scale / ((double) w_haar_tmp->filtlength - 1.0)) / log(2.0));
|
||||
ll_max_level = MIN(ll_max_level, max_level);
|
||||
|
||||
wt2_object wt_haar_tmp = wt2_init(w_haar_tmp, "dwt", img_scale, img_scale, ll_max_level);
|
||||
|
||||
double *coeffs = dwt2(wt_haar_tmp, data);
|
||||
@ -279,6 +282,7 @@ int whash_mem(void *buf, size_t buf_len, uchar *out, const int hash_size, int im
|
||||
|
||||
wt2_free(wt_haar_tmp);
|
||||
wave_free(w_haar_tmp);
|
||||
free(coeffs);
|
||||
}
|
||||
|
||||
wave_object w = wave_init(wname);
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef FASTIMAGEHASH_FASTIMAGEHASH_H
|
||||
#define FASTIMAGEHASH_FASTIMAGEHASH_H
|
||||
|
||||
#define FASTIMAGEHASH_VERSION "4.0"
|
||||
#define FASTIMAGEHASH_VERSION "4.1"
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
|
4
imhash.c
4
imhash.c
@ -51,8 +51,8 @@ int main(int argc, char *argv[]) {
|
||||
}
|
||||
}
|
||||
if (do_whash) {
|
||||
if (whash_file(argv[i], hash, 8, 0, 1, "haar") == 0) {
|
||||
hash_to_hex_string_reversed(hash, hashstr, 8);
|
||||
if (whash_file(argv[i], hash, 16, 0, 1, "haar") == 0) {
|
||||
hash_to_hex_string_reversed(hash, hashstr, 16);
|
||||
printf("%s\tw:%s\n", argv[i], hashstr);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user