I am using the following code to read an image and comparing the image with 13 images inside a folder and finding errors and exporting it to Excel.
clear all;
clc;
workspace; % Make sure the workspace panel is showing.
ReferenceImage = imread('F:\R\CS\0.8\0.6\6.jpg');
[rows columns] = size(ReferenceImage);
fpath = fullfile('F:\R\CT\0.0\0.2\','*.jpg');
img_dir = dir(fpath);
for k=1:length(img_dir)
input_image=strcat('F:\R\CT\0.0\0.2\',img_dir(k).name);
noisyImage = imread(input_image);
squaredErrorImage = (double(ReferenceImage) - double(noisyImage)) .^ 2;
mse = sum(sum(squaredErrorImage)) / (rows * columns);
xlswrite('F:\R\DataX.xls',mse,'A1:A13');
PSNR = 10 * log10( 256^2 / mse);
xlswrite('F:\R\DataX.xls',PSNR,'B1:B15');
end
I am expecting the Excel sheet to have One Column for MSE and One Column for PSNR where the calculated errors of each are displayed.
For example Lets Say,
Image Ref and Image 1, MSE =2; PSNR = 3
Image Ref and Image 2, MSE =3; PSNR = 3
Image Ref and Image 3, MSE =2; PSNR = 4
Image Ref and Image 4, MSE =5; PSNR = 8
I want the excel sheet to look like
2 3
3 3
2 4
5 8
But Instead the sheet I am creating is repeating the numbers. Please help.