How to define hx(i,j) in matlab ?
Show older comments
Hey all,
I want to use the formula i.e, hx(i,j)=kx(i,j)*1; instead of kx(i,j)=kx(i,j)+-25;
how can I define hx(i,j) here and how i should proceed with hx value in last lines of code? I guess hx(i,j) should be a empty matrix if I am not wrong?
Any help would be appreciated.
Thanks
i=[]; j=[]; w=1; wmrk=Watermark_Image; welem=numel(wmrk); % welem - no. of elements
prompt = {'Enter embedding location 1 (1-8)','Enter embedding location 2 (1-8)'};
dlg_title = 'Input for watermark embedding location';
num_lines = 1;
def = {'8','8'};
val_i_j = inputdlg(prompt,dlg_title,num_lines,def);
em=zeros(8);
for k=1:4096
kx=(x{k});
for i=1:8 % To address the rows of the blocks
for j=1:8 % To address the column of the blocks
if (i==str2num(val_i_j{1})) && (j==str2num(val_i_j{2})) && (w<=welem) % Criteria to insert watermark
% location in the 8*8 block
if wmrk(w)==0
kx(i,j)=kx(i,j)+25;
end
elseif wmrk(w)==1
kx(i,j)=kx(i,j)-25;
end
end
end
w=w+1;
x{k}=em(i,j); kx=[]; % Watermark value will be replaced in the block
end
Answers (1)
Image Analyst
on 22 Dec 2020
So go ahead and do it
kx(i,j)=kx(i,j)+-25; % Still need kx because you're going to set hx equal to it.
hx(i,j)=kx(i,j)*1; % instead of kx(i,j)=kx(i,j)+-25;
I have no idea what k or h is, or how you want to treat them differently after the loops end.
3 Comments
marie lasz
on 22 Dec 2020
Image Analyst
on 22 Dec 2020
To recombine maybe you should use montage() or imtile()
marie lasz
on 23 Dec 2020
Categories
Find more on Watermarking in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!