local standard deviation of an image

Just checked the file SIGMA_FILTER at the NASA site. I really must spend more time browsing these great sites.

The code is similar, however it does not calculate the true variance under the mask. They calculate for a box width of n, (ignoring centre pixel removal):

   mean_im=(smooth(image, n) )
   dev_im = (image - mean_im)^2
   var_im = smooth(dev_im, n)/(n-1)

This is not the true variance of the pixels under the box mask, as each pixel in the mask is having a different mean subtracted. For example (read this as a formula if you can!):

   Pseudo_Variance = SUM ij ( ( I(x+i,y+j) - MEAN(x+i,y+j)^2) /(n-1)

instead of true variance:

   Variance = SUM ij ( ( I(x+i,y+j) - MEANxy)^2) /(n-1)

which can be reduced to:

   {(SUM ij ( ( I(x+i,y+j)^2 ) - (SUM ij I(x+i,y+j) ) ^2)/n }/(n-1)

hence the non-loop method we use below:

     ; calc box mean
   mean_im = smooth(image, n)
     ; calc box mean of squares
   msq_im = smooth(image^2, n)
     ; hence variance
    var_im = ( msq_im - mean_im^2) * (n/(n-1.0))
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值