我正在尝试使用Wavelet Tranform过滤图像。我尝试使用此处的函数mdwt
:http://www.mathworks.com/matlabcentral/fileexchange/6391-wavelets-based-denoising/content/mdwt.m以及此链接中的其他函数,如下所示:
img = imread('A10T_1.jpg');
h = daubcqf(4,'min');
L = 1;
y = mdwt(img,h,L);
问题是在最后一行我得到:One or more output arguments not assigned during call to
,Error in => y = mdwt(img,h,L);
问题出在哪里?函数mdwt
只包含声明,仅此而已,我可以看到问题所在。任何人都可以帮我解决这个问题吗?或者还有其他方法可以使用小波变换过滤图像而不使用这些函数吗?
提前致谢。
编辑:
现在我想用这段代码显示图像去噪的小波变换:
RGB = imread('small.jpg');
J = imnoise(RGB,'salt & pepper',0.05);h = daubcqf(6);
noisyLena = J;
figure; colormap(gray); imagesc(RGB); title('Original Image');
figure; colormap(gray); imagesc(noisyLena); title('Noisy Image');
% Denoise lena with the default method based on the DWT
[denoisedLena,xn,opt1] = denoise(noisyLena,h);
figure; colormap(gray); imagesc(denoisedLena); title('denoised Image');
但我收到了错误
??? The matrix row dimension must be of size m*2^(L)
Error in ==> denoise at 171
[xd , LL]= mdwt(double(i),h,L);
Error in ==> wavelet_start at 20
[denoisedLena,xn,opt1] = denoise(noisyLena,h);
其中降噪功能是这样的:http://www.mathworks.com/matlabcentral/fileexchange/6391-wavelets-based-denoising/content/denoise.m
问题出在哪里?
答案 0 :(得分:2)
该集合中的许多文件都是用C语言编写的MEX文件.M文件仅用于文档,但由于您没有编译MEX文件,因此MATLAB正在尝试运行M文件代码本身。在运行代码之前,您需要为您的平台构建它们。
尝试阅读提供的INSTALL.txt文档,这相当于在该目录中运行“compile”。
您的下一个挑战是此代码已经过时,您可能会遇到与最新MATLAB版本兼容的问题。但试试吧,看看会发生什么。
答案 1 :(得分:0)
您尝试使用的功能定义为
function [y,L] = mdwt(x,h,L);
当您在代码中调用该函数时,您只需指定第一个输出参数
y = ...
该函数有两个输出参数,
[y,L] = ...
使用此功能时必须分配两者。