Computer Vision I - Basics of Image Processing Part 1

Similar documents
Computer Vision I - Algorithms and Applications: Basics of Image Processing

Computer Vision I - Filtering and Feature detection

Computer Vision I - Basics of Image Processing Part 2

Image Processing. Filtering. Slide 1

EECS 556 Image Processing W 09. Image enhancement. Smoothing and noise removal Sharpening filters

What will we learn? Neighborhood processing. Convolution and correlation. Neighborhood processing. Chapter 10 Neighborhood Processing

EE795: Computer Vision and Intelligent Systems

ECG782: Multidimensional Digital Signal Processing

ECG782: Multidimensional Digital Signal Processing

Lecture 4: Spatial Domain Transformations

Computer Vision 2. SS 18 Dr. Benjamin Guthier Professur für Bildverarbeitung. Computer Vision 2 Dr. Benjamin Guthier

EXAM SOLUTIONS. Image Processing and Computer Vision Course 2D1421 Monday, 13 th of March 2006,

Image processing. Reading. What is an image? Brian Curless CSE 457 Spring 2017

Digital Image Processing. Prof. P. K. Biswas. Department of Electronic & Electrical Communication Engineering

Lecture 2 Image Processing and Filtering

image filtration i Ole-Johan Skrede INF Digital Image Processing

Image Enhancement: To improve the quality of images

CS4733 Class Notes, Computer Vision

CS4442/9542b Artificial Intelligence II prof. Olga Veksler

2D Image Processing INFORMATIK. Kaiserlautern University. DFKI Deutsches Forschungszentrum für Künstliche Intelligenz

CS4442/9542b Artificial Intelligence II prof. Olga Veksler

Classification of image operations. Image enhancement (GW-Ch. 3) Point operations. Neighbourhood operation

ME/CS 132: Introduction to Vision-based Robot Navigation! Low-level Image Processing" Larry Matthies"

Perception. Autonomous Mobile Robots. Sensors Vision Uncertainties, Line extraction from laser scans. Autonomous Systems Lab. Zürich.

Chapter 3: Intensity Transformations and Spatial Filtering

Computer Vision 2. SS 18 Dr. Benjamin Guthier Professur für Bildverarbeitung. Computer Vision 2 Dr. Benjamin Guthier

Babu Madhav Institute of Information Technology Years Integrated M.Sc.(IT)(Semester - 7)

Why is computer vision difficult?

Introduction to Digital Image Processing

Edge Detection (with a sidelight introduction to linear, associative operators). Images

Image Processing. CSCI 420 Computer Graphics Lecture 22

Digital Image Processing ERRATA. Wilhelm Burger Mark J. Burge. An algorithmic introduction using Java. Second Edition. Springer

Image Processing. Alpha Channel. Blending. Image Compositing. Blending Errors. Blending in OpenGL

Image Processing. Traitement d images. Yuliya Tarabalka Tel.

Computer Vision I. Dense Stereo Correspondences. Anita Sellent 1/15/16

Filtering Images. Contents

EE795: Computer Vision and Intelligent Systems

Chapter - 2 : IMAGE ENHANCEMENT

CPSC 425: Computer Vision

Outlines. Medical Image Processing Using Transforms. 4. Transform in image space

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

Motivation. Intensity Levels

Part 3: Image Processing

Image Processing Lecture 10

Vivekananda. Collegee of Engineering & Technology. Question and Answers on 10CS762 /10IS762 UNIT- 5 : IMAGE ENHANCEMENT.

Filtering and Edge Detection. Computer Vision I. CSE252A Lecture 10. Announcement

Filtering and Enhancing Images

Computer Vision and Graphics (ee2031) Digital Image Processing I

Fundamentals of Digital Image Processing

Part 3: Image Processing

EXAM SOLUTIONS. Computer Vision Course 2D1420 Thursday, 11 th of march 2003,

Digital Image Processing. Image Enhancement - Filtering

