Help:Converted a 3 plane image into 2 dimensional image? Steganography

4 visualizaciones (últimos 30 días)
we have converted an image into 2-dimensional array, and performed operations on the array and then we have converted the array again into an 3 plane image, will it work or the images get distorted?
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)

Respuesta aceptada

Walter Roberson
Walter Roberson el 25 de En. de 2017
If you reshape to 2D and embed and reshape back to color, the image will get distorted more. If you let p be the probability that a single bit will get changed in any one pixel, then because there are 3 planes of pixels, the probability that at least one of them will get changed is 1 - (1-p)^3 .
For example if the probability was 1/2 for changing a bit, then the probability that at least 1 bit would get changed in 3 planes would be 1 - (1 - 1/2)^3 = 1 - (1/2^3) = 1 - 1/8 = 7/8
However, the probability that the change will be noticaeble depends upon which plane gets changed. Changes to green are about 5 times as noticeable as changes to blue.
  2 comentarios
akash bais
akash bais el 25 de En. de 2017
okay so should i convert the image into 3 planes and then try out embedding?
Walter Roberson
Walter Roberson el 25 de En. de 2017
That will not make any difference.
What can make a difference:
  • only embed in the portion corresponding to one plane; or
  • have your embedded algorithm affect at most one of the three planes, either by picking a plane at each point or by arranging the algebra of which pixels to embed in such that it it can only select one of the three thirds (for example advance by a third each time); or
  • reduce the risk that the change will be noticeable by avoiding writing into the green plane

Iniciar sesión para comentar.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by