Labfans是一个针对大学生、工程师和科研工作者的技术社区。 | 论坛首页 | 联系我们(Contact Us) |
![]() |
![]() |
#1 |
初级会员
注册日期: 2009-06-19
年龄: 37
帖子: 2
声望力: 0 ![]() |
![]()
对图像预测编码,程序运行后出现上述错误提示。
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); |
![]() |
![]() |