元素调试之间的距离

时间:2012-07-17 22:15:10

标签: debugging matlab

在计算y方向上的像素之间的距离时,我有一个愚蠢的错误,而不是x方向。这应该更清楚:

% Distance matrix
for pxRow = 1:h % fixed pixel row
  for pxCol = 1:w % fixed pixel column   

    for r = 1:h % row of distant pixel
      for c = 1:w % column of distant pixel

        Rx(c,r) = sqrt((r-pxRow)^2);   % get distance to each pixel x direction
        Ry(c,r) = sqrt((c-pxCol)^2);   % get distance to each pixel y direction

      end
    end

    Rix(i) = {Rnx};
    Riy(i) = {Rny};
    i = i+1;
  end
end

Rix = reshape(Rix, w, h);
Riy = reshape(Riy, w, h);

其中

Rix = 

NaN   1.000   0.500   0.333
NaN   1.000   0.500   0.333 
NaN   1.000   0.500   0.333 

这是正确的,但

Riy = 

NaN   NaN   NaN   NaN
1.000 1.000 1.000 1.000 
1.000 1.000 1.000 1.000

这是不正确的,因为我希望Riy只是Rix的旋转。

这里的错误在哪里?

提前致谢。

0 个答案:

没有答案