필터 지우기
필터 지우기

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