Announcements. Edge Detection. An Isotropic Gaussian. Filters are templates. Assignment 2 on tracking due this Friday Midterm: Tuesday, May 3.

Image Processing

Prof. Feng Liu. Winter /15/2019

Image Sampling and Quantisation

Basic Algorithms for Digital Image Analysis: a course

Image Sampling & Quantisation

Statistical image models

Lecture: Edge Detection

Filters and Pyramids. CSC320: Introduction to Visual Computing Michael Guerzhoy. Many slides from Steve Marschner, Alexei Efros

INTENSITY TRANSFORMATION AND SPATIAL FILTERING

CSci 4968 and 6270 Computational Vision, Fall Semester, 2011 Lectures 2&3, Image Processing. Corners, boundaries, homogeneous regions, textures?

Digital Image Processing

Filters. Advanced and Special Topics: Filters. Filters

Lecture 4 Image Enhancement in Spatial Domain

Digital Image Processing

CSci 4968 and 6270 Computational Vision, Fall Semester, Lectures 2&3, Image Processing

Image Processing. Daniel Danilov July 13, 2015

Linear Operations Using Masks

Comparative Analysis in Medical Imaging

Lecture 4: Image Processing

Applications of Image Filters

Image restoration. Restoration: Enhancement:

EEM 463 Introduction to Image Processing. Week 3: Intensity Transformations

Image gradients and edges April 11 th, 2017

Image Enhancement in Spatial Domain. By Dr. Rajeev Srivastava

Super-resolution on Text Image Sequences

Image gradients and edges April 10 th, 2018

Digital Image Fundamentals

C E N T E R A T H O U S T O N S C H O O L of H E A L T H I N F O R M A T I O N S C I E N C E S. Image Operations I

Fundamentals of Stereo Vision Michael Bleyer LVA Stereo Vision

CS443: Digital Imaging and Multimedia Binary Image Analysis. Spring 2008 Ahmed Elgammal Dept. of Computer Science Rutgers University

Dense Image-based Motion Estimation Algorithms & Optical Flow

CPSC 425: Computer Vision

Classification and Detection in Images. D.A. Forsyth

Homework #1. Displays, Image Processing, Affine Transformations, Hierarchical Modeling

Computer Vision I. Announcements. Fourier Tansform. Efficient Implementation. Edge and Corner Detection. CSE252A Lecture 13.

ELEC Dr Reji Mathew Electrical Engineering UNSW

Outline 7/2/201011/6/

Hom o om o or o phi p c Processing

Basic Algorithms for Digital Image Analysis: a course

CoE4TN4 Image Processing. Chapter 5 Image Restoration and Reconstruction

Coarse-to-fine image registration

Edge and local feature detection - 2. Importance of edge detection in computer vision

Image Enhancement in Spatial Domain (Chapter 3)

Sharpening through spatial filtering

Lecture Image Enhancement and Spatial Filtering

Introduction to Computer Vision

Multimedia Computing: Algorithms, Systems, and Applications: Edge Detection

Transcription:

Computer Vision I - Basics of Image Processing Part 1 Carsten Rother 28/10/2014 Computer Vision I: Basics of Image Processing

Link to lectures Computer Vision I: Basics of Image Processing 28/10/2014 2 Slides of Lectures and Exercises will be online: http://www.inf.tu-dresden.de/index.php?node_id=2091&ln=de (on our webpage > teaching > Computer Vision 1) No lecture on 28.11.2014

Roadmap: Basics of Digital Image Processing Computer Vision I: Basics of Image Processing 28/10/2014 3 What is an Image? Point operators (ch. 3.1) Filtering: (ch. 3.2, ch 3.3, ch. 3.4) main focus Linear filtering Non-linear filtering Multi-scale image representation (ch. 3.5) Edges detection and linking (ch. 4.2) Line detection and vanishing point detection (ch. 4.3) Interest Point detection (ch. 4.1.1)

