Dr. Cho’s Website
Course Materials

Local image enhancement and image-smoothing spatial filters

Dr. Huidae Cho
Institute for Environmental and Spatial Analysis...University of North Georgia

1   Local enhancement

What if we just want to enhance an image locally?

For example, only dark or light areas?

1.1   $n$th moment of $r$ about its mean

\[\mu_n(r)=\sum_{i=0}^{L-1}(r_i-m)^n p(r_i)\] where

  • $r$: Image
  • $L$: Gray levels
  • $m_r$: Mean gray level or $m_r=\sum_{i=0}^{L-1}r_ip(r_i)$
  • $p(r_i)$: Probability of gray level $i$ or $p(r_i)=\frac{n_i}{n}$
  • $n_i$: Number of pixels with gray level $i$
  • $n$: Total number of pixels

1.2   Global statistics of $r$

\[\mu_0(r)=1\] \[\mu_1(r)=0\] \[\sigma_r^2=\mu_2(r)=\sum_{i=0}^{L-1}(r_i-m)^2p(r_i)\]

1.3   Local statistics of $r$

\[m_{S_{xy}}=\sum_{(s,t)\in S_{xy}}r_{s,t}p(r_{s,t})\] \[\sigma_{S_{xy}}^2=\sum_{(s,t)\in S_{xy}}(r_{s,t}-m_{S_{xy}})^2p(r_{s,t})\] where

  • $S_{xy}$: Neighborhood of pixel at $(x,y)$
  • $(s,t)$: Pixels in $S_{xy}$
  • $r_{s,t}$: Gray level of pixel $(s,t)$

1.4   Conditions for the enhancement of local dark areas

Locally darker than the entire image \[m_{S_{xy}}\leq k_0m_r\qquad 0<k_0<1\]

Locally lower contrast than the entire image, but not constant areas \[k_1\sigma_r\leq\sigma_{S_{xy}}\leq k_2\sigma_r\qquad 0<k_1<k_2<1\]

Make those pixels that meet the above criteria brighter \[g(x,y)=E\cdot f(x,y)\qquad E>1\]

1.5   Transformation for local dark areas

\[g(x,y)= \begin{cases} E\cdot f(x,y)& \text{if }m_{S_{xy}}\leq k_0m_r\text{ and }k_1\sigma_r\leq\sigma_{S_{xy}}\leq k_2\sigma_r\\ f(x,y)& \text{otherwise} \end{cases}\] where

  • $0<k_0<1$
  • $0<k_1<k_2<1$
  • $E>1$

2   Exercise: Shadow enhancement using local enhancement

  1. Local statistics
    • Neighborhood width: 3
    • Neighborhood height: 3
    • Local mean: local_3x3_mean.tif
    • Local standard deviation: local_3x3_std.tif
  2. Local enhance
    • Raster layer: map.tif
    • Local mean: local_3x3_mean.tif
    • Local standard deviation: local_3x3_std.tif
    • Gray-level multiplier: 4
    • Mean parameter: 0.4
    • Lower standard deviation parameter: 0.02
    • Upper standard deviation parameter: 0.4
    • Output TIFF: local_3x3_enhanced.tif

Try 5x5!

3   Linear spatial filtering

A filter or mask is a $m\times n$ subimage with coefficients $w(s,t)$.

An $m\times n$ neighborhood determines the value of the center pixel.

$m$ and $n$ are odd integers.

3.1   Convolution

\[g(x,y)=\sum_{s=-a}^a\sum_{t=-b}^b w(s,t)f(x+s,y+t)\] where

  • $a=\frac{m-1}{2}$
  • $b=\frac{n-1}{2}$
  • $w(s,t)$: Weight
  • $f(x,y)$: Image

4   Smoothing spatial filters

Smoothing/blurring requires the “convolution” or “integration” of neighborhood pixel values and filter coefficients.

4.1   Smoothing linear filters

Weighted average of