Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
erdogant committed Jun 16, 2023
1 parent ae6590d commit e2126ce
Showing 1 changed file with 29 additions and 27 deletions.
56 changes: 29 additions & 27 deletions undouble/examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,35 @@
# print(dir(undouble))
# print(undouble.__version__)

# %% Issue: group does not work, 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=32)

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'])


# %% Issue #7
from undouble import Undouble
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -30,33 +59,6 @@
ax[0].imshow(imgs['img'][0])
ax[1].imshow(hashs[0])

# %% 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=32)

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

Expand Down

0 comments on commit e2126ce

Please sign in to comment.