# watermark Embedding in Blocks

10 views (last 30 days)
amitesh kumar on 7 Mar 2011
Answered: cui on 13 Sep 2021
hello everyone i want to embed watermark in image of size 512*512 & watermark size is 64*64. first of all i am converting original image into 8*8 block. then i want to convert watermark also into 8*8 block and embed it into four block only[16*4 = 64(its my watermark size)]. As i am converting original image into total 4096 block.i want to embed watermark into 64 blocks only. can any one elaborate the coding part for it.my part is as follows
%embedding watermark
for R22=1:64
Block2(:,:,xx:yy)=Block2(:,:,xx:yy)+ aa*Block5(:,:,1:64);
xx=64*(R22)+1;
yy=xx+63;
end;
Here consider Block2 as the blocked original image. aa is the embedding constant and Block5 is named to the watermark image. as here clear that its start embedding again after 64 block. but i want it should embed only first 64 block, not in whole image. thanx in advance

Walter Roberson on 7 Mar 2011
I think that in some places you mean "pixels", but that possibly in other places you do mean "blocks". Could you go back over your wording and check it?
Your current code is equivalent to the loop-less
Block2 = Block2 + aa * repmat(Block5(:,:,1:64),1,1,64))
but I am not clear as to what your target is.

Saira Khalid on 3 Jul 2018
can you tell what is the initial value of xx and yy? @ amitesh kumar
Walter Roberson on 6 Jul 2018
You have not converted your image into an 8 x 8 x (number of blocks) array. For example you could use https://www.mathworks.com/matlabcentral/fileexchange/25763-tile and then
Block2 = cat(3, tiles{:})

cui on 13 Sep 2021