what do u mean by the error message "index exceeds matrix dimensions" ?

1 回表示 (過去 30 日間)
Pramod Bhat
Pramod Bhat 2011 年 4 月 16 日
i have written a simple code to subtract two images and applying threshold after subtracting. when it is executed it giver error message "ndex exceeds matrix dimensions". what does it means ? how can i solve this problem? Program is given here.please help me. Thanking you.
img1=imread('seq1.jpg');%define your image.
img1=rgb2gray(img1);
img2=imread('seq2.jpg');
img2=rgb2gray(img2);
diff1=abs(int16(img2)-int16(img1));
[r1,c1]=size(diff1);
for x1=1:r1
for y1=1:c1
if diff1(x1,y1)<56 %threshold value.Here is the error.
diff1=0;
end
end
end

採用された回答

Paulo Silva
Paulo Silva 2011 年 4 月 16 日
diff1=0 causes that problem because it turns the array in just a double value (size = [1 1]), do you mean diff1(x1,y1)=0 instead?
  1 件のコメント
Pramod Bhat
Pramod Bhat 2011 年 4 月 16 日
thanks dear. yes. you are right. thanks again.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by