E N D
Digital Image Processing-Dr.M.Moorthi Image Enhancement in Spatial Domain Spatial Filtering(Convolution) Image Smoothing (LPF) Digital Image Processing
spatial filtering • The output intensity value at (x,y) depends not only on the input intensity value at (x,y) but also on the specified number of neighboring intensity valuesaround (x,y) • Spatial masks (also called window, filter, kernel, template) are used and convolved over the entire imagefor local enhancement(spatial filtering) • Y(n)=x(n)*h(n) • The values (coefficients) of the mask determine the nature and properties of enhancing technique Digital Image Processing
spatial filtering(linear filtering ) The mechanics of spatial filtering For an image of size M x N and a mask of size m x n The resulting output gray level for any coordinates x and y is given by Digital Image Processing
Purpose:(LPF-Smoothing) Blur or noise reduction Lowpass/Smoothing spatial filtering Sum of the mask coefficients is 1 Visual effect: reduced noise but blurred edge as well Smoothing linear filters Averaging filter Weighted average (e.g., Gaussian) Smoothing nonlinear filters Order statistics filters (e.g., median filter) Purpose(HPF-Sharpening) Highlight fine detail or enhance detail blurred Highpass/Sharpening spatial filter Sum of the mask coefficients is 0 Visual effect: enhanced edges on a dark background High-boost filtering and unsharp masking Derivative filters 1st 2nd Spatial filters
Smoothing • For blurring/noise reduction; • Blurringis usually used in preprocessing steps, e.g., to remove small details from an image prior to object extraction, or to bridge small gaps in lines or curves • Equivalent to Low-pass spatial filtering because smaller (high frequency) details are removedbased on neighborhood averaging(averaging filters) Implementation: The simplest form of the spatial filter for averaging is a square mask (assume m×m mask) with the same coefficients 1/m2 to preserve the gray levels (averaging). Applications: Reduce noise; smooth false contours Side effect: Edge blurring Digital Image Processing
Smoothing filters the pixel at the centre of the mask is multiplied by a higher value than any other Digital Image Processing
Neighborhood Averaging The response of a smoothing linear spatial filter is simply the average of the pixels in the neighborhood of the filter mask
Order-statistics filtering • Nonlinear spatial filters • Output is based on order of gray levels in the masked area (sub-image) • Examples: Median filtering, Max & Min filtering Median filtering • Assigns the mid value of all the gray levels in the mask to the center of mask; • Particularly effective when • the noise pattern consists of strong, spiky components (impulse noise, salt-and-pepper • edges are to be preserved • Force points with distinct gray levels to be more like their neighbors Digital Image Processing
Median Filtering • median filter: Replace the value of a pixel by the median of the gray levels in the neighborhood of that pixel Digital Image Processing