Can I embed a image in the following algorithm?

1 次查看(过去 30 天)
I have successfully added data into the image using the following code and algorithm image is attached below but now I want to embed an image inside an image (steganography) Please suggest proper method to do it
instead of data, Please suggest a method
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)

采纳的回答

Walter Roberson
Walter Roberson 2017-1-23
Images are just a type of data. Reshape it to a vector if you need to. If the image size is not fixed then be sure to embed information about the image size.
  4 个评论
Walter Roberson
Walter Roberson 2017-1-25
Replace
[Z,map]=rgb2ind(A,256);
With assigning the desired data to Z

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Encryption / Cryptography 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by