嗨,我正在尝试从图像梯度或 canny 边缘检测器中获取图像的边界方向,如http://www.cs.swan.ac.uk/~csjason/papers/xxmm-pami2008.pdf的等式 11
我目前有:
clear all
Img = imread('littlecircle.png');
Img = Img(:,:,1);
Img = double(Img);
w = size(Img,1); % width size
h = size(Img,2); % height size
[Ix,Iy] = gradient(Img); %gradient of image
i=1; %iteration for magnetic field loop
b=0; %initialize b to zero
% Magnetic Field
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
O(c,r) = [-Iy(c,r),Ix(c,r)]; % O(x) = (-1).^lambda(-Iy(x),Ix(x)) --ERROR HERE
end
end
B(i) = {O}; % filling a cell array with results. read below
i = i+1;
end
end
但是,在存储到 O(c,r) 时,我得到一个下标索引不匹配。为什么是这样?如果有人认为有更好的方法可以从论文中做到这一点,那么我很乐意在这里。谢谢。