How do I structure a total variation denoising code?

5 次查看(过去 30 天)
I have never use matlab before and have thrown in at the deep end with a total variation denoising question.
I have to implement the forward-backward splitting algorithm for the dual form of the total variation denoising problem. I've been sent an example code for the Lasso-primal:
wine_quality.m:
function [white_indicators, red_indicators]=wine_quality() dwhite=dlmread('../data/winequality-white.csv', ';', 1, 0); white_indicators=do_wine_quality(dwhite, 0.0003, 1000) dred=dlmread('../data/winequality-red.csv', ';', 1, 0); red_indicators=do_wine_quality(dred, 0.005, 1000) end
function x=do_wine_quality(data, lambda, iters) A=data(:, 1:11); b=data(:, 12); x0=zeros(11, 1); % L=norm(A)^2 is the factor of smoothness of g(x)=|Ax-b|^2 % This sets tau*L=0.9<=1. tau=0.9/norm(A)^2; x=lasso_fb(A, b, lambda, x0, tau, iters); end
lasso_fb.m:
function x=lasso_fb(A, b, lambda, x0, tau, iters) x=x0; for i=1:iters % z = x-tau grad g(x) x = prox_l1(tau, lambda, x - tau*A'*(A*x-b)); end end
prox_l1.m:
function xnext=prox_l1(tau, lambda, z) % Soft thresholding idx=abs(z)<=lambda; xnext=z-lambda*z./abs(z); xnext(idx)=0; end
How can I use this for the denoising problem?

回答(1 个)

Sudarshan Kolar
Sudarshan Kolar 2017-4-26
Hello Cath,
I understand that you want to implement total variation denoising. Have you considered other resources as well, like:
https://www.mathworks.com/matlabcentral/fileexchange/16204-toolbox-sparse-optmization?focused=5175257&tab=example
https://www.mathworks.com/matlabcentral/fileexchange/52478-the-spectral-total-variation-denoising-algorithm
Hope that helps. Sorry for not being able to answer your question directly.
Sudarshan

类别

Help CenterFile Exchange 中查找有关 Denoising and Compression 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by