Info
This question is closed. Reopen it to edit or answer.
explain any one,plz
1 view (last 30 days)
Show older comments
function [newimg] = embedding(cov_img, secret_img)
%%Embedding image inside images
size_sec = size(secret_img);
secret1d = reshape(secret_img, 1, size_sec(1)*size_sec(2));
%Declaration of variables to control the insertion of encrypted image into
%the cover image
[siz1, siz2, ~] = size(cov_img);
plane = 1;
colplane = cov_img(:,:,plane);
newimg = []; %Output image - cover image with secret image embedded in it
c1 = 1; c2 = 1;
%% Embedding the secret image in the least significant bits of the cover image
for i = 1:length(secret1d)
temp = de2bi(secret1d(i), 8);
for j = 8:-1:1
val = colplane(c1, c2);
val = floor(double(val)/2) * 2;
colplane(c1, c2) = bitor(val,temp(j));
c2 = c2+1;
if c2 > siz2
c2 = 1;
c1 = c1 + 1;
if c1 > siz1
c1 = 1;
c2 = 1;
newimg = cat(3, newimg, colplane);
plane = plane + 1; %Embedding it in the next plane on exhaustion of current plane
colplane = cov_img(:,:,plane);
end
end
end
end
newimg = cat(3, newimg, colplane);
%Inserting back the remaining color plains into the output image
for i = plane+1:3
newimg = cat(3, newimg, cov_img(:,:,i));
end
imwrite(newimg, '3-embedded_image.tif');
1 Comment
Rik
on 28 Jan 2019
Edited: Rik
on 28 Jan 2019
If you don't ask a specific question, people will likely ingore your question. Have a read here (or here for more general advice). It will greatly improve your chances of getting an answer.
Also, this is about cryptography, which can have issues and may result in fewer people trying to answer your question in the first place.
Please read the links I provided and then edit your question accordingly. Once you edit your question it will automatically re-open.
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!