Image hiding inside an image

조회 수: 4 (최근 30일)
lilly lord
lilly lord 2022년 7월 18일
편집: lilly lord 2022년 7월 21일
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

채택된 답변

GandaBerunda
GandaBerunda 2022년 7월 19일
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.
  댓글 수: 1
lilly lord
lilly lord 2022년 7월 19일
편집: lilly lord 2022년 7월 21일
Thank you very much. Your answer help me to solve this problem. I made the function and solve the issue

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Read, Write, and Modify Image에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by