Digital Image Processing

Slides:



Advertisements
Similar presentations
Digital Image Processing
Advertisements

Spatial Filtering (Chapter 3)
Image Processing Lecture 4
CS & CS Multimedia Processing Lecture 2. Intensity Transformation and Spatial Filtering Spring 2009.
Spatial Filtering.
Local Enhancement Histogram processing methods are global processing, in the sense that pixels are modified by a transformation function based on the gray-level.
Chapter 3 Image Enhancement in the Spatial Domain.
Lecture 6 Sharpening Filters
Chapter - 2 IMAGE ENHANCEMENT
Digital Image Processing
Intensity Transformations (Chapter 3)
EE 4780 Image Enhancement. Bahadir K. Gunturk2 Image Enhancement The objective of image enhancement is to process an image so that the result is more.
Digital Image Processing
Image Enhancement in the Spatial Domain II Jen-Chang Liu, 2006.
Image Enhancement in the Spatial Domain
Intensity Transformations
BYST Eh-1 DIP - WS2002: Enhancement in the Spatial Domain Digital Image Processing Bundit Thipakorn, Ph.D. Computer Engineering Department Image Enhancement.
Image Enhancement by Modifying Gray Scale of Individual Pixels
Digital Image Processing In The Name Of God Digital Image Processing Lecture3: Image enhancement M. Ghelich Oghli By: M. Ghelich Oghli
Chapter 3: Image Enhancement in the Spatial Domain
Image Enhancement To process an image so that the result is more suitable than the original image for a specific application. Spatial domain methods and.
6/9/2015Digital Image Processing1. 2 Example Histogram.
Digital Image Processing
Image Enhancement.
Lecture 2. Intensity Transformation and Spatial Filtering
Chapter 3 Image Enhancement in the Spatial Domain.
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.
Chap2 Image enhancement (Spatial domain)
 Image Enhancement in Spatial Domain.  Spatial domain process on images can be described as g(x, y) = T[f(x, y)] ◦ where f(x,y) is the input image,
Digital Image Processing
Spatial Filtering: Basics
University of Ioannina - Department of Computer Science Intensity Transformations (Point Processing) Christophoros Nikou Digital Image.
DIGITAL IMAGE PROCESSING Instructors: Dr J. Shanbehzadeh M.Gholizadeh M.Gholizadeh
CS654: Digital Image Analysis Lecture 17: Image Enhancement.
Chapter 3 Image Enhancement in the Spatial Domain.
Digital Image Processing
DIGITAL IMAGE PROCESSING
Digital Image Processing Lecture 4: Image Enhancement: Point Processing Prof. Charlene Tsai.
Intensity Transformations or Translation in Spatial Domain.
Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods  Process an image so that the result will be more suitable.
Digtial Image Processing, Spring ECES 682 Digital Image Processing Oleh Tretiak ECE Department Drexel University.
Spatial Filtering.
Ch5 Image Restoration CS446 Instructor: Nada ALZaben.
Image Enhancement ارتقاء تصویر Enhancement Spatial Domain Frequency Domain.
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 EEE415 Lecture 3
İmage enhancement Prepare image for further processing steps for specific applications.
ISAN-DSP GROUP Digital Image Fundamentals ISAN-DSP GROUP What is Digital Image Processing ? Processing of a multidimensional pictures by a digital computer.
Lecture Reading  3.1 Background  3.2 Some Basic Gray Level Transformations Some Basic Gray Level Transformations  Image Negatives  Log.
Digital Image Processing Lecture 4: Image Enhancement: Point Processing January 13, 2004 Prof. Charlene Tsai.
EE 7730 Image Enhancement. Bahadir K. Gunturk2 Image Enhancement The objective of image enhancement is to process an image so that the result is more.
Digital Image Processing Image Enhancement in Spatial Domain
Digital Image Processing, 2nd ed. © 2002 R. C. Gonzalez & R. E. Woods Chapter 3 Image Enhancement in the Spatial Domain Chapter.
Digital Image Processing Week V Thurdsak LEAUHATONG.
Image Enhancement in the Spatial Domain.
Digital Image Fundamentals
IMAGE ENHANCEMENT TECHNIQUES
IMAGE PROCESSING INTENSITY TRANSFORMATION AND SPATIAL FILTERING
Image Enhancement.
Histogram Histogram is a graph that shows frequency of anything. Histograms usually have bars that represent frequency of occuring of data. Histogram has.
CIS 350 – 3 Image ENHANCEMENT SPATIAL DOMAIN
Image Enhancement in the Spatial Domain
Lecture 3 (2.5.07) Image Enhancement in Spatial Domain
CSC 381/481 Quarter: Fall 03/04 Daniela Stan Raicu
Intensity Transformations and Spatial Filtering
IT523 Digital Image Processing
Image Enhancement in the Spatial Domain
Presentation transcript:

