Ch-03 intensity transformations and spatial filtering

Chapter 3

What is this lesson about?

Spatial domain processing

A \(3 \times 3\) neighborhood about a point \((x,y)\)

Intensity transformation

Intensity Transformation Functions

Basic intensity transformation functions

Image negatives

Original mammogram image and its negative

Log Transformations

Fourier spectrum and \(\log\) transformation

Fourier spectrum and its \(\log\) transformation

Power-law (\(\gamma\)) transformations

Plots of the equation \(s = cr^\gamma\) for various values of \(\gamma\)

Gamma \((\gamma)\) correction

Intensity ramp image with \(\gamma\) correction

Power-law transformations for contrast manipulation

Contrast enhancement of an MRI image

Power-law transformations for contrast manipulation

An aerial image and \(\gamma\) manipulation for improving contrast

Piecewise-Linear Transformation Functions

Contrast stretching

Contrast stretching and thresholding

Contrast stretching

Contrast stretching

Intensity-level slicing

Transformation functions for intensity-level slicing

Highlight major blood vessels

Aortic angiogram and intensity-level transformations

Bit-plane representation of an 8-bit image

Bit-plane slicing

An 8-bit image and its 8 bit planes (1 through 8)

Why bit-plane slicing?

Reconstruction using bit planes

Histogram Processing

Intensity distribution and histogram (a 3-bit, \(64 \times 64\) image)

Image histograms

Dark, light, low-contrast, and high-contrast image types

Histogram Equalization

Histogram equalization

Probability density function (PDF)

Cumulative distribution function (CDF)

CDF

\[\begin{aligned} p_{s}(s) &=p_{r}(r)\left|\frac{d r}{d s}\right| \\ &=p_{r}(r)\left|\frac{1}{(L-1) p_{r}(r)}\right| \\ &=\frac{1}{(L-1)}, \quad 0 \leq s \leq L-1 \end{aligned}\]

Applying \(s = T(r) = (L-1) \int_0^r p_r(w) \, dw\)

Example to illustrate equations

Discrete form of intensity transformations

Discrete form of intensity transformations

Example to illustrate histogram equalization

Intensity distribution and histogram values

Example to illustrate histogram equalization

Example to illustrate histogram equalization

Histogram equalized images

Histogram Matching (Specification)

Histogram equalization based on a specified histogram

Histogram matching (specification)

Histogram matching procedure

Example to illustrate histogram specification

Histogram specification

Histogram equalization: discrete formulation

Summary of histogram specification procedure

Example to illustrate histogram specification

Histogram equalization based on a specified histogram

Specified and actual histograms

Example to illustrate histogram specification

Example to illustrate histogram specification: \(G\) values

Example to illustrate histogram specification

Example to illustrate histogram specification \(s_k \rightarrow z_q\)

Mars moon: Phobos

Mars moon and its histogram

Histogram equalized Mars moon image

Mars moon: Phobos

Mars moon: Phobos (enhanced image using mappings from curve (2))

Local Histogram Processing

Local histogram processing example

Global and local histogram equalizations

Image histogram statistics

