The document discusses digital image processing techniques for locally enhancing images through spatial filtering. It describes how spatial masks are convolved over an image and how the mask coefficients determine the nature of enhancement. Common techniques like smoothing and sharpening filters are explained.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
20 views
DIP Lecture - 05
The document discusses digital image processing techniques for locally enhancing images through spatial filtering. It describes how spatial masks are convolved over an image and how the mask coefficients determine the nature of enhancement. Common techniques like smoothing and sharpening filters are explained.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19
Digital Image Processing
Image Enhancement in Spatial Domain
Local enhancement techniques using Spatial (Mask) Filtering Local Enhancement through 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 values around (x,y) ▪ Spatial masks (also called window, filter, kernel, template) are used and convolved over the entire image for local enhancement (spatial filtering) ▪ The size of the mask determines the number of neighboring pixels which influence the output value at (x,y) ▪ The values (coefficients) of the mask determine the nature and properties of enhancing technique Local Enhancement through Spatial Filtering Basics of Spatial Filtering
▪ Given the 3×3 mask with coefficients: w1, w2,…, w9
▪ The mask covers the pixels with gray levels: z1, z2,…, z9
▪ z gives the output intensity value for the processed image
(to be stored in a new array) at the location of z5 in the input image Basics of Spatial Filtering Mask operation near the image border Problem arises when part of the mask is located outside the image plane; to handle the problem: 1. Discard the problem pixels (e.g. 512x512input 510x510output, if mask size is 3x3) 2. Zero padding: expand the input image by padding zeros (512x512input 514x514output) – Zero padding is not good; creates artificial lines or edges on the border 3. We normally use the gray levels of border pixels to fill up the expanded region (for 3x3 mask). For larger masks a border region equal to half of the mask size is mirrored on the expanded region. Mask Operation Near the Image Border Spatial Filtering for Smoothing ▪ For blurring/noise reduction; Blurring is 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 in frequency domain because smaller (high frequency) details are removed based 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 Smoothing Filters Spatial Filtering for Smoothing (Example) Spatial Filtering for Smoothing (Example) 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 Median Filtering Median Filtering (Example) Spatial Filtering for Image Sharpening
Background: to highlight fine detail in an image or to
enhance blurred detail Applications: electronic printing, medical imaging, industrial inspection, autonomous target detection (smart weapons)...... Foundation: ▪ Blurring/smoothing is performed by spatial averaging (equivalent to integration) ▪ Sharpening is performed by noting only the gray level changes in the image that is the differentiation Spatial Filtering for Image Sharpening
Operation of Image Differentiation
▪ Enhance edges and discontinuities (magnitude of output gray level >>0) ▪ De-emphasize areas with slowly varying gray-level values (output gray level: 0)
Mathematical Basis of Filtering for Image Sharpening
▪ First-order and second-order derivatives ▪ Approximation in discrete-space domain ▪ Implementation by mask filtering First and Second Order Derivatives Example for Discrete Derivatives Comparison between f" and f´
▪ f´ generally produces thicker edges in an image
▪ f" has a stronger response to fine detail ▪ f´ generally has a stronger response to a gray-level step ▪ f" produces a double response at step changes in gray level ▪ For image enhancement, f" is generally better suited than f´ ▪ Major application of f´ is for edge extraction; f´ used together with f" results in impressive enhancement effect Enhancement by 2nd Derivative (Example)