save_img_block.py 657 B

1234567891011121314151617181920212223242526
  1. from ipfml import processing, utils
  2. from skimage import transform
  3. import numpy as np
  4. import matplotlib.pyplot as plt
  5. import os
  6. from PIL import Image
  7. data_folder = "../fichiersSVD_light"
  8. scene = 'Cuisine01'
  9. mean_svd_values = []
  10. indices = ["00050", "00300", "01200"]
  11. id_block = 10
  12. def get_block_image(image_path):
  13. image = Image.open(image_path)
  14. blocks = processing.divide_in_blocks(image, (200, 200))
  15. return blocks[id_block]
  16. for index in indices:
  17. path = os.path.join(data_folder, scene + '/cuisine01_' + index + '.png')
  18. img_block = get_block_image(path)
  19. img_block.save(scene + '_' + str(index) + '_' + str(id_block) + '.png')