【发布时间】:2016-06-14 19:01:41
【问题描述】:
因此,我需要对图像在 x 方向上的导数进行此分配,目的是获得某种形式的渐变。我的想法是在图像的每一行上使用 diff(command),然后应用高斯滤波器。我还没有开始第二部分,因为第一部分给我带来了麻烦。在尝试获得 x 导数时,我有:
origImage = imread('TightRope.png');
for h = 1:3 %%h represents color channel
for i = size(origImage,1)
newImage(i,:,h) = diff(origImage(i,:,h)); %%take derivative of row and translate to new row
end
end
问题出在我得到错误“下标分配维度不匹配”的过程中。。
Error in Untitled2 (line 14)
newImage(i,:,h) = diff(origImage(i,:,h));
有没有人知道为什么会发生这种情况以及我的方法对于获得梯度/高斯导数是否正确?
【问题讨论】:
标签: matlab image-processing filtering gaussian