\[\begin{aligned} \mu_{n}(r) &=\sum_{i=0}^{L-1}\left(r_{i}-m\right)^{n} p\left(r_{i}\right) \\ m &=\sum_{i=0}^{L-1} r_{i} p\left(r_{i}\right) \end{aligned}\] \[\mu_{2}(r)=\sum_{i=0}^{L-1}\left(r_{i}-m\right)^{2} p\left(r_{i}\right)\] \[\begin{aligned} m &=\frac{1}{M N} \sum_{x=0}^{M-1} \sum_{y=0}^{N-1} f(x, y) \\ \sigma^{2} &=\frac{1}{M N} \sum_{x=0}^{M-1} \sum_{y=0}^{N-1}\left[(f(x, y)-m]^{2}\right. \end{aligned}\]

Image histogram statistics example

\[\left(\begin{array}{lllll} 0 & 0 & 1 & 1 & 2 \\ 1 & 2 & 3 & 0 & 1 \\ 3 & 3 & 2 & 2 & 0 \\ 2 & 3 & 1 & 0 & 0 \\ 1 & 1 & 3 & 2 & 2 \end{array}\right)\] \[\begin{aligned} m &=\frac{1}{25} \sum_{x=0}^{4} \sum_{y=0}^{4} f(x, y) \\ &=1.44 \end{aligned}\]

Global (and local) mean and variance

\[m_{S_{x y}}=\sum_{i=0}^{L-1} r_{i} p_{S_{x y}}\left(r_{i}\right)\] \[\sigma_{S_{x y}}^{2}=\sum_{i=0}^{L-1}\left(r_{i}-m_{S_{x y}}\right)^{2} p_{S_{x y}}\left(r_{i}\right)\]

Local enhancement using histogram statistics

Global and local histogram equalization

Local enhancement using histogram statistics

\[g(x, y)=\left\{\begin{array}{ll} E \cdot f(x, y) & \text { if } m_{S_{x y}} \leq k_{0} m_{G} \text { and } k_{1} \sigma_{G} \leq \sigma_{S_{x y}} \leq k_{2} \sigma_{G} \\ f(x, y) & \text { otherwise } \end{array}\right.\]

Spatial Filtering

Linear Spatial filtering

\[\begin{aligned} g(x, y)=& w(-1,-1) f(x-1, y-1)+w(-1,0) f(x-1, y)+\cdots \\ &+w(0,0) f(x, y)+\cdots+w(1,1) f(x+1, y+1) \end{aligned}\] \[g(x, y)=\sum_{s=-a}^{a} \sum_{t=-b}^{b} w(s, t) f(x+s, y+t)\]

Spatial Correlation and Convolution

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

Vector representation of linear filtering

\[R &= w_1z_1 + w_2z_2 + \cdots + w_{9}z_{9} \\ &= \sum_{k=1}^{9} w_kz_k \\ &= \mathbf{w}^T\mathbf{z}\]

Generating spatial filter masks

\[R = \frac{1}{9}\sum_{i=1}^{9} z_i\] \[h(x,y) = e^{-\frac{x^2+y^2}{2\sigma^2}}\]

Smoothing spatial filters

\[R = \frac{1}{9}\sum_{i=1}^{9} z_i\] \[g(x,y) = \frac{\displaystyle\sum_{s=-a}^{a} \displaystyle\sum_{t=-b}^{b} w(s,t) f(x+s,y+t)}{\displaystyle\sum_{s=-a}^{a} \displaystyle\sum_{t=-b}^{b} w(s,t)}\]

Smoothing with different filter sizes: example

Smoothing followed by thresholding: example

Order-statistic (nonlinear) filters

Median filter**

\[R = \max\{z_k \mid k = 1, 2, \cdots, 9\}\]

Median filter example

Sharpening Spatial Filters

Derivatives of a digital function

\[\frac{\partial f}{\partial x} = f(x+1) - f(x)\] \[\frac{\partial^2 f}{\partial^2 x} = f(x+1) + f(x-1) - 2 f(x)\]

First- and second-order derivatives

The Laplacian: a second derivativ**

\[\nabla^2f = \frac{\partial^2f}{\partial x^2} + \frac{\partial^2f}{\partial y^2}\] \[\frac{\partial^2f}{\partial x^2} &= f(x+1, y) + f(x-1,y) - 2f(x,y) \label{eqn:nablaOne} \\ \frac{\partial^2f}{\partial y^2} &= f(x, y+1) + f(x,y-1) - 2f(x,y) \label{eqn:nablaTwo}\] \[\nabla^2f(x,y) = f(x+1, y) + f(x-1,y) + f(x, y+1) + f(x,y-1) - 4f(x,y)\]

Implementing the discrete Laplacian

\[g(x,y) = f(x,y) + c [\nabla^2f(x,y)]\]

Image sharpening using the Laplacian: example

Unsharp masking and highboost filtering

\[g_{\text{mask}}(x,y) = f(x,y) - \overline{f}(x,y)\] \[g(x,y) = f(x,y) + k g_{\text{mask}}(x,y)\]

Image sharpening using unsharp masking

The Gradient

\[\nabla f \equiv \text{grad}(f) \equiv \begin{bmatrix} g_x \\ g_y \end{bmatrix} = \begin{bmatrix} \frac{\partial f}{\partial x} \\ \\ \frac{\partial f}{\partial y} \end{bmatrix}\] \[M(x,y) = \text{mag}(\nabla f) = \sqrt{(g_x^2 + g_y^2)}\] \[M(x,y) \approx \,\, \mid \! g_x \! \mid + \mid \! g_y \! \mid\]

Discrete approximations of the gradient

\[g_x = (z_8 - z_5) \text{ and } g_y = (z_6 - z_5)\] \[g_x = (z_9 - z_5) \text{ and } g_y = (z_8 - z_6)\] \[M(x,y) = [(z_9 - z_5)^2 + (z_8 - z_6)^2]^\frac{1}{2}\] \[M(x,y) \approx \,\, \mid \!z_9 - z_5\!\mid + \mid\!z_8 - z_6 \!\mid\]

Approximations to \(g_x\) and \(g_y\)

\[g_x &= \frac{\partial f}{\partial x} = (z_7 + 2z_8 + z_9) - (z_1 + 2z_2 + z_3) \\ g_y &= \frac{\partial f}{\partial y} = (z_3 + 2z_6 + z_9) - (z_1 + 2z_4 + z_7)\] \[M(x,y) \approx \,\,\mid \! \! (z_7 &+ 2z_8 + z_9) - (z_1 + 2z_2 + z_3) \!\! \mid \\ &+ \mid \! \!(z_3 + 2z_6 + z_9) - (z_1 + 2z_4 + z_7) \! \! \mid\]

Gradient operators

Use of the gradient for edge enhancement

Combining spatial enhancement methods: example

Fuzzy Techniques

Summary

-

Back to course home