How to define hx(i,j) in matlab ?
    조회 수: 4 (최근 30일)
  
       이전 댓글 표시
    
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
댓글 수: 0
답변 (1개)
  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
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