What is an Image Computer Vision I: Image Formation Process 28/10/2014 4 We can think of the image as a function: I x, y, I: For every 2D point (pixel) it tells us the amount of light it receives The size and range of the sensor is limited: I x, y, I: a, b c, d [0, m] Colour image is then a vector-valued function: I x, y = I R x, y I G x, y I B x, y, I: a, b c, d 0, m 3 Comment, in most lectures we deal with grey-valued images and extension to colour is obvious

Images as functions Computer Vision I: Basics of Image Processing 28/10/2014 5 [from Steve Seitz]

Digital Images Computer Vision I: Basics of Image Processing 28/10/2014 6 We usually do not work with spatially continuous functions, since our cameras do not sense in this way. Instead we use (spatially) discrete images Sample the 2D domain on a regular grid (1D version) Intensity/color values usually also discrete. Quantize the values per channel (e.g. 8 bit per channel)

Computer Vision I: Basics of Image Processing 28/10/2014 7 Comment on Continuous Domain / Range There is a branch of computer vision research ( variational methods ), which operates on continuous domain for input images and output results Continuous domain methods are typically used for physics-based vision: segmentation, optical flow, etc. (we may consider this briefly in later lectures) Continues domain methods then use different optimization techniques, but still discretize in the end. In this lecture and other lectures we mainly operate in discrete domain and discrete or continuous range for output results

Roadmap: Basics of Digital Image Processing Computer Vision I: Basics of Image Processing 28/10/2014 8 What is an Image? Point operators (ch. 3.1) Filtering: (ch. 3.2, ch 3.3, ch. 3.4) main focus Linear filtering Non-linear filtering Multi-scale image representation (ch. 3.5) Edges detection and linking (ch. 4.2) Line detection and vanishing point detection (ch. 4.3) Interest Point detection (ch. 4.1.1)

Point operators Computer Vision I: Basics of Image Processing 28/10/2014 9 Point operators work on every pixel independently: J x, y = h I x, y Examples for h: Control contrast and brightness; h(z) = az b + c original Contrast enhanced

Example Computer Vision I: Basics of Image Processing 28/10/2014 10

Example for Point operators: Gamma correction Computer Vision I: Basics of Image Processing 28/10/2014 11 Intensity range: [0,1] Inside cameras: h z = z 1/γ where often γ = 2.2 (called gamma correction) makes image brighter In (old) CRT monitors An intensity z is perceived as: h z = z γ (γ = 2.2 typically) perceive image as darker Today: even with linear mapping monitors, it is good to keep the gamma corrected image. Since human vision is more sensitive in dark areas. Important: for many tasks in vision, e.g. estimation of a normal, it is good to run h z = z γ to get to a linear function

Example for Point Operators: Alpha Matting Computer Vision I: Basics of Image Processing 28/10/2014 12 Foreground F Background B Matte α (amount of transparency) Composite C C x, y = α x, y F x, y + 1 α x, y B(x, y)

Roadmap: Basics of Digital Image Processing Computer Vision I: Basics of Image Processing 28/10/2014 13 What is an Image? Point operators (ch. 3.1) Filtering: (ch. 3.2, ch 3.3, ch. 3.4) main focus Linear filtering Non-linear filtering Multi-scale image representation (ch. 3.5) Edges detection and linking (ch. 4.2) Line detection and vanishing point detection (ch. 4.3) Interest Point detection (ch. 4.1.1)

Linear Filters / Operators Computer Vision I: Basics of Image Processing 28/10/2014 14 Properties: Homogeneity: T[aX] = at[x] Additivity: T[X + Y] = T[X] + T[Y] Superposition: T[aX + by] = at[x] + bt[y] Example: Convolution Matrix-Vector operations

Convolution Computer Vision I: Basics of Image Processing 28/10/2014 15 Replace each pixel by a linear combination of its neighbours and itself. 2D convolution (discrete) g = f h Centred at 0,0 f x, y h x, y g x, y g x, y = k,l f x k, y l h k, l the image f is implicitly mirrored

