how to recoup a watermark image !

1 visualizzazione (ultimi 30 giorni)
Ess Ma
Ess Ma il 29 Dic 2021
Modificato: DGM il 29 Dic 2021
clear all; close all; clc;
mat=imread('cameraman.tif');
watermark=imread('cameraman.tif');%% watermark
B2=im2bw(watermark);%% watermark en binair
Marque_V=B2(:);%% vecteur
bitplandepth=1
matW = Wnsrtion(mat,Marque_V,bitplandepth);%% insertion dans mat
subplot(1,2,1)
imshow(mat)
title('image original')
subplot(1,2,2)
imshow(matW)
title('image tatouée')
t=all(all(mat==matW))
psnr =calcul_psnr(mat,matW)
%%extraction
Lbits=length(Marque_V);
Marque_V_recup = extractw( matW,bitplandepth,Lbits );
the function "Wnsrtion()"
function [matW ] = Wnsrtion(mat,Marque_V,bitplandepth)
[L,C]=size(mat)
matv=mat(:);
matvW=matv;
bitplan=1
for i=1:length(Marque_V)
matvW(i)=bitset(matv(i),bitplan,Marque_V(i));
end
matW=reshape(matvW,[C,L]);
end
the function "extractw()"
function [Marque_V_recup] = extractw( matW,bitplandepth,Lbits )
[n,m]=size(matW);
pitplandepth=1;
matV=matW(:);
for i=1:Lbits
Marque_V_recup(i) =bitget(matV(i),bitplandepth);
end
  1 Commento
DGM
DGM il 29 Dic 2021
It may be safe to assume that this is some form of LSB watermarking, but without knowing how the data is being manipulated, it's not possible to instruct how the process should be reversed.
Nobody can guess precisely what the user-defined functions Wnsrtion() and extractw() do, so unless you provide that information, the implied question is not answerable.

Accedi per commentare.

Risposta accettata

DGM
DGM il 29 Dic 2021
Modificato: DGM il 29 Dic 2021
Try this.
mat = imread('cameraman.tif'); % host image
watermark = imread('cameraman.tif'); % payload image
B2 = im2bw(watermark); % watermark en binair
Marque_V = B2(:); % vecteur
bitplandepth = 1;
matW = Wnsrtion(mat,Marque_V,bitplandepth); % insertion dans mat
subplot(1,2,1)
imshow(mat)
title('image original')
subplot(1,2,2)
imshow(matW)
title('image tatouée')
%t = all(all(mat==matW))
%psnr = calcul_psnr(mat,matW)
Lbits = numel(Marque_V);
Marque_V_recup = extractw(matW,bitplandepth,Lbits);
arraysaresame = all(Marque_V == Marque_V_recup) % vectors are equal
% if you want to reshape it into a 2D image
B2_recovered = reshape(Marque_V_recup,size(B2));
function [mat] = Wnsrtion(mat,Marque_V,bitplandepth)
nel = numel(Marque_V);
samp = mat(1:nel);
mat(1:nel) = bitset(samp(:),bitplandepth,Marque_V(:));
end
function [Marque_V_recup] = extractw(matW,bitplandepth,Lbits)
Marque_V_recup = logical(bitget(matW(1:Lbits),bitplandepth));
Marque_V_recup = Marque_V_recup(:);
end

Più risposte (0)

Prodotti


Release

R2011a

Community Treasure Hunt

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

Start Hunting!

Translated by