Digital Image Processing

Similar documents
Achim J. Lilienthal Mobile Robotics and Olfaction Lab, AASS, Örebro University

Digital Image Processing

Practical Image and Video Processing Using MATLAB

Prof. Feng Liu. Winter /10/2019

Chapter 3 Image Enhancement in the Spatial Domain. Chapter 3 Image Enhancement in the Spatial Domain

Filtering in the spatial domain (Spatial Filtering)

CoE4TN4 Image Processing. Chapter 3: Intensity Transformation and Spatial Filtering

Image Filtering. Median Filtering

Image Enhancement in spatial domain. Digital Image Processing GW Chapter 3 from Section (pag 110) Part 2: Filtering in spatial domain

Motivation: Image denoising. How can we reduce noise in a photograph?

Motion illusion, rotating snakes

Filip Malmberg 1TD396 fall 2018 Today s lecture

Filtering Images in the Spatial Domain Chapter 3b G&W. Ross Whitaker (modified by Guido Gerig) School of Computing University of Utah

Motivation: Image denoising. How can we reduce noise in a photograph?

Images and Filters. EE/CSE 576 Linda Shapiro

Vision Review: Image Processing. Course web page:

IMAGE PROCESSING: AREA OPERATIONS (FILTERING)

Image Filtering in Spatial domain. Computer Vision Jia-Bin Huang, Virginia Tech

Image Enhancement. DD2423 Image Analysis and Computer Vision. Computational Vision and Active Perception School of Computer Science and Communication

Image Enhancement II: Neighborhood Operations

Prof. Vidya Manian Dept. of Electrical and Comptuer Engineering

Robert Collins CSE486, Penn State. Lecture 3: Linear Operators

IMAGE ENHANCEMENT IN SPATIAL DOMAIN

Sensors and Sensing Cameras and Camera Calibration

EE482: Digital Signal Processing Applications

Sharpening Spatial Filters ( high pass)

Midterm is on Thursday!

8.2 IMAGE PROCESSING VERSUS IMAGE ANALYSIS Image processing: The collection of routines and

Image Processing. Adam Finkelstein Princeton University COS 426, Spring 2019

Digital Image Processing. Digital Image Fundamentals II 12 th June, 2017

CS534 Introduction to Computer Vision. Linear Filters. Ahmed Elgammal Dept. of Computer Science Rutgers University

Prof. Feng Liu. Spring /12/2017

>>> from numpy import random as r >>> I = r.rand(256,256);

02/02/10. Image Filtering. Computer Vision CS 543 / ECE 549 University of Illinois. Derek Hoiem

TIRF, geometric operators

More image filtering , , Computational Photography Fall 2017, Lecture 4

CSE 564: Scientific Visualization

Lecture 3: Linear Filters

Sampling and Reconstruction

TDI2131 Digital Image Processing (Week 4) Tutorial 3

Fixing the Gaussian Blur : the Bilateral Filter

Image Enhancement. Image Enhancement

CEE598 - Visual Sensing for Civil Infrastructure Eng. & Mgmt.

Image filtering, image operations. Jana Kosecka

Image Processing for feature extraction

Table of contents. Vision industrielle 2002/2003. Local and semi-local smoothing. Linear noise filtering: example. Convolution: introduction

DIGITAL IMAGE DE-NOISING FILTERS A COMPREHENSIVE STUDY

Image analysis. CS/CME/BIOPHYS/BMI 279 Fall 2015 Ron Dror

Non Linear Image Enhancement

Installation. Binary images. EE 454 Image Processing Project. In this section you will learn

LAB MANUAL SUBJECT: IMAGE PROCESSING BE (COMPUTER) SEM VII

Subband coring for image noise reduction. Edward H. Adelson Internal Report, RCA David Sarnoff Research Center, Nov

Digital Image Processing

Image Enhancement contd. An example of low pass filters is:

Digital Image Processing. Lecture 5 (Enhancement) Bu-Ali Sina University Computer Engineering Dep. Fall 2009

CS 4501: Introduction to Computer Vision. Filtering and Edge Detection

Circular averaging filter (pillbox) Approximates the two-dimensional Laplacian operator. Laplacian of Gaussian filter

Color Space 1: RGB Color Space. Color Space 2: HSV. RGB Cube Easy for devices But not perceptual Where do the grays live? Where is hue and saturation?

CS/ECE 545 (Digital Image Processing) Midterm Review

