Retrieve Mask from DCT-modified Image

1 view (last 30 days)
I'm starting out with 'Digital Watermarking'.
I modified the Y-component of an image by applying a binary image as mask to its DCT.
How can I retrieve the mask associated with the original image by processing the modified image?
If not, what should I do instead?
(I've attached the code-snippet and output for reference below.)
% Change colorspace from RGB->YCbCr, then isolate Y-component
RGB = imread('saturn.png');
RGB = imresize(RGB, [256 256]);
RGB = im2double(RGB);
YCbCr = rgb2ycbcr(RGB);
Y = YCbCr(:,:,1);
% imshow(Y);
% Generate Watermark (Mask)
row = 8;
col = 8;
mask = zeros(8);
for i = 1:row
for j = 1:col
% Mask: 000
if mod(i+j,2) ~= 0
mask(i,j) = 1;
end
end
end
% imshow(mask);
% Compute 8x8 DCT Matrix
T = dctmtx(8);
dct = @(block_struct) T * block_struct.data * T';
Y_dct = blockproc(Y,[8 8],dct);
% imshow(Y_dct);
% Apply mask to image
Y_masked = blockproc(Y_dct,[8 8],@(block_struct) mask .* block_struct.data);
idct = @(block_struct) T' * block_struct.data * T;
Y_coded = blockproc(Y_masked,[8 8],idct);
output.png

Answers (0)

Community Treasure Hunt

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

Start Hunting!