Walsh and Inverse Walsh Transform and MSE
조회 수: 1 (최근 30일)
이전 댓글 표시
I have applied Walsh transform on 3-D images of folder and then Inverse Walsh. After that when i am calculating MSE of each image with every other image the value is same. What is wrong in my code? clc; clear all; close all; Dir = 'F:\Stuff\Dataset\SignDataset_Sobel\'; count = 0;
for i = 1 : 208 A = imread([Dir,int2str(i),'.jpg']); A = double(A); [s1 s2] = size(A); % bs=input('Enter the block sizes for division of the image: '); % Block Size bs=8; % Walsh temp=double(zeros(size(A))); for y=1:bs:s1-bs+1 for x=1:bs:s2-bs+1 croppedImage = A((y:y+bs-1),(x:x+bs-1)); t=getWalshTransform(croppedImage,bs); temp((y:y+bs-1),(x:x+bs-1))=t; end end % Inverse Walsh temp1=double(zeros(size(A))); for y=1:bs:s1-bs+1 for x=1:bs:s2-bs+1 croppedImage = temp((y:y+bs-1),(x:x+bs-1)); t=getInvWalshTransform(croppedImage,bs); temp1((y:y+bs-1),(x:x+bs-1))=t; end end end for ii = 1 : 208 for jj = 1 : 208
count = count+1;
xmse(count,1)=0;
xmse(count,2)=ii;
xmse(count,3)=jj;
[r c p]=size(temp1);
for xi = 1 :r
for xj = 1 : c
for xk=1:3
xmse(count,1)=xmse(count,1)+( (temp1(xi,xj,xk)-temp(xi,xj,xk)) *(temp1(xi,xj,xk)-temp(xi,xj,xk)));
end
end
end
xmse(count,1)=xmse(count,1)/(3*r*c);
fprintf('MSE of %f with %f is :%f\n',xmse(count,2),xmse(count,3),xmse(count,1));
end
end
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!