Spatial Filtering (Chapter 3) CS474/674 - Prof. Bebis.

Slides:



Advertisements
Similar presentations
Linear Filtering – Part I Selim Aksoy Department of Computer Engineering Bilkent University
Advertisements

Spatial Filtering (Chapter 3)
Topic 6 - Image Filtering - I DIGITAL IMAGE PROCESSING Course 3624 Department of Physics and Astronomy Professor Bob Warwick.
Image Processing Lecture 4
Image Filtering. Outline Outline Concept of image filter  Focus on spatial image filter Various types of image filter  Smoothing, noise reductions 
Frequency Domain Filtering (Chapter 4)
Sliding Window Filters and Edge Detection Longin Jan Latecki Computer Graphics and Image Processing CIS 601 – Fall 2004.
CS 4487/9587 Algorithms for Image Analysis
Digital Image Processing
Digital Image Processing In The Name Of God Digital Image Processing Lecture3: Image enhancement M. Ghelich Oghli By: M. Ghelich Oghli
Multimedia communications EG 371Dr Matt Roach Multimedia Communications EG 371 and EE 348 Dr Matt Roach Lecture 6 Image processing (filters)
Image Filtering CS485/685 Computer Vision Prof. George Bebis.
MSU CSE 803 Stockman Linear Operations Using Masks Masks are patterns used to define the weights used in averaging the neighbors of a pixel to compute.
CS 376b Introduction to Computer Vision 02 / 27 / 2008 Instructor: Michael Eckmann.
Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering
1 Image Filtering Readings: Ch 5: 5.4, 5.5, 5.6,5.7.3, 5.8 (This lecture does not follow the book.) Images by Pawan SinhaPawan Sinha formal terminology.
Segmentation (Section 10.2)
2-D, 2nd Order Derivatives for Image Enhancement
MSU CSE 803 Linear Operations Using Masks Masks are patterns used to define the weights used in averaging the neighbors of a pixel to compute some result.
Image Filtering. Problem! Noise is a problem, even in images! Gaussian NoiseSalt and Pepper Noise.
ECE 472/572 - Digital Image Processing Lecture 4 - Image Enhancement - Spatial Filter 09/06/11.
Chapter 3 (cont).  In this section several basic concepts are introduced underlying the use of spatial filters for image processing.  Mainly spatial.
Presentation Image Filters
Spatial Filtering: Basics
Digital Image Processing
Introduction to Image Processing Grass Sky Tree ? ? Sharpening Spatial Filters.
Digital Image Processing Lecture 5: Neighborhood Processing: Spatial Filtering Prof. Charlene Tsai.
Lecture 03 Area Based Image Processing Lecture 03 Area Based Image Processing Mata kuliah: T Computer Vision Tahun: 2010.
Image processing Fourth lecture Image Restoration Image Restoration: Image restoration methods are used to improve the appearance of an image.
Chapter 5: Neighborhood Processing
Spatial Filtering.
Spatial Filtering (Applying filters directly on Image) By Engr. Muhammad Saqib.
Digital Image Processing, 3rd ed. © 1992–2008 R. C. Gonzalez & R. E. Woods Gonzalez & Woods Chapter 3 Intensity Transformations.
Image Subtraction Mask mode radiography h(x,y) is the mask.
Digital Image Processing Lecture 16: Segmentation: Detection of Discontinuities Prof. Charlene Tsai.
Mestrado em Ciência de Computadores Mestrado Integrado em Engenharia de Redes e Sistemas Informáticos VC 15/16 – TP7 Spatial Filters Miguel Tavares Coimbra.
CSE 6367 Computer Vision Image Operations and Filtering “You cannot teach a man anything, you can only help him find it within himself.” ― Galileo GalileiGalileo.
Image enhancement Last update Heejune Ahn, SeoulTech.
Digital Image Processing Lecture 16: Segmentation: Detection of Discontinuities May 2, 2005 Prof. Charlene Tsai.
Machine Vision Edge Detection Techniques ENT 273 Lecture 6 Hema C.R.
Filtering the Images.  Filtering images using low-pass filters  Filtering images using a median filter  Applying directional filters to detect edges.
Instructor: Mircea Nicolescu Lecture 7
Instructor: Mircea Nicolescu Lecture 5 CS 485 / 685 Computer Vision.
CSE 185 Introduction to Computer Vision Image Filtering: Spatial Domain.
Digital Image Processing Week V Thurdsak LEAUHATONG.
Digital Image Processing CSC331
Sliding Window Filters Longin Jan Latecki October 9, 2002.
Non-linear filtering Example: Median filter Replaces pixel value by median value over neighborhood Generates no new gray levels.
Miguel Tavares Coimbra
Image Subtraction Mask mode radiography h(x,y) is the mask.
Program Studi S-1 Teknik Informatika FMIPA Universitas Padjadjaran
Edge Detection Phil Mlsna, Ph.D. Dept. of Electrical Engineering Northern Arizona University.
Fundamentals of Spatial Filtering:
Digital Image Processing Lecture 16: Segmentation: Detection of Discontinuities Prof. Charlene Tsai.
Image Pre-Processing in the Spatial and Frequent Domain
ECE 692 – Advanced Topics in Computer Vision
Filtering – Part I Gokberk Cinbis Department of Computer Engineering
CS-565 Computer Vision Nazar Khan Lecture 4.
Spatial Filtering - Enhancement
Digital Image Processing
Image Enhancement in the Spatial Domain
Lecture 3 (2.5.07) Image Enhancement in Spatial Domain
Motion illusion, rotating snakes
Digital Image Processing Week IV
Linear Operations Using Masks
Enhancement.
Image Filtering Readings: Ch 5: 5. 4, 5. 5, 5. 6, , 5
Digital Filters.
Image Enhancement in the Spatial Domain
DIGITAL IMAGE PROCESSING Elective 3 (5th Sem.)
Presentation transcript:

