To calculate the PSNR (Peak Signal-to-Noise Ratio) of two images with different sizes in MATLAB, you can follow these steps:
img1 = imread('image1.jpg'); img2 = imread('image2.jpg');
img1 = im2double(img1); img2 = im2double(img2);
if size(img1,1)*size(img1,2) > size(img2,1)*size(img2,2) img1 = imresize(img1, [size(img2,1) size(img2,2)]); else img2 = imresize(img2, [size(img1,1) size(img1,2)]); end
mseValue = mse(img1, img2);
maxPixelValue = max(max(img1));
psnrValue = 20*log10(maxPixelValue/sqrt(mseValue));
The PSNR value represents the quality of the reconstructed image compared to the original image. A higher PSNR value indicates better image quality.
Note: The PSNR calculation assumes that the two images are of the same type (e.g., grayscale or RGB). If the two images are of different types, you need to convert them to the same type before performing the PSNR calculation.
Australia
UK
UAE
Singapore
Canada
New
Zealand
Malaysia
USA
India
South
Africa
Ireland
Saudi
Arab
Qatar
Kuwait
Hongkong
Copyright 2016-2023 www.programmingshark.com - All Rights Reserved.
Disclaimer : Any type of help and guidance service given by us is just for reference purpose. We never ask any of our clients to submit our solution guide as it is, anywhere.