Convolution Computer Vision I: Basics of Image Processing 28/10/2014 16 Linear h f 0 + f 1 = h f 0 + h f 1 Associative f g h = f g h Commutative f h = h f Shift-Invariant g x, y = f x + k, y + l (for a neighborhood k, l) h g x, y = (h f)(x + k, y + l) (it means behaves everywhere the same, i.e. it does not depend on the position in the image. ) Can be written in Matrix form: g = H f Correlation (not mirrored filter): g x, y = k,l f x + k, y + l h k, l

Examples Computer Vision I: Basics of Image Processing 29/10/2014 17 Impulse function: f = f δ Box Filter:

Application: Noise removal Computer Vision I: Basics of Image Processing 28/10/2014 18 Noise is what we are not interested in: sensor noise (Gaussian, shot noise), quantisation artefacts, light fluctuation, etc. Typical assumption is that the noise is not correlated between pixels Basic Idea: neighbouring pixel contain information about intensity

Noise removal Computer Vision I: Basics of Image Processing 28/10/2014 19

The box filter does noise removal Computer Vision I: Basics of Image Processing 28/10/2014 20 Box filter takes the mean in a neighbourhood Image Noise Pixel-independent Gaussian noise added Filtered Image

Derivation of the Box Filter Computer Vision I: Basics of Image Processing 28/10/2014 21 y r is true gray value (color) x r observed gray value (color) Noise model: Gaussian noise: p x r y r ) = N x r ; y r, σ ~ exp[ x r y r 2 2σ 2 ] y r x r

Derivation of Box Filter Computer Vision I: Basics of Image Processing 28/10/2014 22 Further assumption: independent noise p x y) ~ exp[ x r y r 2 2σ 2 ] r Find the most likely solution for the true signal y Maximum-Likelihood principle (probability maximization): y p y p x y = argmax y p y x) = argmax y p(x) posterior p(x) is a constant (drop it out), assume (for now) uniform prior p(y). So we get: p y x) = p x y exp[ x r y r 2 2σ 2 ] the solution is trivial: y r = x r for all r r prior likelihood additional assumptions about the signal y are necessary!!!

Derivation of Box Filter Computer Vision I: Basics of Image Processing 28/10/2014 23 Assumption: not uniform prior p y but in a small vicinity the true signal is nearly constant Maximum-a-posteriori: For one pixel r : take neg. logarithm: p y x) exp[ x r y r 2 y r = argmax yr exp[ x r y r 2 y r = argmin yr r x r y r 2 2σ 2 2σ 2 ] 2σ 2 ] Only one y r in a window W(r)

Derivation of Box Filter Computer Vision I: Basics of Image Processing 28/10/2014 24 How to do the minimization (factor 1/2σ 2 is irrelevant): y r = argmin yr x r y r 2 Take derivative and set to 0: F y r = x r y r 2 2 2! y r (the average) Box filter is optimal under pixel-independent, Gaussian Noise and constant signal in window

Gaussian (Smoothing) Filters Computer Vision I: Basics of Image Processing 28/10/2014 25 Nearby pixels are weighted more than distant pixels Isotropic Gaussian (rotational symmetric)

Gaussian Filter Computer Vision I: Basics of Image Processing 28/10/2014 26 Input: constant grey-value image More noise needs larger sigma

Handling the Boundary (Padding) Computer Vision I: Basics of Image Processing 28/10/2014 27

Gaussian for Sharpening Computer Vision I: Basics of Image Processing 28/10/2014 28 Sharpen an image by amplifying what smoothing removes : g = f + γ (f h blur f)

How to compute convolution efficiently? Computer Vision I: Basics of Image Processing 28/10/2014 29 Separable filters (next) Fourier transformation (wait 2 lectures) Integral Image trick (see exercise) Important for later (integral Image trick): Naive implementation would be O(Nw) where w is the number of elements in box filter The Box filter (mean filter) can be computed in O(N). g x, y = k,l f x k, y l h k, l