Digital Image Processing Chapter 3: Image Enhancement in the Spatial Domain 15 June 2007

The space where all pixels form an image Spatial Domain What is spatial domain The space where all pixels form an image In spatial domain we can represent an image by f(x,y) where x and y are coordinates along x and y axis with respect to an origin There is duality between Spatial and Frequency Domains Using the Fourier transform, the word “distance” is lost but the word “frequency” becomes alive. Images in the spatial domain are pictures in the xy plane where the word “distance” is meaningful.

Image Enhancement means improvement of images to be suitable for specific applications. Example: Note: each image enhancement technique that is suitable for one application may not be suitable for other applications. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Image Enhancement Example Original image Enhanced image using Gamma correction (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Image Enhancement in the Spatial Domain = Image enhancement using processes performed in the Spatial domain resulting in images in the Spatial domain. We can written as where f(x,y) is an original image, g(x,y) is an output and T[ ] is a function defined in the area around (x,y) Note: T[ ] may have one input as a pixel value at (x,y) only or multiple inputs as pixels in neighbors of (x,y) depending in each function. Ex. Contrast enhancement uses a pixel value at (x,y) only for an input while smoothing filte use several pixels around (x,y) as inputs.

Types of Image Enhancement in the Spatial Domain - Single pixel methods - Gray level transformations Example - Historgram equalization - Contrast stretching - Arithmetic/logic operations Examples - Image subtraction - Image averaging - Multiple pixel methods Spatial filtering - Smoothing filters - Sharpening filters

Gray Level Transformation Transforms intensity of an original image into intensity of an output image using a function: where r = input intensity and s = output intensity Example: Contrast enhancement (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

L = the number of gray levels Image Negative L-1 Original digital mammogram White Output intensity Negative digital mammogram Black L-1 Black Input intensity White L = the number of gray levels (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Log Transformations Application Fourier spectrum Log Tr. of Fourier (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Power-Law Transformations (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Image Desired displayed image at Monitor Image After displayed at Power-Law Transformations : Gamma Correction Application Image displayed at Monitor Desired image Image displayed at Monitor After Gamma correction (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Power-Law Transformations : Gamma Correction Application MRI Image after Gamma Correction (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Power-Law Transformations : Gamma Correction Application Ariel images after Gamma Correction (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Contrast means the difference between the brightest and darkest Contrast Stretching Contrast means the difference between the brightest and darkest intensities Before contrast enhancement After (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

How to know where the contrast is enhanced ? Notice the slope of T(r) if Slope > 1  Contrast increases if Slope < 1  Contrast decrease if Slope = 1  no change Ds Dr Smaller Dr yields wider Ds = increasing Contrast (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Gray Level Slicing (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Bit-plane Slicing Bit 7 Bit 6 Bit 5 Bit 3 Bit 2 Bit 1 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Histogram = Graph of population frequencies Grades of the course 178 xxx

= graph of no. of pixels vs intensities Histogram of an Image = graph of no. of pixels vs intensities Dark image has histogram on the left จำนวน pixel Bright image has histogram on the right จำนวน pixel (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Histogram of an Image (cont.) low contrast image has narrow histogram high contrast image has wide histogram (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

= intensity transformation based on histogram Histogram Processing = intensity transformation based on histogram information to yield desired histogram - Histogram equalization To make histogram distributed uniformly - Histogram matching To make histogram as the desire

Monotonically Increasing Function = Function that is only increasing or constant Properties of Histogram processing function 1. Monotonically increasing function 2.

Probability Density Function Histogram is analogous to Probability Density Function (PDF) which represent density of population Let s and r be Random variables with PDF ps(s) and pr(r ) respectively and relation between s and r is We get

Histogram Equalization Let We get !

Histogram Equalization Formula in the previous slide is for a continuous PDF For Histogram of Digital Image, we use nj = the number of pixels with intensity = j N = the number of total pixels

Histogram Equalization Example Intensity # pixels 20 1 5 2 25 3 10 4 15 6 7 Total 100 Accumulative Sum of Pr 20/100 = 0.2 (20+5)/100 = 0.25 (20+5+25)/100 = 0.5 (20+5+25+10)/100 = 0.6 (20+5+25+10+15)/100 = 0.75 (20+5+25+10+15+5)/100 = 0.8 (20+5+25+10+15+5+10)/100 = 0.9 (20+5+25+10+15+5+10+10)/100 = 1.0 1.0

Histogram Equalization Example (cont.) Intensity (r) No. of Pixels (nj) Acc Sum of Pr Output value Quantized Output (s) 20 0.2 0.2x7 = 1.4 1 5 0.25 0.25*7 = 1.75 2 25 0.5 0.5*7 = 3.5 3 10 0.6 0.6*7 = 4.2 4 15 0.75 0.75*7 = 5.25 0.8 0.8*7 = 5.6 6 0.9 0.9*7 = 6.3 7 1.0 1.0x7 = 7 Total 100

Histogram Equalization (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Histogram Equalization (cont.) (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Histogram Equalization (cont.) (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Histogram Equalization (cont.) (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

After histogram equalization, the image become a low contrast image Histogram Equalization (cont.) Original image After histogram equalization, the image become a low contrast image (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Histogram Matching : Algorithm To transform image histogram to be a desired histogram Concept : from Histogram equalization, we have We get ps(s) = 1 We want an output image to have PDF pz(z) Apply histogram equalization to pz(z), we get We get pv(v) = 1 Since ps(s) = pv(v) = 1 therefore s and v are equivalent Therefore, we can transform r to z by T( ) G-1( ) r s z

Histogram Matching : Algorithm (cont.) s = T(r) v = G(z) 2 1 3 z = G-1(v) 4 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Histogram Matching Example Input image histogram Desired Histogram Example Intensity ( s ) # pixels 20 1 5 2 25 3 10 4 15 6 7 Total 100 Intensity ( z ) # pixels 5 1 10 2 15 3 20 4 6 7 Total 100 Original data User define

Histogram Matching Example (cont.) 1. Apply Histogram Equalization to both tables r (nj) SPr s 20 0.2 1 5 0.25 2 25 0.5 3 10 0.6 4 15 0.75 0.8 6 0.9 7 1.0 z (nj) SPz v 5 0.05 1 10 0.15 2 15 0.3 3 20 0.5 4 0.7 0.85 6 0.95 7 1.0 sk = T(rk) vk = G(zk)

Histogram Matching Example (cont.) 2. Get a map Actual Output Histogram We get r  s v  z r s 1 2 3 4 5 6 7 s  v v z 1 2 4 3 5 6 7 r z 1 2 3 4 5 6 7 z # Pixels 1 20 2 30 3 10 4 15 5 6 7 sk = T(rk) zk = G-1(vk)

Histogram Matching Example (cont.) Desired histogram Transfer function Actual histogram (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Histogram Matching Example (cont.) After histogram equalization After histogram matching Original image

Local Enhancement : Local Histogram Equalization Concept: Perform histogram equalization in a small neighborhood After Local Hist Eq. In 7x7 neighborhood Orignal image After Hist Eq. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Local Enhancement : Histogram Statistic for Image Enhancement We can use statistic parameters such as Mean, Variance of Local area for image enhancement Image of tungsten filament taken using An electron microscope In the lower right corner, there is a filament in the background which is very dark and we want this to be brighter. We cannot increase the brightness of the whole image since the white filament will be too bright. (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Example: Local enhancement for this task Local Variance image Multiplication factor Original image (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Local Enhancement Output image (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

AND OR Logic Operations Application: Crop areas of interest Original image Image mask Result Region of Interest (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Arithmetic Operation: Subtraction Application: Error measurement Error image (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Arithmetic Operation: Subtraction (cont.) Application: Mask mode radiography in angiography work (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Arithmetic Operation: Image Averaging Application : Noise reduction Degraded image (noise) Image averaging Averaging results in reduction of Noise variance (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Arithmetic Operation: Image Averaging (cont.) (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Basics of Spatial Filtering Sometime we need to manipulate values obtained from neighboring pixels Example: How can we compute an average value of pixels in a 3x3 region center at a pixel z? Pixel z 2 4 1 2 6 2 9 2 3 4 4 4 7 2 9 7 6 7 5 2 3 6 1 5 7 4 2 5 1 2 2 5 2 3 2 8 Image

Basics of Spatial Filtering (cont.) Step 1. Selected only needed pixels Pixel z … 2 4 1 2 6 2 9 2 3 4 4 4 3 4 4 … … 7 2 9 7 6 7 9 7 6 5 2 3 6 1 5 3 6 1 7 4 2 5 1 2 … 2 5 2 3 2 8

Basics of Spatial Filtering (cont.) Step 2. Multiply every pixel by 1/9 and then sum up the values 4 6 7 9 1 3 … X 1 Mask or Window or Template

Basics of Spatial Filtering (cont.) Question: How to compute the 3x3 average values at every pixels? Solution: Imagine that we have a 3x3 window that can be placed everywhere on the image 2 4 1 2 6 2 9 2 3 4 4 4 7 2 9 7 6 7 5 2 3 6 1 5 7 4 2 5 1 2 Masking Window

Basics of Spatial Filtering (cont.) Step 1: Move the window to the first location where we want to compute the average value and then select only pixels inside the window. Step 2: Compute the average value 4 6 7 1 9 2 5 3 4 1 9 2 3 7 Sub image p Step 3: Place the result at the pixel in the output image Original image 4.3 Step 4: Move the window to the next location and go to Step 2 Output image

Example : moving averaging Basics of Spatial Filtering (cont.) The 3x3 averaging method is one example of the mask operation or Spatial filtering. w The mask operation has the corresponding mask (sometimes called window or template). w The mask contains coefficients to be multiplied with pixel values. Example : moving averaging w(2,1) w(3,1) w(3,3) w(2,2) w(3,2) w(1,1) w(1,2) 1 Mask coefficients The mask of the 3x3 moving average filter has all coefficients = 1/9

Basics of Spatial Filtering (cont.) The mask operation at each point is performed by: 1. Move the reference point (center) of mask to the location to be computed 2. Compute sum of products between mask coefficients and pixels in subimage under the mask. Mask frame p(2,1) p(3,2) p(2,2) p(2,3) p(3,3) p(1,1) p(1,3) p(3,1) … w(2,1) w(3,1) w(3,3) w(2,2) w(3,2) w(1,1) w(1,2) Mask coefficients Subimage The reference point of the mask

Basics of Spatial Filtering (cont.) The spatial filtering on the whole image is given by: Move the mask over the image at each location. Compute sum of products between the mask coefficeints and pixels inside subimage under the mask. Store the results at the corresponding pixels of the output image. Move the mask to the next location and go to step 2 until all pixel locations have been used.

3x3 moving average filter Examples of Spatial Filtering Masks Examples of the masks Sobel operators 3x3 moving average filter 1 2 -1 -2 -2 -1 1 2 1 3x3 sharpening filter -1 8

Smoothing Linear Filter : Moving Average Application : noise reduction and image smoothing Disadvantage: lose sharp details (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Smoothing Linear Filter (cont.) (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Order-Statistic Filters Original image subimage Statistic parameters Mean, Median, Mode, Min, Max, Etc. Moving window Output image

Order-Statistic Filters: Median Filter (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Sharpening Spatial Filters There are intensity discontinuities near object edges in an image (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Laplacian Sharpening : How it works Intensity profile Edge p(x) 1st derivative 2nd derivative

Laplacian Sharpening : How it works (cont.) p(x) Laplacian sharpening results in larger intensity discontinuity near the edge.

Laplacian Sharpening : How it works (cont.) Before sharpening p(x) After sharpening

Laplacian Masks Used for estimating image Laplacian -1 8 -1 4 The center of the mask is positive or 1 -8 1 -4 The center of the mask is negative Application: Enhance edge, line, point Disadvantage: Enhance noise

Laplacian Sharpening Example (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Laplacian Sharpening (cont.) Mask for -1 5 -1 9 or Mask for 1 -8 or 1 -4 (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

Unsharp Masking and High-Boost Filtering -1 k+8 -1 k+4 Equation: The center of the mask is negative The center of the mask is positive

Unsharp Masking and High-Boost Filtering (cont.) (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

First Order Derivative Intensity profile 20 40 60 80 100 120 140 160 180 200 0.5 1 50 150 -0.2 0.2 0.1 p(x) Edges 1st derivative 2nd derivative

First Order Partial Derivative: Sobel operators 1 2 -1 -2 -2 -1 1 2 P

First Order Partial Derivative: Image Gradient Gradient magnitude A gradient image emphasizes edges (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition.

First Order Partial Derivative: Image Gradient

Image Enhancement in the Spatial Domain : Mix things up ! B smooth A - + Sharpening C (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. E

Image Enhancement in the Spatial Domain : Mix things up ! Power Law Tr. G C E S F A Multiplication (Images from Rafael C. Gonzalez and Richard E. Wood, Digital Image Processing, 2nd Edition. H