Skip to content

Commit

Permalink
Update TERP_neighborhood_generator.py
Browse files Browse the repository at this point in the history
  • Loading branch information
shams-mehdi authored Apr 2, 2024
1 parent d969489 commit 3301486
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions TERP_neighborhood_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ def generate_neighborhood():
from PIL import Image
from skimage.segmentation import slic, mark_boundaries, quickshift
import matplotlib.pyplot as plt

from skimage.util import img_as_float
from skimage import io
input_image_path = sys.argv[sys.argv.index('-input_image') + 1]
input_image = Image.open(input_image_path)
print(">>> Image data provided...")
Expand Down Expand Up @@ -369,7 +370,7 @@ def generate_neighborhood():
for z in zeros:
mask[segments == z] = True
temp[mask] = fudged_image[mask]
Image.fromarray(np.uint8(temp)).convert('RGB').save(save_directory + '/perturbed_images/image_' + format(counter,'06d') + '.png')
Image.fromarray(np.uint8(temp)).convert('RGB').save(save_directory + '/perturbed_images/image_' + format(counter,'06d') + '.jpg')
counter += 1

np.save(save_directory + '/TERP_image.npy', data2)
Expand Down

0 comments on commit 3301486

Please sign in to comment.