MATLAB错误:‘conv2’
生活随笔
收集整理的這篇文章主要介紹了
MATLAB错误:‘conv2’
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
MATLAB錯誤
Undefined function 'conv2' for input arguments of type 'double' and attributes 'full 3d real'.
原因:Color images are 3 dimensional arrays (x,y,color). conv2 is only defined for 2-dimensions, so it won't work directly on a 3-dimensional array.
解決辦法:
Three options:
-
Use an n-dimensional convolution, convn()
-
Convert to a grayscale image using rgb2gray(), and filter in 2D:
filter_g = conv2(gauss,rgb2gray(img_double));
-
Filter each color (RGB) separately in 2D:
filter_g = zeros(size(im_double)); for i = 1:3filter_g(:,:,i) = conv2(gauss, im_double(:,:,i); end
總結(jié)
以上是生活随笔為你收集整理的MATLAB错误:‘conv2’的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: matlab能用矩阵操作就不要用for循
- 下一篇: MATLAB的VLFeat工具箱