Similarity index beetween different size images

Hi there; I'm looking for a Similarity Index (possibily in [0,1] range) beetween two images of different sizes. I've lookex for corr2, but it wants same size images. Also I've looked for xcorr2, but I don't understand how I could use it to get a similarity index.
Any help?

 Accepted Answer

One idea can be appying a transform that reduce the bigger image into an image of the same size of the smaller one. Then apply any similarity index that works with same sized images.

3 Comments

Mmm ok, but what kind of transform? 0-padding? I don't know if it will degrade the correlation result.
No! There is a very appropriate function to resize images: http://it.mathworks.com/help/images/ref/imresize.html
By default it uses bicubic interpolation, but you have also other options.
If this answer helped you, please accept it.
Thank you for your help :)

Sign in to comment.

More Answers (1)

You can use ssim(), psnr, or immse():
image2 = imresize(image2, size(image1));
ssimval = ssim(image1, image2);

3 Comments

Thank you for your help, I really found helpful your tutorial :)
Hi Image Analyst,
i got the same error when i used the given code which the size need to be same.
ref = imread('alif.jpg');
A = rgb2gray(ref);
BW1 = imbinarize(A);
figure
imshow(BW1)
image = imread('alif1.jpg');
B = rgb2gray(image);
BW2 = imbinarize(B);
figure
imshow(BW2)
%to calculate the percentage of similarity between ref and new image
BW2 = imresize(BW2, size(BW1));
ssimval = ssim(BW1, BW2);
This is my code. i already converted the images into binary and i want to find the percentage of similarity between two different size of image. please help me sir.
Input arguments of ssim() are expected to be one of these types: uint8, uint16, single or double not logical.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!