Spatial Filtering (Chapter 3) CS474/674 - Prof. Bebis

Spatial Filtering Methods (or Mask Processing Methods) output image

Spatial Filtering (cont’d) The word “filtering” has been borrowed from the frequency domain. Filters are classified as: –Low-pass (i.e., preserve low frequencies) –High-pass (i.e., preserve high frequencies) –Band-pass (i.e., preserve frequencies within a band) –Band-reject (i.e., reject frequencies within a band)

Spatial Filtering (cont’d) Need to define: (1) a neighborhood (or mask) (2) an operation output image

Spatial Filtering – Neighborhood (or Mask) Typically, the neighborhood is rectangular and its size is much smaller than that of f(x,y) - e.g., 3x3 or 5x5

Spatial filtering - Operation output image Example: weighted sum of input pixels. A filtered image is generated as the center of the mask moves to every pixel in the input image. mask weights:

Handling Pixels Close to Boundaries pad with zeroes or ……………………….0

Linear vs Non-Linear Spatial Filtering Methods A filtering method is linear when the output is a weighted sum of the input pixels. Methods that do not satisfy the above property are called non- linear. –e.g.,

Linear Spatial Filtering Methods Main linear spatial filtering methods: –Correlation –Convolution

Correlation Output Image w(i,j) f(i,j) g(i,j)

Correlation (cont’d) Often used in applications where we need to measure the similarity between images or parts of images (e.g., template matching).

Convolution Similar to correlation except that the mask is first flipped both horizontally and vertically. Note: if w(i, j) is symmetric, that is w(i, j)=w(-i,-j), then convolution is equivalent to correlation!

Example Correlation: Convolution:

How do we choose the mask weights? Typically, by sampling certain functions: Gaussian 1 st derivative of Gaussian 2 nd derivative of Gaussian

