Gaussian blur of size 5px
Bilateral filter with GEGL
import numpy as np from PIL import Image from scipy.spatial.distance import euclidean imbase = np.array(Image.open('bird.jpg')) im1 = np.array(Image.open('bird_gaussian_blur.jpg')) im2 = np.array(Image.open('bird_bilateral_filter_gegl.jpg')) im3 = np.array(Image.open('bird_cubism.jpg')) imrest = [im1, im2, im3] # Which of the three filtered images has the smallest Euclidean distance relative to the base image? for idx, filtered in enumerate(imrest): dist1 = np.linalg.norm(imbase - filtered) dist2 = euclidean(imbase.ravel(), filtered.ravel()) print("im%d: %f" % (idx+1, dist1)) print(dist1 == dist2) # True in all cases """ im1: 144053.237090 im2: 154602.181032 im3: 96093.968422 """
The image filtered with the cubism filter seems to be the most similar to the base image. This could be due to the fact that Gaussian blur and the bilateral filter change the original image globally, while the cubism filter seems to affect mostly the bird itself. Despite the fact that the flying animal looks most differently in this last case, the total difference depends on all pixels, not just on those comprising the bird. And that difference is smallest in this last example. All filters have been applied with GIMP.