Help: Error in my code PSNR
Show older comments
I am using this code to and calculating PSNR values even if I am not embedding even a single bit, still the PSNR value i am getting is 10
clc;
clear all;
fprintf('The image matrix A-');
fprintf('\n');
A=imread('airplane.bmp');
figure(1), imshow(A); title('Original Image (Cover Image)');
[Z,map]=rgb2ind(A,256);
p=size(Z);
disp(p);
B=Z;
B(2:2:end,:) = fliplr(Z(2:2:end,:));
C=reshape(B',1,[]);
disp(Z)
fprintf('Inverse S-scan of A-');
fprintf('\n');
disp(C);
fprintf('Size Of Inverse S-scan Matrix-');
fprintf('\n');
z=size(C);
t=z(1)*z(2);
disp(t);
for n=1:1:t
if (n==1)
D(n)=C(1,1);
elseif n>1
D(n)=C(1,(n-1))-C(1,n);
end
end
for n=1:1:t if (n==1) E(n)=D(1,1); else if(D(n)>0) E(n)=D(1,n)+1; else E(n)=D(1,n); end end end
for n=1:1:t if(n<2) F(n)=E(1,n)+1; else F(n)=E(n); end end
for n=1:1:t if(n==1) G(n)=F(1,1); else G(n)=C(1,n-1)-F(1,n); end end
M=reshape(G,p(1),p(2)); M(:,2:2:end)=flipud(M(:,2:2:end)); M=M.';
N=ind2rgb(M,map);
figure(2);imshow(N);title('Stego Image');
peaksnr = psnr(M,B) err = immse(M,B)
Answers (0)
Categories
Find more on Image Quality in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!