DSPRelated.com
Code

Image denoise: Threshold for sureshrink method

Senthilkumar July 30, 20111 comment Coded in Matlab

This function used to calculate threshold for sureshrink image denoising method

function thr = sureshrink(CD,T)
%function used to calculate threshold using sureshrink method
CD = CD(:)';
n = length(CD);
sx2 = sort(abs(CD)-T).^2;  % sorting in descending order
b  = cumsum(sx2);           %cumulative sum
risks = (n-(2*(1:n))+b)/n;
[risk,best] = min(risks);
thr = sqrt(sx2(best));