Borrar filtros
Borrar filtros

how to hide a binary image within an rgb image?

2 visualizaciones (últimos 30 días)
chaithra
chaithra el 29 de En. de 2014
Comentada: Ishara Kariyawasam el 19 de En. de 2021
i dont know matlab very well.i have written a code to hide binary image in an rgb image.but it does not work very well.the traces of the binary image can be seen in the rgb image after encrypting.how do i improve it?
%encryption
p=imread('flower.jpg');
q1=imread('colour.jpg');
p1=im2bw(p,.2);
[r c]=size(s);
[r1 c1]=size(q1);
figure(1),imshow(q1),title('original');
q1=imresize(q1,[r,c]);
qr=q1(:,:,1);
qg=q1(:,:,2);
qb=q1(:,:,3);
j=1;
length=r*c;
for i=1:length
if p1(i)==0
qr(j)=bitand(qr(j),0);
j=j+1;
else
qr(j)=bitor(qr(j),1);
j=j+1;
end
end
im=cat(3,qr,qg,qb);
figure(2),imshow(s);
%im=imresize(im,[r1 c1]);
figure(3),imshow(im),title('final');
==================================
%decryption
ir=im(:,:,1);
ig=im(:,:,2);
ib=im(:,:,3);
sz=size(ir);
l=sz(1)*sz(2);
d=zeros(r,c);
j=1;
for i=1:l
d(j)=bitand(ir(i),1);
j=j+1;
end
imshow(d);

Respuesta aceptada

Shivaputra Narke
Shivaputra Narke el 29 de En. de 2014
You can use watermarking using DCT

Más respuestas (1)

Shivaputra Narke
Shivaputra Narke el 29 de En. de 2014
Editada: Walter Roberson el 11 de En. de 2016
I have written a simple code...
clear all;
host=imread('flowers.jpg');
signature=im2bw(imread('signature.tif'));
%%%both images must be of same size
%%%use imresize if its not
onesPosn=find(signature==1);
zerosPosn=find(signature==0);
host=imresize(host,[size(signature)]);
host_R =host(:,:,1);
host_G =host(:,:,2);
host_B =host(:,:,3);
host_R2=host_R;
host_R2(onesPosn)=bitor(host_R(onesPosn),1);
host_R2(zerosPosn)=bitand(host_R(zerosPosn),254);
encrypted=cat(3,host_R2,host_G,host_B);
figure;
subplot(2,2,1);imshow(host);title('original image')
subplot(2,2,2);imshow(signature);title('Binary image')
subplot(2,2,3);imshow(host_R);title('host RED plane')
subplot(2,2,4);imshow(encrypted);title('encrypted')
%-------------------------------------------------
%Decryption
dec_host_R=encrypted(:,:,1);
dec_signature=bitand(dec_host_R,1);
figure;
imshow(dec_signature,[]);title('Decrypted signature');

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by