DSPRelated.com
Code

Image denoising - Threshold calculation for Bishrink method

Senthilkumar July 30, 2011 Coded in Matlab

This function used to calculate the threshold for image denoising using bishrink method

function T = bishrink2(CD,CY)
sigman = (median(median(abs(CD))))/0.6745;
[m,n] = size(CY);
sigmay = 0;
for i =1:m
    for j = 1:n
        sigmay = sigmay+((CY(i,j))^2);
    end
end
sigmay = sqrt(2)*sigmay/(m*n);
sigma = sqrt(max((((sigmay))-((sigman)^2)),0)); % Variance calculation
if sigma~=0
    T = sqrt(3)*(sigman^2)/sigma;   %Threshold
else
    T = max(max(abs(CY)));
end