info1

clear
close all
clc
rgb = imread('kodim19.png');
imshow(rgb);
g = rgb2gray(im2double(rgb));
Warning: Image is too big to fit on screen; displaying at 67% 
n = 1;
angles = [-13 -14 -14.5 -15];
for angle = angles
    close all
    out = imrotate(g,15,'crop');
    out2 = imrotate(out,angle,'crop');
    rect = [88   88  338  536];
    c2 = imcrop(out2,rect);
    c1 = imcrop(g,rect);
    diff = c2 - c1;
    imshow((4*diff+1)/2);
    title(['disparity angle ' num2str(angle+15) ' deg']);
    figure
    imhist((diff+1)/2);
    dif2(c1,c2);
    fprintf('\nMATLAB mean square error: %g\n',immse(c1,c2));
    fprintf('MATLAB peak signal-to-noise ratio %g dB\n',psnr(c2,c1));

    [ssimval, ssimmap] = ssim(c2,c1);
    fprintf('The SSIM value is %0.4f.\n',ssimval);

    simval(n) = ssimval;
    n = n+1;

    figure, imshow(ssimmap,[]);
    title(sprintf('ssim Index Map - Mean ssim Value is %0.4f',ssimval));
average absolute error (MAE): 0.0842313
mean square error (MSE): 0.022214
peak signal-to-noise ratio (PSNR): 16.4557 dB
signal-to-noise ratio : 2.11814 dB
mean error (bias check): -0.00205958

MATLAB mean square error: 0.022214
MATLAB peak signal-to-noise ratio 16.5337 dB
The SSIM value is 0.4113.
average absolute error (MAE): 0.0747143
mean square error (MSE): 0.0200165
peak signal-to-noise ratio (PSNR): 16.9081 dB
signal-to-noise ratio : 2.56995 dB
mean error (bias check): -0.00109297

MATLAB mean square error: 0.0200165
MATLAB peak signal-to-noise ratio 16.9861 dB
The SSIM value is 0.4402.
average absolute error (MAE): 0.052573
mean square error (MSE): 0.0111998
peak signal-to-noise ratio (PSNR): 19.4299 dB
signal-to-noise ratio : 5.09155 dB
mean error (bias check): -0.000508022

MATLAB mean square error: 0.0111998
MATLAB peak signal-to-noise ratio 19.5079 dB
The SSIM value is 0.6066.
average absolute error (MAE): 0.00374893
mean square error (MSE): 0.000577925
peak signal-to-noise ratio (PSNR): 32.3033 dB
signal-to-noise ratio : 17.9649 dB
mean error (bias check): 4.94367e-05

MATLAB mean square error: 0.000577925
MATLAB peak signal-to-noise ratio 32.3813 dB
The SSIM value is 0.9719.
end
plot(angles+15,simval,'ko');
grid;
xlabel('angle disparity (deg)');
ylabel('Structural Similiarity Index (SSIM)');