我想实施Chambolle双配方法。该方法可以总结如下
这是我在matlab中的实现。但是,它没有给出真实的结果。你能看到吗,请给我一些关于该代码的意见/建议
%% Note that div, grad is written correctly. d is given
u=rand(row,col,dim);
a=sum(u,3);
N=2;
for k = 1 : N
u(:,:,k)=u(:,:,k)./a;
end
v=zeros(size(I)); %I is image
for i=1: numIter
for ii=1:N
grad_E = d(:,:,ii);
% solve for u
p1 = zeros([size(u(:,:,1)) N]);
p2 = zeros([size(u(:,:,1)) N]);
for j = 1:5
%% Compute Eq 24
[d1 d2] = grad(div(p1(:,:,ii),p2(:,:,ii))-u(:,:,ii)/(theta*gamma));
Nu = 1+tau*sqrt(d1.^2+d2.^2);
p1(:,:,ii) = (p1(:,:,ii) + tau*d1)./Nu;
p2(:,:,ii) = (p2(:,:,ii) + tau*d2)./Nu;
end % end of inner iteration
v = u(:,:,ii) - theta*gamma*div(p1(:,:,ii),p2(:,:,ii)); %% Eq 23
% solve for v
u(:,:,ii) = min(max(((v-theta*gamma*grad_E-theta*lambda*gamma*(sum(u(:,:,1:size(u,3) ~= ii),3)-1))...
./(1+theta*gamma)),0),1); % Eq 25
end
end