【发布时间】:2018-10-16 22:27:04
【问题描述】:
我在这段代码中遇到了一些错误
X=imread ('Lighthouse.jpg'); %reads picture as int8 matrix
figure, imagesc(X), colormap gray, title('original picture'), % display picture
filter=[-1 0 1; -2 0 2; -1 0 1]; % builds Sobel filter matrix
filter=single(filter); %convert double to single
x=single(X); % convert int8 to single
x=x/max(max(x)); %normalisation to [0,1]
我得到的错误:
Error using /
Inputs must be 2-D, or at least one input must be scalar.
To compute elementwise RDIVIDE, use RDIVIDE (./) instead.
Error in sobel (line 10)
x=x/max(max(x)); %normalisation to [0,1]
另外,当我按照建议使用./ 时,我收到新错误:
Array dimensions must match for binary array op.
Error in sobel (line 10)
x=x./max(max(x)); %normalisation to [0,1]
我在规范化步骤中做错了。
我该如何解决这个问题?
【问题讨论】:
-
看你过去的问题:请不要在标题中包含标签,这就是标签系统的用途。请参阅this answer on meta.SE。
标签: matlab image-processing matrix sobel