MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   [MATLAB图像处理] 图像预测编码错误问题 (https://www.labfans.com/bbs/showthread.php?t=9030)

carrotvcgt 2009-06-19 14:42

图像预测编码错误问题
 
对图像预测编码,程序运行后出现上述错误提示。
Undefined function or method 'LPCencode' for input arguments of type 'double'
请问如何解决。编码如下:
X=imread('lena.bmp','bmp');
X=double(X);
Y=LPCencode(X);
XX=LPCdecode(Y);
figure(1);imshow(mat2gray(Y));
e=double(X)-double(XX);
[m,n]=size(e);
erms=sqrt(sum(e(:).^2)/(m*n));
figure(2);
[h,x]=hist(X(:));
subplot(121);bar(x,h,'k');
[h,x]=hist(Y(:));
subplot(122);bar(x,h,'k');
function y=LPCencode(x,f)
error (nargchk(1,2,nargin))
if nargin<2
f=1;
end
x=double(X);
[m,n]=size(x);
p=zeros(m,n);
xs=x
zc=zeros(m,1);
for j=1: length(f)
xs=[zc xs(:, 1: end-1)];
p=p+f(j)*xs;
end
y=x-round(p);
funtion x=LPCdecode(y,f)
error(nargchk(1,2,nargin));
if nargin<2
f=1;
end
f=f(end: -1: 1);
[m,n]=size(y);
order=length(f);
f=repmat(f,m,1);
x=zeros(m,n+order);
for j=1: n
jj=j+order;
x(:,jj)=y(:,jj+round(sum(f(:,order: -1; 1).*x(:, (jj-1): -1: (jj-order)),2));
end
x=x(:, order+1: end);

silas_xue 2009-06-19 15:03

回复: 图像预测编码错误问题
 
lz LPCencode( )函数是被调用的子函数 应当是自己另外编写的 在set path为默认情况的前提下 根据lz代码所示 该段代码所在文件夹若无LPCencode.m文件 则应会出现该错误提示

Thx for reading.
PS:若还算满意,直接点击“Thanks”,再次登陆时亦便于查看回答是否真的帮到你了。
通过点击本人帖子旁边的ID 可以使用“发送悄悄话给silas_xue”与我进行联系
个人观点 仅供参考 多多交流 相互学习

carrotvcgt 2009-06-20 17:24

回复: 图像预测编码错误问题
 
嗯。知道了。多谢指点。。


所有时间均为北京时间。现在的时间是 03:09

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.