Clear Filters
Clear Filters

Info

This question is closed. Reopen it to edit or answer.

Similiarity of Columns in Images

1 view (last 30 days)
J Parker
J Parker on 21 Aug 2017
Closed: MATLAB Answer Bot on 20 Aug 2021
I have two images, and I am interested in determining the Gaussian similarly (not equal) of columns in each image. Can someone assist me on how to accomplish it?

Answers (1)

Walter Roberson
Walter Roberson on 21 Aug 2017
Assuming a grayscale image YourImage,
[r, c] = size(YourImage);
gsim = zeros(c, c);
for c1 = 1 : c - 1;
for c2 = c1 + 1 : c
[h, p] = kstest2(YourImage(:,c1), YourImage(:,c2));
gsim(c1, c2) = p;
gsim(c2, c1) = p;
end
end
imagesc(gsim)
  8 Comments
Image Analyst
Image Analyst on 24 Aug 2017
J, why don't you simply subtract the images? Or use built-in functions like immse() or psnr()? Or compute the mean (or median) absolute deviation?
Walter Roberson
Walter Roberson on 25 Aug 2017
[r1, c1, p1] = size(FirstImage);
[r2, c2, p2] = size(SecondImage);
if c1 ~= c2
error('Images must have the same number of columns');
end
if p1 ~= 1 || p2 ~= 1
error('This code is for grayscale images only');
end
gsim = zeros(1, c1);
for c = 1 : c1
[h, p] = kstest2(FirstImage(:,c), SecondImage(:,c));
gsim(1, c) = p;
end
end
figure(2)
image(gsim); %I do not recommend imshow for this purpose
colormap(parula(256))

This question is closed.

Community Treasure Hunt

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

Start Hunting!