How can I found the distance SSD (Sum of Squared Differences) between two images ?

109 views (last 30 days)
Hello!
I am having two images I and J. How can found distance between this two images with using SSd?
Please help!

Accepted Answer

Thorsten
Thorsten on 30 Nov 2015
X = I1 - I2;
ssd = sum(X(:).^2);

More Answers (2)

Image Analyst
Image Analyst on 10 Dec 2016
Try immse():
ssd = immse(image1, image2) * numel(image1);

Somayeh Norouzi Ghazbi
Somayeh Norouzi Ghazbi on 1 Jan 2017
Edited: Walter Roberson on 1 Jan 2017
You can also use the following code:
SSD=sum(sum(image1-image2).^2)
  1 Comment
Walter Roberson
Walter Roberson on 1 Jan 2017
That would not work for RGB images, and would not work properly for images stored in any of the integer classes such as uint8.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!