フィルターのクリア

Index exceeds matrix dimensions.

1 回表示 (過去 30 日間)
K BV
K BV 2012 年 4 月 23 日
Hi,
I'm using a correlation function of Matlab corr2 to track markers in a sequence of images (the sequence is called X).
While running my program, I got the error I mentioned in the title
in this line : vtemp = [xtemp(k),ytemp(k)];
The code I wrote is below :
v = [Rx,Ry];
rects_input = calc_rects(v,CORRSIZE,X(:,:,1));
sub_input0 = imcrop(X(:,:,1),rects_input);
for i = 2:size(X,3)
clear 'r'
sub_input=sub_input0;
Mat_vtemp(1,:) = [Rx(1),Ry(1)];
for j = -CORRSIZE:CORRSIZE
for k = 1:length(Rx)
xtemp = Rx(k)+j;
ytemp = Ry(k)+j;
vtemp = [xtemp(k),ytemp(k)];
k,j,i
rects_input_i = calc_rects(Mat_vtemp(k,:),CORRSIZE,X(:,:,i));
sub_input_i = imcrop(X(:,:,i),rects_input_i(k,:));
Rx = round(Rx);
Ry = round(Ry);
r(Rx(k)+j,Ry(k)+j) = corr2(sub_input,sub_input_i);
end
Mat_vtemp(k,:) = vtemp;
Mat_rects_input_i = rects_input_i;
Mat_sub_input_i = sub_input_i;
end
r = abs(r);
[row,col] = find(r==max(max(r)));
figure, imagesc(X(:,:,i)), colormap gray, axis image
hold on
plot(row,col,'*g')
vopt = [row,col]; % vopt : vecteur optimal
end
Any help will be appreciated :)

採用された回答

Richard Brown
Richard Brown 2012 年 4 月 23 日
The line you want is:
vtemp = [xtemp,ytemp];
xtemp and ytemp are numbers not vectors
  1 件のコメント
K BV
K BV 2012 年 4 月 23 日
Thanks for your answer ! It works !

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeResizing and Reshaping Matrices についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by