Separable filters Computer Vision I: Basics of Image Processing 28/10/2014 30 For some filters we have: f h = f (h x h y ) Where h x, h y are 1D filters. Example Box filter: h x h h y y h x Now we can do two 1D convolutions: f h = f h x h y = (f h x ) h y Naïve implementation for 3x3 filter: 9N operations versus 3N+3N operations

Can any filter be made separable? Computer Vision I: Basics of Image Processing 28/10/2014 31 Note: h x h y h y h x h x h y Apply SVD to the kernel matrix: If all σ i are 0 (apart from σ 0 ) then it is separable.

Example of separable filters Computer Vision I: Basics of Image Processing 28/10/2014 32 1 4 1 2 1

Half-way break Computer Vision I: Basics of Image Processing 28/10/2014 33 3 minutes break

Roadmap: Basics of Digital Image Processing Computer Vision I: Basics of Image Processing 28/10/2014 34 What is an Image? Point operators (ch. 3.1) Filtering: (ch. 3.2, ch 3.3, ch. 3.4) main focus Linear filtering Non-linear filtering Multi-scale image representation (ch. 3.5) Edges detection and linking (ch. 4.2) Line detection and vanishing point detection (ch. 4.3) Interest Point detection (ch. 4.1.1)

Non-linear filters Computer Vision I: Basics of Image Processing 28/10/2014 35 There are many different non-linear filters. We look at the following selection: Median filter Bilateral filter and Guided Filter Morphological operations

Shot noise (Salt and Pepper Noise) - motivation Computer Vision I: Basics of Image Processing 28/10/2014 36 Gaussian filtered Original + shot noise Median filtered

Another example Computer Vision I: Basics of Image Processing 28/10/2014 37 Original Noised Mean Median

Median Filter Computer Vision I: Basics of Image Processing 28/10/2014 38 Replace each pixel with the median in a neighbourhood: 5 6 5 5 6 5 4 20 5 4 5 5 4 6 5 4 6 5 median Median filter: order the values and take the middle one No strong smoothing effect since values are not averaged Very good to remove outliers (shot noise) Used a lot for post processing of outputs (e.g. optical flow)

Median Filter: Derivation Computer Vision I: Basics of Image Processing 28/10/2014 39 Reminder: for Gaussian noise we did solve the following ML problem y r = argmax yr exp[ x r y r 2 2σ 2 ] = argmin yr x r y r = 1/ W x r p y x) 2 median mean Does not look like a Gaussian distribution For Median we solve the following problem: y r = argmax yr exp[ x r y r 2σ 2 ] = argmin yr x r y r = Median (W r ) Due to absolute norm it is more robust

Median Filter Derivation Computer Vision I: Basics of Image Processing 28/10/2014 40 function: minimize the following: F y r = x r y r Problem: not differentiable, good news: it is convex Optimal solution is the median of all values

Motivation Bilateral Filter Computer Vision I: Basics of Image Processing 28/10/2014 41 Original + Gaussian noise Gaussian filtered Bilateral filtered Edge over-smoothed Edge not over-smoothed

Bilateral Filter in pictures Computer Vision I: Basics of Image Processing 28/10/2014 42 Gaussian Filter weights Output (sketched) Centre pixel Noisy input Bilateral Filter weights Output

Bilateral Filter in equations Computer Vision I: Basics of Image Processing 28/10/2014 43 Filters looks at: a) distance to surrounding pixels (as Gaussian) b) Intensity of surrounding pixels Linear combination Same as Gaussian filter Consider intensity Problem: computation is slow O Nw ; approximations can be done in O(N) Comment: Guided filter (see later) is similar and can be computed exactly in O(N) See a tutorial on: http://people.csail.mit.edu/sparis/bf_course/

Application: Bilateral Filter Computer Vision I: Basics of Image Processing 28/10/2014 44 Cartoonization HDR compression (Tone mapping)