Skip to content

Commit

Permalink
updte example for whash-haar
Browse files Browse the repository at this point in the history
  • Loading branch information
erdogant committed Jul 9, 2022
1 parent b18d071 commit 9671756
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion undouble/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,35 @@
# print(undouble.__version__)

# %% Check crop-resistant-hash

# Import library
from undouble import Undouble

# Init with default settings
model = Undouble()

# Import example data
targetdir = model.import_example(data='flowers')

# Importing the files files from disk, cleaning and pre-processing
model.import_data(targetdir)

# Compute image-hash
model.compute_hash(method='whash-haar', hash_size=31)

results = model.group(threshold=5)

# Plot the images
model.plot()

# Plot the hash
model.plot_hash(filenames=model.results['filenames'][model.results['select_idx'][0]])

import pandas as pd
df = pd.DataFrame(index=[model.results['filenames']], data=model.results['img_hash_hex'], columns=['image_hash_hex'])

# %% Check crop-resistant-hash

# Import library
from undouble import Undouble

Expand All @@ -20,7 +49,7 @@
model.compute_hash(method='crop-resistant-hash')

# Find images with image-hash <= threshold
results = model.group(threshold=25)
results = model.group(threshold=5)
print(model.results.keys())
model.results['select_pathnames'][0]
model.results['select_idx'][0]
Expand Down

0 comments on commit 9671756

Please sign in to comment.