Skip to content

Commit

Permalink
check whether whash-haar is power of 2
Browse files Browse the repository at this point in the history
  • Loading branch information
erdogant committed Jul 9, 2022
1 parent fad5c40 commit b18d071
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions undouble/undouble.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ def compute_hash(self, method=None, hash_size=None, return_dict=False):
if method is not None:
self.params['method'] = method
self.clustimage.params['method'] = method
if method=='whash-haar':
if (np.ceil(np.log2(hash_size)) != np.floor(np.log2(hash_size))):
logger.error('hash_size should be power of 2 (8, 16, 32, 64, ..., etc)')
return None
if method=='crop-resistant-hash':
logger.info('Hash size is set to 8 for crop-resistant and can not be changed.')
hash_size=8
Expand Down

0 comments on commit b18d071

Please sign in to comment.