how to remove the error"braces indexing not suitable for this kind of variables"?

4 ビュー (過去 30 日間)
Muhammad
Muhammad 2022 年 2 月 20 日
回答済み: Image Analyst 2022 年 2 月 20 日
i have the follawing matrix watermarking code
it has some error i need to remove it
clc
ca=input('enter the matrix')
count=1;
location_array=[[1,4;3,3],[2,3;4,1],[1,6;3,5],[1,5;3,4],[3,4;6,1],[4,3;5,2],[4,2;5,1],[2,6;3,6]];
for i=1:size(ca,1)-1
for j=1:size(ca,2)-1
A=ca(i,j);
B=dct2(A)
dis_img{1,count}=B
count =count+1;
end
end
bin_store={}
watermarked=12
b=de2bi(watermarked)
bin_store=b
count=1;
key=[2,4,5,8];
j=1;
s=200;
for i=1:size(bin_store,2)
block=dis_img(1,count);
if bin_store(1,i)==0
for j=1:4
ii=location_array{1,key(1,j)}(1,:);
jj=location_array{1,key(1,j)}(2,:);
xx=block(ii(1,1),ii(2,1));
yy=block(jj(1,1),jj(1,1));
if xx<=yy
x=xx;
xx=yy;
yy=x;
if xx-yy<=s
xx=xx+s/2;
yy=yy-s/2;
else
if xx-yy<=s
xx=xx+s/2;
yy=yy-s/2;
end
end
block(ii(1,1),ii(1,1))==xx;
block(jj(1,1),jj(1,1))==yy;
end
end
if bin_store(1,i)==1
for j=1:4
ii=location_array{1,key(1,j)}(1,:);
jj=location_array{1,key(1,j)}(2,:);
xx=block(ii(1,1),ii(1,1));
yy=block(jj(1,1),jj(1,1));
ifxx>=yy
x=xx;
xx=yy;
yy=x;
if xx-yy<=s
xx=xx+s/2;
yy=yy-s/2;
else
if xx-yy<=s
xx=xx+s/2;
yy=yy-s/2;
end
end
block(ii(1,1),ii(1,1))==xx;
block(jj(1,1),jj(1,1))==yy; end
end
dis_img(1,count)=block
count=count+1;
end
embed_image=[]
count=1;
for i=1:size(ca,2)-1
hori=[]
for j=1:size(ca,1)-1
xt=dis_img{1,count};
xt=idct2(xt);
hori=horzcat(hori,xt);
count=count+1
end
embed_image=vertcat(embed_image,hori);
end
end
output=embed_image
error that is coming is
Brace indexing is not supported for variables of this type.
Error in watermark (line 25)
ii=location_array{1,key(1,j)}(1,:);

採用された回答

Image Analyst
Image Analyst 2022 年 2 月 20 日
location_array is not a cell array or table so you cannot use curly braces. See the FAQ:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by