Filters We will mainly focus on two types of filters: –Smoothing (low-pass) –Sharpening (high-pass)

Smoothing Filters (low-pass) Useful for reducing noise and eliminating small details. The elements of the mask must be positive. Sum of mask elements is 1 (after normalization). Gaussian

Smoothing filters – Example smoothed imageinput image Useful for reducing noise and eliminating small details.

Sharpening Filters (high-pass) Useful for highlighting fine details. The elements of the mask contain both positive and negative weights. Sum of mask elements is 0. 1 st derivative of Gaussian 2 nd derivative of Gaussian

Sharpening Filters (cont’d) Useful for highlighting fine details. –e.g., emphasize edges

Sharpening Filters - Example Note that the response of sharpening might be negative. Values must be re-mapped to [0, 255] sharpened image input image

Smoothing Filters Averaging Gaussian Median filtering (non-linear)

Smoothing Filters: Averaging

Smoothing Filters: Averaging (cont’d) Mask size determines the degree of smoothing (loss of detail). 3x35x57x7 15x1525x25 original

Smoothing Filters: Averaging (cont’d) 15 x 15 averagingimage thresholding Example: extract largest, brightest objects

Smoothing filters: Gaussian The weights are Gaussian samples: mask size is a function of σ: σ = 1.4

Smoothing filters: Gaussian (cont’d) σ controls the amount of smoothing As σ increases, more samples must be obtained to represent the Gaussian function accurately. σ = 3

Smoothing filters: Gaussian (cont’d)

Averaging vs Gaussian Smoothing Averaging Gaussian

Smoothing Filters: Median Filtering (non-linear) Very effective for removing “salt and pepper” noise (i.e., random occurrences of black and white pixels). averaging median filtering

Smoothing Filters: Median Filtering (cont’d) Replace each pixel by the median in a neighborhood around the pixel.

Sharpening Filters Unsharp masking High Boost filter Gradient (1 st derivative) Laplacian (2 nd derivative)

Sharpening Filters: Unsharp Masking Obtain a sharp image by subtracting a lowpass filtered (i.e., smoothed) image from the original image: - = (after contrast enhancement)

Sharpening Filters: High Boost Image sharpening emphasizes edges but low frequency components are lost. High boost filter: amplify input image, then subtract a lowpass image. (A-1)+=

Sharpening Filters: High Boost (cont’d) If A=1, we get unsharp masking. If A>1, part of the original image is added back to the high pass filtered image. One way to implement high boost filtering is using the masks below:

Sharpening Filters: High Boost (cont’d) A=1.4 A=1.9

Sharpening Filters: Derivatives Taking the derivative of an image results in sharpening the image. The derivative of an image (i.e., 2D signal) can be computed using the gradient.

Gradient The gradient is a vector which has magnitude and direction: or (approximation)

Gradient (cont’d) Gradient magnitude: provides information about edge strength. Gradient direction: perpendicular to the direction of the edge.

Gradient Computation Approximate gradient using finite differences: ΔxΔx

Gradient Computation (cont’d) sensitive to vertical edges sensitive to horizontal edges

Example: visualize partial derivatives

Implement Gradient Using Masks We can implement and using masks: Example: approximate gradient at z 5 (x+1/2,y) (x,y+1/2) * * good approximation at (x+1/2,y) good approximation at (x,y+1/2)

Implement Gradient Using Masks (cont’d) A different approximation of the gradient: We can implement and using the following masks: * (x+1/2,y+1/2) good approximation

Implement Gradient Using Masks (cont’d) Other approximations Sobel Prewitt

Example: Gradient Magnitude Image Gradient Magnitude (isotropic)

Laplacian The Laplacian (2 nd derivative) is defined as: (dot product) Approximate 2 nd derivatives:

Laplacian (cont’d) Laplacian Mask Edges can be found by detect the zero-crossings

Example: Laplacian vs Gradient Laplacian Sobel