Create gifs
Create gifs with PIL. The sliding windows and ROIs were created with py and opencv. This image has 3 hierachical pyramids. The 1st pyramids contains 24 ROIs. The 2nd pyramid contains 6 ROIs. The 3rd pyramid contains 2 ROIs. No algorithm was used to detrmined the ROIs, this is just a sliding window.
import glob
from PIL import Image
import glob
# filepaths
fp_in = "images/keras_detection/clone_p*.jpg"
fp_out = "images/keras_detection/sliding_window_sw.gif"
# https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#gif
img, *imgs = [Image.open(f) for f in sorted(glob.glob(fp_in))]
img.save(fp=fp_out, format='GIF', append_images=imgs,
save_all=True, duration=2000, loop=0)
fp_in = "images/keras_detection/roiOrig_p*.jpg"
fp_out = "images/keras_detection/sliding_window_rois.gif"
# https://pillow.readthedocs.io/en/stable/handbook/image-file-formats.html#gif
img, *imgs = [Image.open(f) for f in sorted(glob.glob(fp_in))]
img.save(fp=fp_out, format='GIF', append_images=imgs,
save_all=True, duration=2000, loop=0)