How do you compare the similarity between two color images?
1 answer
I personally recommend using the indico image API. Basically, you pass in an image you are dealing with and return a set of functions that represent higher-level morphological structures in that image.
If you compute cosine similarity on top of these functions, you will get a more intuitive similarity metric.
There's a great github link showing how to do exactly this with the front-end, if that's what you're looking for here: https://github.com/IndicoDataSolutions/imagesimilarity
The code itself is pretty simple:
from indicoio import image_features
from scipy import spatial
features_1 = image_features(<path_to_image>, <api_key>)
features_2 = image_features(<path_to_image>, <api_key>)
similarity = 1 - spatial.distance.cosine(dataSetI, dataSetII) # This is what you want
Full docs here
Full disclosure: I'm the CEO of indico so I'm biased, but I really think it helps in this case.
+2
source to share