How to define hx(i,j) in matlab ?

조회 수: 1 (최근 30일)
marie lasz
marie lasz 2020년 12월 21일
댓글: marie lasz 2020년 12월 23일
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

답변 (1개)

Image Analyst
Image Analyst 2020년 12월 22일
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
Image Analyst
Image Analyst 2020년 12월 22일
To recombine maybe you should use montage() or imtile()
marie lasz
marie lasz 2020년 12월 23일
thanks , you were very close to the real problem . Because I think the problem is with the inverse of dct because I am getting so much manipulated image. I am trying to figure out this problem.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by