Basics on -D D Random Signal Spring 06 Instructor: K. J. Ray Liu ECE Department, Univ. of Maryland, College Park Overview Last Time: Fourier Analysis for -D signals Image enhancement via spatial filtering Today Spatial filtering (cont d): image sharpening and edge detection Characterize -D random signal (random field) ENEE63 Digital Image Processing (Spring'06) ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [] UMCP ENEE408G Slides (created by M.Wu & R.Liu 00) Image Sharpening Use LPF to generate HPF Subtract a low pass filtered result from the original signal HPF extracts edges and transitions Enhance edges 50 40 30 0 I 0 I LP 0 I HP = I 0 I LP 0 0 0 40 60 80 00 I = I 0 + a*i HP 0 5 0-5 -0 0 0 40 60 80 00 50 40 30 0 0 0 0 0 40 60 80 00 50 40 30 0 0 0 0 0 40 60 80 00 UMCP ENEE408G Slides (created by M.Wu & R.Liu 00) Example of Image Sharpening v(m, = u(m, + a * g(m, Often use Laplacian operator to obtain g(m, Laplacian operator is a discrete form of nd -order derivatives - 0-0 0 -¼ 0 -¼ -¼ 0 -¼ 0 ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [3] ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [4]
UMCP ENEE408G Slides (created by M.Wu & R.Liu 00) Example of Image Sharpening Original moon image is from Matlab Image Toolbox. Other Variations of Image Sharpening High boost filter (Gonzalez-Woods /e pp3 & pp88) Image example is from Gonzalez- Woods /e online slides. UMCP ENEE408G Slides (created by M.Wu 00) I 0 I LP I HP = I 0 I LP I = (b-) I 0 + I HP Equiv. to high pass filtering for b= Amplify or suppress original image pixel values when b Combine sharpening with histogram equalization ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [5] ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [6] UMCP ENEE408G Slides (created by M.Wu & R.Liu 00) Spatial LPF, HPF, & BPF HPF and BPF can be constructed from LPF Low-pass filter Useful in noise smoothing and downsampling/upsampling High-pass filter h HP (m, = δ (m, h LP (m, Useful in edge extraction and image sharpening Band-pass filter h BP (m, = h L (m, h L (m, Useful in edge enhancement Also good for high-pass tasks in the presence of noise avoid amplifying high-frequency noise ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [7] UMCP ENEE408G Slides (created by M.Wu & R.Liu 00) Gradient, st -order Derivatives, and Edges Edge: pixel locations of abrupt luminance change For binary image Take black pixels with immediate white neighbors as edge pixel Detectable by XOR operations For continuous-tone image Spatial luminance gradient vector of an edge pixel edge a vector consists of partial derivatives along two orthogonal directions gradient gives the direction with highest rate of luminance changes How to represent edge? by intensity + direction => Edge map ~ edge intensity + directions Detection Method-: prepare edge examples (templates) of different intensities and directions, then find the best match Detection Method-: measure transitions along orthogonal directions ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [8]
UMCP ENEE408G Slides (created by M.Wu & R.Liu 00) Common Gradient Operators for Edge Detection H (m, H (m, Roberts 0-0 0 0 - Prewitt - 0-0 - 0 - - - 0 0 0 Sobel - 0-0 - 0 - - - 0 0 0 Move the operators across the image and take the inner products Magnitude of gradient vector g(m, = g x (m, + g y (m, Direction of gradient vector tan [ g y (m, / g x (m, ] Gradient operator is HPF in nature ~ could amplify noise Prewitt and Sobel operators compute horizontal and vertical differences of local sum to reduce the effect of noise Examples of Edge Detectors Quantize edge intensity to 0/: set a threshold white pixel denotes strong edge Roberts Prewitt Sobel UMCP ENEE408G Slides (created by M.Wu & R.Liu 00) ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [9] ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [0] Examples of Edge Detectors UMCP ENEE408G Slides (created by M.Wu & R.Liu 00) Frequency Domain View of LPF / HPF Quantize edge intensity to 0/: set a threshold white pixel denotes strong edge Roberts Prewitt Sobel Image example is from Gonzalez-Woods /e online slides. ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [] ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [] 3
UMCP ENEE408G Slides (created by M.Wu & R.Liu 00) Edge Detection: Summary Measure gradient vector Along two orthogonal directions ~ usually horizontal and vertical g x = L / x g y = L / y Magnitude of gradient vector g(m, = g x (m, + g y (m, g(m, = g x (m, + g y (m, (preferred in hardware implement.) Direction of gradient vector tan [ g y (m, / g x (m, ] Characterizing edges in an image (binary) Edge map: specify edge point locations with g(m, > thresh. Edge intensity map: specify gradient magnitude at each pixel Edge direction map: specify directions Summary -D Fourier Transform Image enhancement via spatial filtering Filtering with a small FIR filter Edge detection Readings Jain s book Section.4-.6, 3.3, 7.4 Gonzalez s book Section 4.-4., 3.5-3.7 ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [3] ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [4] Statistical Representation of Images Each pixel is considered as a random variable (r.v.) -D D Random Signals Side-by-Side Comparison with -D Random Process () Sequences of random variables & joint distributions () First two moment functions and their properties (3) Wide-sense stationarity (4) Unique to -D case: separable and isotropic covariance function (5) Power spectral density and properties Relations between pixels Simplest case: i.i.d. More realistically, the color value at a pixel may be statistically related to the colors of its neighbors A sample image A specific image we have obtained to study can be considered as a sample from an ensemble of images The ensemble represents all possible value combinations of random variable array Similar ensemble concept for -D random noise signals ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [5] ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [6] 4
Characterize the Ensemble of -D D Signals Specify by a joint probability distribution function Difficult to measure and specify the joint distribution for images of practical size => too many r.v. : e.g. 5 x 5 = 6,44 Specify by the first few moments Mean ( st moment) and Covariance ( nd moment) may still be non-trivial to measure for the entire image size By various stochastic models Use a few parameters to describe the relations among all pixels E.g. -D extensions from -D Autoregressive (AR) model Important for a variety of image processing tasks image compression, enhancement, restoration, understanding, => Today: some basics on -D random signals Discrete Random Field We call a -D sequence discrete random field if each of its elements is a random variable when the random field represents an ensemble of images, we often call it a random image Mean and Covariance of a complex random field E[u(m,] = μ(m, Cov[u(m,, u(m,n )] = E[(u(m, μ(m,) (u(m,n ) μ(m,n )) * ] = r u ( m, n; m, n ) For zero-mean random field, autocorrelation function = cov. function Wide-sense stationary μ(m, = μ = constant r u ( m, n; m, n ) = r u ( m m, n n ; 0, 0) = r( m m, n n ) also called shift invariant, spatial invariant in some literature ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [7] ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [8] Special Random Fields White noise field A stationary random field Any two elements at different locations x(m, and x(m,n ) are mutually uncorrelated r x ( m m, n n ) = σ x ( m, n ) δ( m m, n n ) Gaussian random field Every segment defined on an arbitrary finite grid is Gaussian i.e. every finite segment of u(m, when mapped into a vector have a joint Gaussian p.d.f. of Special Random Fields White noise field A stationary random field Any two elements at different locations x(m, and x(m,n ) are mutually uncorrelated r x ( m m, n n ) = σ x ( m, n ) δ( m m, n n ) Gaussian random field Every segment defined on an arbitrary finite grid is Gaussian i.e. every finite segment of u(m, when mapped into a vector have a joint Gaussian p.d.f. of ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [9] ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [0] 5
Properties of Covariance for Random Field [Similar to the properties of covariance function for -D random process] Symmetry r u ( m, n; m, n ) = r u* ( m, n ; m, For stationary random field: r( m, n ) = r * ( -m, -n ) For stationary real random field: r( m, n ) = r( -m, -n ) Note in general r u ( m, n; m, n ) r u ( m, n; m, n ) r u ( m, n; m, n ) Non-negativity For x(m, 0 at all (m,: Σ m Σ n Σ m Σ n x(m, r u ( m, n; m, n ) x * (m, n ) 0 Properties of Covariance for Random Field [Recall similar properties of covariance function for -D random process] Symmetry r u ( m, n; m, n ) = r u* ( m, n ; m, For stationary random field: r( m, n ) = r * ( -m, -n ) For stationary real random field: r( m, n ) = r( -m, -n ) Note in general r u ( m, n; m, n ) r u ( m, n; m, n ) r u ( m, n; m, n ) Non-negativity For x(m, 0 at all (m,: Σ m Σ n Σ m Σ n x(m, r u ( m, n; m, n ) x * (m, n ) 0 ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [] ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [] Separable Covariance Functions Separable If the covariance function of a random field can be expressed as a product of covariance functions of -D sequences r( m, n; m, n ) = r ( m, m ) r ( n, n ) Nonstationary case r( m, n ) = r ( m ) r ( n ) Stationary case Example: A separable stationary cov function often used in image proc r(m, = σ ρ m ρ n, ρ < and ρ < σ represents the variance of the random field; ρ and ρ are the one-step correlations in the m and n directions Separable Covariance Functions Separable If the covariance function of a random field can be expressed as a product of covariance functions of -D sequences r( m, n; m, n ) = r ( m, m ) r ( n, n ) Nonstationary case r( m, n ) = r ( m ) r ( n ) Stationary case Example: A separable stationary cov function often used in image proc r(m, = σ ρ m ρ n, ρ < and ρ < σ represents the variance of the random field; ρ and ρ are the one-step correlations in the m and n directions ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [3] ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [4] 6
Isotropic Covariance Functions Isotropic / circularly symmetric i.e. the covariance function only changes with respect to the radius (the distance to the origi, and isn t affected by the angle Example A nonseparable exponential function used as a more realistic cov function for images When a = a = a, this becomes isotropic: r(m, = σ ρ d As a function of the Euclidean distance of d = ( m + n ) / ρ = exp(- a ) Estimating the Mean and Covariance Function Approximate the ensemble average with sample average Example: for an M x N real-valued image x(m, ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [5] ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [6] Spectral Density Function The Spectral density function (SDF) is defined as the Fourier transform of the covariance function r x Δ + + ( ω, ω ) = rx ( m, exp[ j( ωm + ω m= n= S ] Also known as the power spectral density (p.s.d.) ( in some text, p.s.d. is defined as the FT of autocorrelation function ) Example: SDF of stationary white noise field with r(m,= σ δ(m, S + + ( ω, ω) = σδ( m, exp[ j( ωm + ω] = σ m= n= Spectral Density Function The Spectral density function (SDF) is defined as the Fourier transform of the covariance function r x Δ + + ( ω, ω ) = rx ( m, exp[ j( ωm + ω m= n= S ] Also known as the power spectral density (p.s.d.) ( in some text, p.s.d. is defined as the FT of autocorrelation function ) Example: SDF of stationary white noise field with r(m,= σ δ(m, S + + ( ω, ω) = σδ( m, exp[ j( ωm + ω] = σ m= n= ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [7] ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [8] 7
Properties of Power Spectrum [Recall similar properties in -D random process] SDF is real: S(ω, ω ) = S*(ω, ω ) Follows the conjugate symmetry of the covariance function r(m, = r * (-m, - SDF is nonnegative: S(ω, ω ) 0 for ω,ω Follows the non-negativity property of covariance function Intuition: power cannot be negative SDF of the output from a LSI system w/ freq response H(ω, ω ) S y (ω, ω ) = H(ω, ω ) S x (ω, ω ) Z-Transform Expression of Power Spectrum The Z transform of r u Known as the covariance generating function (CGF) or the ZT expression of the power spectrum S( z, z ) Δ S( ω, ω ) = S( z, z + + = x m= n= r ( m, z ) m jω = e, z z z = e n jω ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [9] ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [30] Rational Spectrum Rational Spectrum is the SDF that can be expressed as a ratio of finite polynomials in z and z Realize by Linear Shift-Invariant systems LSI system represented by finite-order difference equations between the -D input and output -D D Z-TransformZ The -D Z-transform is defined by The space represented by the complex variable pair (z, z ) is 4-D Unit surface If ROC include unit surface Transfer function of -D discrete LSI system ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [3] ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [3] 8
Stability Recall for -D LTI system Stability condition in bounded-input bounded-output sense (BIBO) is that the impulse response h[n] is absolutely summable i.e. ROC of H(z) includes the unit circle The ROC of H(z) for a causal and stable system should have all poles inside the unit circle -D Stable LSI system Requires the -D impulse response is absolutely summable Stability Recall for -D LTI system Stability condition in bounded-input bounded-output sense (BIBO) is that the impulse response h[n] is absolutely summable i.e. ROC of H(z) includes the unit circle The ROC of H(z) for a causal and stable system should have all poles inside the unit circle -D Stable LSI system Requires the -D impulse response is absolutely summable i.e. ROC of H(z, z ) must include the unit surface z =, z = i.e. ROC of H(z, z ) must include the unit surface z =, z = ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [33] ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [34] Summary of Today s s Lecture Spatial filter: LPF, HPF, BPF Image sharpening Edge detection Basics on -D random signals Next time Image restoration Readings Jain s book 7.4; 9.4;.9-. Gonzalez s book 3.7-3.8 ENEE63 Digital Image Processing (Spring'06) Lec6 -D Random Signal [35] 9