フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

error 'index exceeds matrix dimensions'

1 回表示 (過去 30 日間)
SIBI SIVA
SIBI SIVA 2016 年 10 月 17 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
figure
for i=1:11
y(:,:,k3)=idwt2(llf(:,:,i),lhf(:,:,i),hlf(:,:,i),hhf(:,:,i),'haar');
s=mat2gray(y(:,:,k3));
subplot(4,4,i)
imshow(s);
k3=k3+1;
end
figure
i1=1;
j1=1;
a1(i1:i1+63, j1:j1+63)=mat2gray(cell2mat(P(1)));
a1(i1:i1+63, 65:65+63)=mat2gray(cell2mat(P(2)));
a1(i1:i1+63, 129:129+63)=mat2gray(cell2mat(P(3)));
a1(i1:i1+63, 193:193+63)=mat2gray(cell2mat(P(4)));
a1(65:65+63, j1:j1+63)=mat2gray(cell2mat(P(5)));
a1(65:65+63, 65:65+63)=mat2gray(s(:,:,1));
a1(65:65+63, 129:129+63)=mat2gray(s(:,:,2));
a1(65:65+63, 193:193+63)=mat2gray(s(:,:,3));
a1(129:129+63, j1:j1+63)=mat2gray(s(:,:,4));
a1(129:129+63, 65:65+63)=mat2gray(s(:,:,5));
a1(129:129+63, 129:129+63)=mat2gray(s(:,:,6));
a1(129:129+63, 193:193+63)=mat2gray(s(:,:,7));
a1(193:193+63, j1:j1+63)=mat2gray(s(:,:,8));
a1(193:193+63, 65:65+63)=mat2gray(s(:,:,9));
a1(193:193+63, 129:129+63)=mat2gray(s(:,:,10));
a1(193:193+63, 193:193+63)=mat2gray(s(:,:,11));
imshow(a1);
i use this part of code to reassemble the watermarked blocks of an image. but it shows the error 'Index exceeds matrix dimensions.
Error in aftrR2 (line 185)
a1(65:65+63, 129:129+63)=mat2gray(s(:,:,2)); ' .
can anyone help me solve the error.thanks in advance.
  1 件のコメント
KSSV
KSSV 2016 年 10 月 17 日
Check the dimensions of every matrix you are using and see the loop's which you are using to call the matrices.

回答 (1 件)

Jan
Jan 2016 年 10 月 17 日
編集済み: Jan 2016 年 10 月 17 日
The message means, that the variable "s" does not have the size 2 in the third dimension. Check this:
dbstop if error
Then runm your code again until Matlab stops at the error. Now check the size of the variables unsed in the failing line.
I guess the problem is here:
s = mat2gray(y(:,:,k3));
After the loop "s" is the last gray image, which is a 2D matrix. Then mat2gray(s(:,:,2)) accesses a not existing 3rd dimension and tries to convert it to gray levels again.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by