Numerical Derivatives See also T&V, Appendix A.2 Gradient = vector of partial derivatives of image I(x,y) = [di(x,y)/dx, di(x,y)/dy]

Midterm Examination CS 534: Computational Photography

CSC 320 H1S CSC320 Exam Study Guide (Last updated: April 2, 2015) Winter 2015

Image Enhancement using Histogram Equalization and Spatial Filtering

Announcements. Image Processing. What s an image? Images as functions. Image processing. What s a digital image?

Image restoration and color image processing

June 30 th, 2008 Lesson notes taken from professor Hongmei Zhu class.

Denoising and Effective Contrast Enhancement for Dynamic Range Mapping

Image preprocessing in spatial domain

Computer Vision, Lecture 3

Chapter 3. Study and Analysis of Different Noise Reduction Filters

Image acquisition. Midterm Review. Digitization, line of image. Digitization, whole image. Geometric transformations. Interpolation 10/26/2016

Image Enhancement in the Spatial Domain

Fourier analysis of images

Image Filtering. Reading Today s Lecture. Reading for Next Time. What would be the result? Some Questions from Last Lecture

Image processing for gesture recognition: from theory to practice. Michela Goffredo University Roma TRE

Dappled Photography: Mask Enhanced Cameras for Heterodyned Light Fields and Coded Aperture Refocusing

Matlab (see Homework 1: Intro to Matlab) Linear Filters (Reading: 7.1, ) Correlation. Convolution. Linear Filtering (warm-up slide) R ij

An Efficient Noise Removing Technique Using Mdbut Filter in Images

Image analysis. CS/CME/BioE/Biophys/BMI 279 Oct. 31 and Nov. 2, 2017 Ron Dror

Image Processing by Bilateral Filtering Method

1.Discuss the frequency domain techniques of image enhancement in detail.

Last Lecture. photomatix.com

Frequency Domain Enhancement

CS6670: Computer Vision Noah Snavely. Administrivia. Administrivia. Reading. Last time: Convolution. Last time: Cross correlation 9/8/2009

Noise Reduction Technique in Synthetic Aperture Radar Datasets using Adaptive and Laplacian Filters

CSE 564: Visualization. Image Operations. Motivation. Provide the user (scientist, t doctor, ) with some means to: Global operations:

Lecture #10. EECS490: Digital Image Processing

Image analysis. CS/CME/BioE/Biophys/BMI 279 Oct. 31 and Nov. 2, 2017 Ron Dror

Part I Feature Extraction (1) Image Enhancement. CSc I6716 Spring Local, meaningful, detectable parts of the image.

Analysis of the SUSAN Structure-Preserving Noise-Reduction Algorithm

Achim J. Lilienthal Mobile Robotics and Olfaction Lab, AASS, Örebro University

On the evaluation of edge preserving smoothing filter

Computing for Engineers in Python

Image Enhancement in the Spatial Domain Low and High Pass Filtering

Midterm Review. Image Processing CSE 166 Lecture 10

Performance Evaluation of Edge Detection Techniques for Square Pixel and Hexagon Pixel images

Chapter 2 Image Enhancement in the Spatial Domain

Introduction. Computer Vision. CSc I6716 Fall Part I. Image Enhancement. Zhigang Zhu, City College of New York

Last Lecture. photomatix.com

Lec 05 - Linear Filtering & Edge Detection

Transcription:

