您的位置:首页 > 其它

Undefined function 'conv2' for input arguments of type 'double' and attributes 'full 3d complex'.

2014-11-21 16:57 465 查看
matlab提示错误:Undefined function 'conv2' for input arguments of type 'double' and attributes 'full 3d complex'.

原因:在matlab中,彩色图像的表示是三维矩阵,即(x,y,color)。但conv2函数只能对2维图像进行卷积操作,不能直接作用于三维矩阵。

三种解决方案:

No.1 使用n维卷积函数 convn()。

No.2 先使用rgb2gray()函数将三维彩色图像转换成灰度图像,然后再使用conv2()进行2维滤波操作。

例:filter_F= conv2(gauss,rgb2gray(img_double));

No.3 对彩色(RGB)图像的每一层分别使用conv2()进行2维卷积操作。

例:filter_F = zeros(size(im_double));

for i=
1:3

filter_F(:,:,i)= conv2(gauss,
im_double(:,:,i);

end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