Image hiding inside an image
Show older comments
Hello, I am trying to hide an image inside an image taking one row of the secret image at a time.
input = imread('peppers.png');% cover image
I1=imread('message1.png');%%% secret image grayscale 64*64
% Convert image to grayscale
input=rgb2gray(input);
% Resize the image to required size
input=imresize(input, [512 512]);
message=I1(1,:);
len = length(message) * 8;
bin_message1=de2bi(message,'left-msb',8);
% Get all the binary digits in separate row
bin_message = bin_message1(:);
% Length of the binary message
N = length(bin_message);
% Initialize output as input
output1 = input;
height = size(input, 1);
width = size(input, 2);
embed_counter = 1;
for i = 1 : height
for j = 1 : width
if(embed_counter <= len)
LSB = mod(double(input(i, j)), 2);
temp = double(xor(LSB, bin_message(embed_counter)));
output1(i, j) = input(i, j)+temp;
embed_counter = embed_counter+1;
end
end
end
%%%%%%%%%%%% 2nd row of I1 to hide
message2=I1(2,:);
len = length(message2) * 8;
bin_message2=de2bi(message2,'left-msb',8);
bin_message = bin_message2(:);
N2 = length(bin_message);
% Initialize output as input
output2 = output1;
height = size(output1, 1);
width = size(output1, 2);
% Counter for number of embedded bits
embed_counter = 1;
and ...............
..............
this way I have tried to embed all 64 rows of the secret image. I want to apply a loop so that it can be done once. Can anyone help
Accepted Answer
More Answers (0)
Categories
Find more on Geometric Transformation and Image Registration 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!