# Comparing spectrogram similarity over time

I have a data set of spectrograms from moving audio recorders. As the recorders get closer, I expect the spectrograms to become more "similar". I expect this "similarity" to be a function of distance and frequency.

I would like to create a 3d plot or image that has distance and frequency on the x and y, and "similarity" on z. I am not sure how to define this similarity. Is there a standardized way of comparing similar signals in this way?

For spectrogram similarity, I suggest using a metric from image processing known as SSIM - Structural Similarity Index Metric. It is a quantity between $$[0,1]$$ which denotes the similarity between two images.

The paper is called Image Quality Assessment: From Error Visibility to Structural Similarity. The MATLAB function ssimval() will give you the metric.

• What about new samples with higher values? The scaling to [0, 1] means it can work only if all the data set is given in prior. – Royi May 19 at 12:18