How to find mean square error of row mean values?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
close all;
clear all;
clc;
Dir = 'F:\Stuff\Dataset\SignDataset_Sobel\';
count=0;
for i = 1:208
xImgs = imread([Dir,int2str(i),'.jpg']);
[r c pl] = size(xImgs);
xImgs = double(xImgs);
%%---- DCT-----%%
red = dct(xImgs(:,:,1));
green = dct(xImgs(:,:,2));
blue = dct(xImgs(:,:,3));
xr = zeros(1,128);
xg = zeros(1,128);
xb = zeros(1,128);
%%--- Row Mean----%%
for xi=1:128
xr(i,xi) = mean(red(xi,:));
xg(i,xi) = mean(green(xi,:));
xb(i,xi) = mean(blue(xi,:));
end
% xImgs_temp(:,:,1) = xr;
% xImgs_temp(:,:,2) = xg;
% xImgs_temp(:,:,3) = xb;
xImgs_temp = cat(3,xr, xg, xb);
for j=1:208
count=count+1;
xmse_temp(count,1)=0;
xmse_temp(count,2)=i;
xmse_temp(count,3)=j;
totalcat=0;
xmse_temp = double(xmse_temp);
xImg=imread([Dir,int2str(j),'.jpg']);
[r,c,pl] = size(xImg);
xImg = imresize(xImg,[r c]);
xImg = double(xImg);
%--- DCT---%
red1 = dct(xImg(:,:,1));
green1 = dct(xImg(:,:,2));
blue1 = dct(xImg(:,:,3));
xr1 = zeros(1,128);
xg1 = zeros(1,128);
xb1 = zeros(1,128);
%%---- Row Mean---%%
for xj=1:128
xr1(j,xj) = mean2(red1(xj,1:c));
xg1(j,xj) = mean2(green1(xj,1:c));
xb1(j,xj) = mean2(blue1(xj,1:c));
end
% xImg_temp(:,:,1) = xr1;
% xImg_temp(:,:,2) = xg1;
% xImg_temp(:,:,3) = xb1;
xImg_temp = cat(3,xr1,xg1,xb1);
for xi=1:r
for xj=1:c
for xk=1:3
xmse_temp(count,1) = xmse_temp(count,1)+((xImgs_temp(xi,xj,xk)-xImg_temp(xi,xj,xk)) *(xImgs_temp(xi,xj,xk)-xImg_temp(xi,xj,xk)));
end
end
end
xmse_temp(count,1)=xmse_temp(count,1)/(3*r*c);
fprintf('MSE of %f with %f is :%f\n',xmse_temp(count,2),xmse_temp(count,3),xmse_temp(count,1));
end
end
when i applied only DCT it shows the MSE but when on DCT i applied this row mean then i want to find MSE but it shows this, It shows the following error:
Attempted to access xImgs_temp(2,1,1); index out of bounds because size(xImgs_temp)=[1,128,3].
Error in mse_trial (line 72)
xmse_temp(count,1) = xmse_temp(count,1)+( (xImgs_temp(xi,xj,xk)-xImg_temp(xi,xj,xk)) *(xImgs_temp(xi,xj,xk)-xImg_temp(xi,xj,xk)));
0 Kommentare
Antworten (1)
Image Analyst
am 25 Okt. 2015
In the Image Processing Toolbox, there is an immse() function. Assuming you have a reference, "ground truth" image, use immse().
0 Kommentare
Siehe auch
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!