Image hiding inside an image
    11 visualizzazioni (ultimi 30 giorni)
  
       Mostra commenti meno recenti
    
    lilly lord
 il 18 Lug 2022
  
    
    
    
    
    Modificato: lilly lord
 il 21 Lug 2022
            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
0 Commenti
Risposta accettata
  GandaBerunda
      
 il 19 Lug 2022
        Hi Lilly,
One suggestion which comes on the top of my head is that you can put the steganography part of the code as a separate function. Then you can iterate through the rows of the secret image and call that function. Hope it helps.
Più risposte (0)
Vedere anche
Categorie
				Scopri di più su Geometric Transformation and Image Registration in Help Center e File Exchange
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

