How can I found the distance SSD (Sum of Squared Differences) between two images ?
109 views (last 30 days)
Show older comments
Hello!
I am having two images I and J. How can found distance between this two images with using SSd?
Please help!
0 Comments
Accepted Answer
Thorsten
on 30 Nov 2015
X = I1 - I2;
ssd = sum(X(:).^2);
2 Comments
Image Analyst
on 10 Dec 2016
If I1 and I2 are uint numbers, you'll have to cast to double to avoid clipping:
X = double(I1) + double(I2);
More Answers (2)
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
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.
See Also
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!