Skip to content

Commit

Permalink
add possible fix
Browse files Browse the repository at this point in the history
  • Loading branch information
erdogant committed Feb 7, 2024
1 parent d5123f6 commit 4483177
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions undouble/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

# %%


# %% issue #9 homogenious part
model = Undouble(method='phash')
# Import flowers example
Expand Down
3 changes: 3 additions & 0 deletions undouble/undouble.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,9 @@ def compute_hash(self, method=None, hash_size=8, return_dict=False):
# Build adjacency matrix for the image-hash based on nr. of differences
logger.info('Compute adjacency matrix [%gx%g] with absolute differences based on the image-hash of [%s].' %(self.results['img_hash_bin'].shape[0], self.results['img_hash_bin'].shape[0], self.params['method']))
self.results['adjmat'] = (self.results['img_hash_bin'][:, None, :] != self.results['img_hash_bin']).sum(2)
# An alternative solution
# self.result = np.not_equal(self.results['img_hash_bin'][:, None, :], self.results['img_hash_bin']).sum(2)


# Remove keys that are not used.
if 'labels' in self.results: self.results.pop('labels')
Expand Down

0 comments on commit 4483177

Please sign in to comment.