我正在尝试在 Matlab 中实现论文《减少图像反卷积中的边界伪影》here 。
我遇到的问题是我不知道如何在matlab中实现论文中描述的正则化最小二乘问题。
谁能给我一些建议吗?直到现在我发现了matlab中的lasso函数 但我不确定这就是我需要的。谢谢。
最佳答案
A=double(A);
[M,N]=size(A);
Dm=eye(M);
Dn=eye(N);
Dxx=diff(Dm,2,1); % 2nd derivative
Dyy=diff(Dn,2,1);
LA=kron(Dxx,Dn)+kron(Dm,Dyy); %Laplacian operator
I=eye(M*N);
A1=zeros(size(A));
A1(1:alpha,:)=1; % alpha in formula (1) and (2) from paper, boundary margin
A1(M-alpha:M,:)=1;
B1=zeros(size(B)); % B is A' in the formula
B1(1:alpha,:)=1;
B1(M:M+alpha,:)=1; % B1 is A-A', boundary elements padded as the paper shows
H=[LA;sqrt(lambda)*I(A1,:)]; % consolidate the laplacian operator in the 1st part and the norm in the 2nd part
y=[zeros(size(LA,1),1);B(B1)]; % convert the original problem to a matrix equation Hx=y
X=reshape(H\y, M,N);
关于matlab - 如何在matlab中实现正则化最小二乘法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21028202/