Digital Image Processing Part : Image Enhancement in the Spatial Domain AASS Learning Systems Lab, Dep. Teknik Room T9 (Fr, - o'clock) achim.lilienthal@oru.se Course Book Chapter 3-4-

Contents. Image Enhancement in the Spatial Domain. Grey Level Transformations 3. Histogram Processing 4. Operations Involving Multiple Images 5.

Contents

Neighbourhood Relations Between Pixels a pixel has 4 or 8 neighbours in D depending on the neighbour definition: 4-neighborhood each neighbor must share an edge with the pixel 8- neighborhood each neighbor must share an edge or a corner with the pixel

Basics of the pixel value in the output image is calculated from a local neighbourhood in the input image the local neighbourhood is described by a mask with a typical size of 3x3, 5x5, 7x7, pixels filtering is performed by moving the mask over the image the centre pixel in the output image is given a value that depends on the input image and the weights of the mask

Basics of filter subimage defines coefficients w(s,t) used to update pixel at (x,y)

Linear filter subimage defines coefficients w(s,t) response of the filter at point (x,y) is given by a sum of products a g ( x, y) = w( s, t) f ( x + s, y + t) s= at= b also called convolution (convolution kernel) b (-,-) (-,) (-,) (,-) (,) (,) (,-) (,) (,)

Linear Implementation generic code: How to Deal With the Border? for P(x,y) in image for F(u,v) in filter Q(x,y) += F(u,v) P(x-u,y-v) end end limit excursion of the centre of the mask smaller image set outside pixel value zero border effects mirroring border pixel values border effects modify filter size along the border slower

Smoothing Spatial Filters (Averaging Filters) for blurring removal of small (irrelevant) details, bridging small gaps for noise reduction but: edges are also blurred

Smoothing Spatial Filters (Averaging Filters) for blurring removal of small (irrelevant) details, bridging small gaps for noise reduction Smoothing Spatial Filters 3x3 Mean Filter / Box Filter need for normalization to conserve the total energy of the image (sum of all greylevels) can cause "ringing" no good model of blurring in a defocused camera turns a single "point" into a "box" x /9

Smoothing Spatial Filters Mean Filter original Mean 5x5 Mean x

Linear in Matlab f = imread('bubbles.tif'); g = imfilter(f, w, filtering_mode, boundary_options, size_options); filter matrix w filtering modes 'corr' or 'conv' only important in the case of asymmetric filters 'corr' (no mirroring) is the default

Linear in Matlab f = imread('bubbles.tif'); g = imfilter(f, w, filtering_mode, boundary_options, size_options); boundary options P padding with (default) 'replicate' replicate values at the outer border 'symmetric' mirror reflecting across the outer border 'circular' repeating the image like a periodic function

Linear in Matlab f = imread('bubbles.tif'); g = imfilter(f, w, filtering_mode, boundary_options, size_options); size options 'same' same size as the input image (cropped padded image) 'full' full size of the padded image default is 'same'

Linear in Matlab f = imread('bubbles.tif'); g = imfilter(f, ones(8)/64, 'replicate'); imshow(g); 7 px

Linear in Matlab f = imread('bubbles.tif'); g = imfilter(f, fspecial('average',3), 'replicate'); imshow(g);

Smoothing Spatial Filters Mean Filter square box filter generates defects axis aligned streaks blocky results output input example from "A Gentle Introduction to Bilateral Filtering and its Applications", Sylvain Paris, Pierre Kornprobst, Jack Tumblin, and Frédo Durand, SIGGRAPH 8

box profile pixel weight pixel position unrelated pixels related pixels unrelated pixels from "A Gentle Introduction to Bilateral Filtering and its Applications", S. Paris, P. Kornprobst, J. Tumblin, and F. Durand, SIGGRAPH 8

strategy to solve problems with box filters use an isotropic (i.e. circular) window use a window with a smooth falloff box kernel Gaussian kernel from "A Gentle Introduction to Bilateral Filtering and its Applications", S. Paris, P. Kornprobst, J. Tumblin, and F. Durand, SIGGRAPH 8

Smoothing Spatial Filters Gaussian Filter weighted average D Gaussian kernel higher weight in the centre to decrease blurring Why a Gaussian? simple model of blurring in optical systems smooth /6 x also a Gaussian in the frequency domain 4

input from "A Gentle Introduction to Bilateral Filtering and its Applications", S. Paris, P. Kornprobst, J. Tumblin, and F. Durand, SIGGRAPH 8

box average input from "A Gentle Introduction to Bilateral Filtering and its Applications", S. Paris, P. Kornprobst, J. Tumblin, and F. Durand, SIGGRAPH 8

Gaussian box average input blur from "A Gentle Introduction to Bilateral Filtering and its Applications", S. Paris, P. Kornprobst, J. Tumblin, and F. Durand, SIGGRAPH 8

Gaussian profile pixel weight pixel position unrelated pixels uncertain pixels related pixels uncertain pixels unrelated pixels from "A Gentle Introduction to Bilateral Filtering and its Applications", S. Paris, P. Kornprobst, J. Tumblin, and F. Durand, SIGGRAPH 8

Gaussian profile spatial parameter σ input small σ large σ limited smoothing strong smoothing from "A Gentle Introduction to Bilateral Filtering and its Applications", S. Paris, P. Kornprobst, J. Tumblin, and F. Durand, SIGGRAPH 8

Gaussian profile spatial parameter σ how to set σ? depends on the application common strategy: proportional to image size e.g. % of the image diagonal property: independent of image resolution depends on image content smooth "object areas" larger σ but don't smooth edges smaller σ from "A Gentle Introduction to Bilateral Filtering and its Applications", S. Paris, P. Kornprobst, J. Tumblin, and F. Durand, SIGGRAPH 8

Smoothing Spatial Filters Median Filter take the values of the input image corresponding to the desired sub-window (3x3, 5x5, ) sort them take the middle value (example: 3x3 the 5th largest) forces pixels with distinct grey levels to be more like their neighbours very good at reducing salt-and-pepper noise less blurring than linear filters of the same size

Smoothing Spatial Filters Median Filter take the median value over the sub-window X ray image of a circuit board Average 3x3 Median 3x3

Median Filter in Matlab f = imread('bubbles.tif'); g = medfilt(f, [3 3]); imshow(g); original image median 8x8 median 3x3 median 3x

Smoothing Spatial Filters Median Filter take the median value over a sub-window original image median 3x3 median 5x5 median x

Smoothing Spatial Filters Median Filter take the values of the input image corresponding to the desired sub-window (3x3, 5x5, ) sort them take the middle value (example: 3x3 the 5th largest) forces pixels with distinct grey levels to be more like their neighbours very good at reducing salt-and-pepper noise less blurring than linear filters of the same size nonlinear filter (order statistics filter) no equivalent in the frequency domain (order statistics filter)

Order Statistics Filters (Fractile Filters) median min, max useful in mathematical morphology percentile generalization of median, min, max 3 7 5% percentile 4 5 3 4 5 7 8 8 min (%) median (5%) max (%)

Order Statistics Filters (Fractile Filters) median min, max useful in mathematical morphology percentile generalization of median, min, max order statistics filters are nonlinear filters order statistics filters do not have an equivalent in the frequency domain

Sharpening Spatial Filters highlight fine detail (also noise) enhance edges use image differentiation ( st order) f f( x+ ε, y) f( x, y) = lim x ε ε

Sharpening Spatial Filters highlight fine detail (also noise) enhance edges use image differentiation ( st order) f f( x+ ε, y) f( x, y) = lim x ε ε f f x f i+, j i, j

Sharpening Spatial Filters highlight fine detail (also noise) enhance edges use image differentiation Sharpening Spatial Filters D approximation to st Order Derivation equivalent to the D convolution mask f x f ( x + ) f ( x) -

Sharpening Spatial Filters highlight fine detail (also noise) enhance edges use image differentiation Sharpening Spatial Filters D approximation to st Order Derivation equivalent to the D convolution mask f f( x + ) f( x ) x -

5 Gradient and Magnitude of the Gradient Sharpening Spatial Filters Based on the Gradient Roberts Prewitt Sobel y f x f y f x f f + + = = y f x f f,

Sharpening Spatial Filters Prewitt gradient edge detector masks approximate G x and G y in - - - f f f + = G x + G y x y - -

Sharpening Spatial Filters Sobel Operators masks approximate G x and G y in detects horizontal and vertical edges f f f + = G x + G y x y - - - - - -

Sharpening Spatial Filters Sobel Operators weight is supposed to smooth by emphasizing the centre - - - - -

Sharpening Spatial Filters Sobel Operators detection of vertical dark-light edges - - -

Sharpening Spatial Filters Sobel Operators combination of all the directional responses

Sharpening Spatial Filters comparison between Sobel and Prewitt operator Sobel (~ G x + G y ) Prewitt (~ G x + G y )

Sharpening Spatial Filters Roberts (cross gradient operators) masks approximate G x and G y in f f f + = G x + G y x y - -

Sharpening Spatial Filters highlight fine detail (also noise) enhance edges uses image differentiation Sharpening Spatial Filters D approximation to st order derivation approximation to nd order derivation f = f ( x + ) + f ( x ) f ( x) x equivalent to the D convolution mask -

5 Sharpening Spatial Filters Laplace Filter Laplacian (second order derivative) y f x f + = ) ( ) ( ) ( x f x f x f x f + + =

5 Sharpening Spatial Filters Laplace Filter Laplacian (second order derivative) filter masks to implement the Laplacian add the "digital implementation" of the two terms in the Laplacian (9 rotation symmetry) y f x f + = -4 ) ( ) ( ) ( x f x f x f x f + + =

5 Sharpening Spatial Filters Laplace Filter Laplacian (second order derivative) filter masks to implement the Laplacian add the "digital implementation" of the two terms in the Laplacian (9 rotation symmetry) add also diagonal terms (45 rotation symmetry) y f x f + = -4-8 ) ( ) ( ) ( x f x f x f x f + + =

Sharpening Spatial Filters Laplace Filter Laplacian (second order derivative) = f x + f y f x = f ( x + ) + f ( x ) f ( x) filter masks to implement the Laplacian add the "digital implementation" of the two terms in the Laplacian (9 rotation symmetry) add also diagonal terms (45 rotation symmetry) -4 negative values re-scale -8

Sharpening Spatial Filters Laplace Filter detection of edges independent of direction isotropic with respect to 9 rotations - - 4 - -

Sharpening Spatial Filters Laplace Filter Laplace filter + original image sharpening - - 5 - -

Sharpening Spatial Filters Laplace filter + original image sharpening

Sharpening Spatial Filters nd order vs. st order Laplacian (second order derivative) f f f = + = f ( x + ) + f ( x ) f ( x) x y x thinner edges not so strong response to a step better response to fine details double response to edges rotation independent one mask for all edges

Sharpening Spatial Filters Unsharp Masking analog equivalent used in publishing industry basic idea: subtract blurred version of an image from original image to generate the edges

Sharpening Spatial Filters in Matlab f = imread('bubbles.tif'); g = imfilter(f, fspecial('laplacian',.5)); g = imfilter(f, fspecial('unsharp',.5)); %...

AASS Learning Systems Lab, Örebro University

Agenda. Image Smoothing Revisited. Bilateral Filtering 3. Applications of Bilateral Filtering 4. Efficient Implementation Heavily based on: "A Gentle Introduction to Bilateral Filtering and its Applications", Sylvain Paris, Pierre Kornprobst, Jack Tumblin, and Frédo Durand, SIGGRAPH 8, see http://people.csail.mit.edu/sparis/siggraph7_course and "Bilateral Filtering for Gray and Color Images", C. Tomasi, R. Manduchi, Proc. Int. Conf. Computer Vision

Image Smoothing Revisited Agenda

Image Smoothing Revisited General Strategy for Smoothing Images adjacent pixels tend to belong to the same object images typically vary slowly over space non-smoothness due to noise noise values less correlated than the signal smoothing = making adjacent pixels look more similar smoothing strategy: pixel average over its neighbors however, basic assumption not true at edges we are interested in edge preserving image smoothing

Image Smoothing Revisited Mean Filter Profile pixel weight pixel position unrelated pixels related pixels unrelated pixels

Image Smoothing Revisited Gaussian Filter Profile pixel weight pixel position unrelated pixels uncertain pixels related pixels uncertain pixels unrelated pixels

Image Smoothing Revisited Gaussian Filter linear convolution weights independent of spatial location well-known operation can be computed efficiently does smooth images but smoothes too much: edges are blurred only spatial distance matters, no edge term

Bilateral Filtering Agenda

Definition of the Bilateral Filter Blur from Averaging Across Edges input * output * * same Gaussian kernel everywhere

Definition of the Bilateral Filter Bilateral Filter Limits Averaging Across Edges input * output * [Aurich 95, Smith 97, Tomasi 98] * kernel shape depends on image content

Definition of the Bilateral Filter Bilateral Filter The Additional Edge Term again: weighted average of pixels. BF new q S not new [ I] = p Gσ r W s σ p new ( p q ) G ( I I ) p q I q normalization factor space weight range weight I please note the different notation: I f

D Illustration Bilateral Filter D Illustration D image = line of pixels better visualized as a plot pixel intensity pixel position

D Illustration Gaussian blur p q GB I = G [ ] p σ q S ( p q ) space I q space Bilateral filter [Aurich 95, Smith 97, Tomasi 98] q p range BF [ I] p = Gσ W s σ r p q S space normalization ( p q ) G ( I I ) p range q I q space

Bilateral Filtering Is This a Linear Filter? BF [ I] = p Gσ r W s σ p q S ( p q ) G ( I I ) p q I q

Bilateral Filtering No! BF[I ] p + BF[I ] p BF[I +I ] p BF [ I] = p Gσ r W s σ p q S ( p q ) G ( I I ) p q I q

D Illustration BF [ I ]p = Wp Gσ ( p q ) q S s Gσ r ( I p I q ) I q p p q output reproduced from [Durand ] input