2016-09-29 142 views
0

我使用了一个函数来计算BayesShrink的阈值。通常,阈值的结果会给我一个值。当我使用128 * 128大小的图像时,代码可以正常工作,但是我的图像的大小为380 * 992。结果给了我一个矩阵哦阈值1 * 992。 请你能帮助我 有:BayesShrink的阈值

  • X:图像
  • sigmahat =中间值(ABS(X))/ 0.6745;

这是代码: %

function threshold=bayes(X,sigmahat) 

    len=length(X); 
    sigmay2=sum(X.^2)/len; 
    sigmax=sqrt(max(sigmay2-sigmahat.^2,0)); 
    if sigmax==0 threshold=max(abs(X)); 
    else threshold=sigmahat.^2/sigmax; 
    end 
thank you 

回答

0

第一行添加到函数:

X = X(:);

0

根据Chang的原始文件,图像尺寸应该是2的整数次幂。