Image preprocessing in spatial domain

Similar documents
Review Smoothing Spatial Filters Sharpening Spatial Filters. Spatial Filtering. Dr. Praveen Sankaran. Department of ECE NIT Calicut.

Least squares Solution of Homogeneous Equations

Image preprocessing in spatial domain

Image preprocessing in spatial domain

Digital Image Processing: Sharpening Filtering in Spatial Domain CSC Biomedical Imaging and Analysis Dr. Kazunori Okada

Reading. 3. Image processing. Pixel movement. Image processing Y R I G Q

ECE Digital Image Processing and Introduction to Computer Vision. Outline

Today s lecture. Local neighbourhood processing. The convolution. Removing uncorrelated noise from an image The Fourier transform

Image Filtering, Edges and Image Representation

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

Fourier Transforms 1D

Local enhancement. Local Enhancement. Local histogram equalized. Histogram equalized. Local Contrast Enhancement. Fig 3.23: Another example

Machine vision. Summary # 4. The mask for Laplacian is given

Digital Image Processing COSC 6380/4393

Introduction to Computer Vision. 2D Linear Systems

Machine vision, spring 2018 Summary 4

Image Filtering. Slides, adapted from. Steve Seitz and Rick Szeliski, U.Washington

Gaussian derivatives

Digital Image Processing COSC 6380/4393

Image Gradients and Gradient Filtering Computer Vision

Colorado School of Mines Image and Multidimensional Signal Processing

Local Enhancement. Local enhancement

Edge Detection. CS 650: Computer Vision

Lecture 04 Image Filtering

The Frequency Domain, without tears. Many slides borrowed from Steve Seitz

CAP 5415 Computer Vision Fall 2011

Edge Detection. Introduction to Computer Vision. Useful Mathematics Funcs. The bad news

CAP 5415 Computer Vision

Lecture 7: Edge Detection

The Frequency Domain : Computational Photography Alexei Efros, CMU, Fall Many slides borrowed from Steve Seitz

Lecture Outline. Basics of Spatial Filtering Smoothing Spatial Filters. Sharpening Spatial Filters

Spatial Enhancement Region operations: k'(x,y) = F( k(x-m, y-n), k(x,y), k(x+m,y+n) ]

Templates, Image Pyramids, and Filter Banks

Medical Image Analysis

PDEs in Image Processing, Tutorials

Image Enhancement (Spatial Filtering 2)

Filtering and Edge Detection

Medical Image Analysis

The Frequency Domain. Many slides borrowed from Steve Seitz

Culminating Review for Vectors

Introduction to Computer Vision

Fraunhofer Institute for Computer Graphics Research Interactive Graphics Systems Group, TU Darmstadt Fraunhoferstrasse 5, Darmstadt, Germany

Linear Operators and Fourier Transform

SIFT: SCALE INVARIANT FEATURE TRANSFORM BY DAVID LOWE

Convolutional networks. Sebastian Seung

ITK Filters. Thresholding Edge Detection Gradients Second Order Derivatives Neighborhood Filters Smoothing Filters Distance Map Image Transforms

Computational Photography

TRACKING and DETECTION in COMPUTER VISION Filtering and edge detection

( ) = 0. ( ) does not exist. 4.1 Maximum and Minimum Values Assigned videos: , , , DEFINITION Critical number

NONLINEAR DIFFUSION PDES

Subsampling and image pyramids

Machine Learning: Basis and Wavelet 김화평 (CSE ) Medical Image computing lab 서진근교수연구실 Haar DWT in 2 levels

2015 Math Camp Calculus Exam Solution

Recurrent Neural Networks

Lecture 8: Interest Point Detection. Saad J Bedros

CS 179: LECTURE 16 MODEL COMPLEXITY, REGULARIZATION, AND CONVOLUTIONAL NETS

Major Ideas in Calc 3 / Exam Review Topics

Successful completion of the core function transformations unit. Algebra manipulation skills with squares and square roots.

Image Processing. Waleed A. Yousef Faculty of Computers and Information, Helwan University. April 3, 2010

Image Enhancement: Methods. Digital Image Processing. No Explicit definition. Spatial Domain: Frequency Domain:

EE 367 / CS 448I Computational Imaging and Display Notes: Image Deconvolution (lecture 6)

4. References. words, the pseudo Laplacian is given by max {! 2 x,! 2 y}.

IMAGE ENHANCEMENT II (CONVOLUTION)

Intensity Transformations and Spatial Filtering: WHICH ONE LOOKS BETTER? Intensity Transformations and Spatial Filtering: WHICH ONE LOOKS BETTER?

PowerPoints organized by Dr. Michael R. Gustafson II, Duke University

Image Enhancement in the frequency domain. GZ Chapter 4

( ) c. m = 0, 1 2, 3 4

Vlad Estivill-Castro (2016) Robots for People --- A project for intelligent integrated systems

Lecture 4 Filtering in the Frequency Domain. Lin ZHANG, PhD School of Software Engineering Tongji University Spring 2016

Gradient-domain image processing

MA 123 September 8, 2016

Chapter 16. Local Operations

The integral test and estimates of sums

Electromagnetic Theory Prof. D. K. Ghosh Department of Physics Indian Institute of Technology, Bombay

Deep Learning (CNNs)

Lifting Detail from Darkness

Introduction to Vector Functions

CSCI 250: Intro to Robotics. Spring Term 2017 Prof. Levy. Computer Vision: A Brief Survey

Conditional Language modeling with attention

Digital Image Processing. Chapter 4: Image Enhancement in the Frequency Domain

Statistical Machine Learning

Chapter 4 Image Enhancement in the Frequency Domain

Faculty of Engineering, Mathematics and Science School of Mathematics

Linear Diffusion. E9 242 STIP- R. Venkatesh Babu IISc

Chapter 2. Motion in One Dimension. AIT AP Physics C

3.8 Combining Spatial Enhancement Methods 137

Math 112 Rahman. Week Taylor Series Suppose the function f has the following power series:

Spectral Processing. Misha Kazhdan

Linear Diffusion and Image Processing. Outline

Outline. Convolution. Filtering

Laplacian Filters. Sobel Filters. Laplacian Filters. Laplacian Filters. Laplacian Filters. Laplacian Filters

Digital Image Processing. Filtering in the Frequency Domain

Edge Detection. Image Processing - Computer Vision

Enhancement Using Local Histogram

Empirical Mean and Variance!

REVERSE CHAIN RULE CALCULUS 7. Dr Adrian Jannetta MIMA CMath FRAS INU0115/515 (MATHS 2) Reverse Chain Rule 1/12 Adrian Jannetta

MAT01B1: Maximum and Minimum Values

AP Physics C Mechanics Calculus Basics

7 + 8x + 9x x + 12x x 6. x 3. (c) lim. x 2 + x 3 x + x 4 (e) lim. (d) lim. x 5

MATHEMATICAL MODEL OF IMAGE DEGRADATION. = s

Transcription:

Image preprocessing in spatial domain Sharpening, image derivatives, Laplacian, edges Revision: 1.2, dated: May 25, 2007 Tomáš Svoboda Czech Technical University, Faculty of Electrical Engineering Center for Machine Perception, Prague, Czech Republic svoboda@cmp.felk.cvut.cz http://cmp.felk.cvut.cz/~svoboda

We have learned Spatial Filtering overview 2/35 smoothing remove noise pattern matching (normalised cross correlation)

We have learned Spatial Filtering overview 2/35 smoothing remove noise pattern matching (normalised cross correlation) We will learn today sharpening image derivatives edges

Sharpening Enhancing differences. So, the kernels involve differences combine positive and negative weights. 3/35 unsharp masking 1st and 2nd derivatives

Unsharp masking Often appears in Image manipulation packages (Gimp, ImageMagick) Quite powerful it cannot do miracles, though. Idea: Subtract out the blur. Procedure: 1. Blur the image 2. Subtract from original 3. Multiply by a weight 4. Combine (add to) with the original 4/35

Unsharp masking Mathematically 5/35 g = f + α(f f b ) f original image f b blurred image g sharpened result α controls the sharpening What is the unsharp mask?.

Unsharp masking Mathematically 5/35 g = f + α(f f b ) f original image f b blurred image g sharpened result α controls the sharpening What is the unsharp mask? g = 1 f + α(1 f B f).

Unsharp masking Mathematically 5/35 g = f + α(f f b ) f original image f b blurred image g sharpened result α controls the sharpening What is the unsharp mask? g = 1 f + α(1 f B f) = (1 + α(1 B)) f.

Unsharp masking Mathematically 5/35 g = f + α(f f b ) f original image f b blurred image g sharpened result α controls the sharpening What is the unsharp mask? g = 1 f + α(1 f B f) = (1 + α(1 B)) f = U f where U is the desired unsharp mask.

Unsharp masking Blur image 6/35

Unsharp masking Subtract from original 7/35 =

Unsharp masking Adding to the original 8/35 + =

Unsharp masking Result 9/35

Unsharp masking unsharp mask U 10/35 U = 1 + α(1 B) mask one mask one blurring mask 0.015 0.015 0.015 0.01 0.01 0.01 0.005 0.005 0.005 0 0 0 0.005 0.005 0.005 0.01 0.01 0.01 0.015 10 5 0 0 2 4 6 8 10 0.015 10 5 + 0 0 2 4 6 8 10 0.015 10 5 0 0 2 4 6 8 10

Unsharp masking unsharp mask U 11/35 U = 1 + α(1 B) unsharp mask 0.015 0.0044 0.0053 0.0061 0.0067 0.0071 0.0073 0.0071 0.0067 0.0061 0.0053 0.0044 0.01 0.0053 0.0063 0.0073 0.0080 0.0085 0.0087 0.0085 0.0080 0.0073 0.0063 0.0053 0.005 0.0061 0.0073 0.0083 0.0092 0.0098 0.0100 0.0098 0.0092 0.0083 0.0073 0.0061 0 0.0067 0.0080 0.0092 0.0102 0.0108 0.0110 0.0108 0.0102 0.0092 0.0080 0.0067 0.005 0.01 0.015 10 5 0 0 2 4 6 8 10 0.0071 0.0085 0.0098 0.0108 0.0115 0.0117 0.0115 0.0108 0.0098 0.0085 0.0071 0.0073 0.0087 0.0100 0.0110 0.0117 1.9880 0.0117 0.0110 0.0100 0.0087 0.0073 0.0071 0.0085 0.0098 0.0108 0.0115 0.0117 0.0115 0.0108 0.0098 0.0085 0.0071 0.0067 0.0080 0.0092 0.0102 0.0108 0.0110 0.0108 0.0102 0.0092 0.0080 0.0067 0.0061 0.0073 0.0083 0.0092 0.0098 0.0100 0.0098 0.0092 0.0083 0.0073 0.0061 0.0053 0.0063 0.0073 0.0080 0.0085 0.0087 0.0085 0.0080 0.0073 0.0063 0.0053 0.0044 0.0053 0.0061 0.0067 0.0071 0.0073 0.0071 0.0067 0.0061 0.0053 0.0044 We may combine only masks not the whole images!

Unsharp masking Subtract from original 12/35 =

Unsharp masking Adding to the original 13/35 + =

Unsharp masking Result 14/35

Unsharp masking Problems with noise 15/35

Unsharp masking Problems lossy JPG compression 16/35

Unsharp masking revisited Often appears in Image manipulation packages (Gimp, ImageMagick). It may help in practice. Low-cost lenses blur the image. Quite powerful it cannot do miracles, though. It also emphasises noise and JPG artifacts. 17/35

Image derivatives Measure local image geometry 18/35 Differential geometry a branch of mathematics built around We can use convolution to compute them

Image derivatives Measure local image geometry 18/35 Differential geometry a branch of mathematics built around We can use convolution to compute them First derivative local changes to the signal. (from physics: speed is derivative of a position with respect to time) Second derivative changes to change (from physics: acceleration is... )

Derivative reminder from calculus Consider a 1D signal f(x) 19/35 d f(x) = lim dx h 0 f(x + h) f(x) h

Derivative reminder from calculus Consider a 1D signal f(x) 19/35 d f(x) = lim dx h 0 f(x + h) f(x) h However, for sampled (discrete) signals, the smallest difference h is one. So, This called forward difference d f(x + 1) f(x) f(x) dx 1

Backward difference 20/35 Remind that the limit lim h 0 d f(x) = lim dx h 0 must exist for both lim h 0+ and lim h 0 f(x + h) f(x) h

Backward difference 20/35 Remind that the limit lim h 0 d f(x) = lim dx h 0 must exist for both lim h 0+ and lim h 0 So going from negative side of h d f(x) = lim dx h 0 f(x + h) f(x) h f(x) f(x h) h Sampled variant d f(x) f(x 1) f(x) dx 1

Kernels for derivatives Image is 2D function f(x, y). Derivatives may also be along y direction 21/35

Forward difference x direction 22/35

Backward difference x direction 23/35

Central difference x direction 24/35

Central difference x and y direction 25/35

Forward Backward Second derivatives d f(x) f(x + 1) f(x) dx d f(x) f(x) f(x 1) dx 26/35

Forward Backward Difference of differences Second derivatives d f(x) f(x + 1) f(x) dx d f(x) f(x) f(x 1) dx 26/35 d 2 dx2f(x) (f(x + 1) f(x)) (f(x) f(x 1)) = f(x + 1) 2f(x) + f(x 1)

Forward Backward Difference of differences Second derivatives d f(x) f(x + 1) f(x) dx d f(x) f(x) f(x 1) dx 26/35 d 2 dx2f(x) (f(x + 1) f(x)) (f(x) f(x 1)) = f(x + 1) 2f(x) + f(x 1) +1-1 +1-1 = +1-2 +1

Second derivatives derivative of derivative 27/35

2D derivatives Differentiate in one dimension, ignore the other 28/35 x 0 0 0-1 0 +1 0 0 0 y 0-1 0 0 0 0 0 +1 0 2 2 x 2 y 2 0 0 0 +1-2 +1 0 0 0 0 +1 0 0-2 0 0 +1 0

2D derivatives with smoothing Differentiate in one dimension and smooth in the other -1 0 +1 1 1 1 = -1 0 +1-1 0 +1-1 0 +1 29/35

2D derivatives with smoothing Differentiate in one dimension and smooth in the other -1 0 +1 1 1 1 = -1 0 +1-1 0 +1-1 0 +1 29/35

The Gradient 30/35 f(x, y) = f x f y Magnitude is steepness in f(x, y) = ( f ) 2 + x ( ) 2 f, y direction ψ = atan ( f x, f ) y, A way to do the edge detection. Edge direction is perpendicular to ψ.

The Laplacian 31/35 2 f(x, y) = 2 f x 2 + 2 f y 2 Sum of second derivatives in x and y directions. Sort of an overall curvature.

The Laplacian 31/35 2 f(x, y) = 2 f x 2 + 2 f y 2 Sum of second derivatives in x and y directions. Sort of an overall curvature. With kernels: 0 0 0 +1-2 +1 0 0 0 + 0 +1 0 0-2 0 0 +1 0 = 0 +1 0 1-4 1 0 +1 0

What is an edge? 32/35 x direction y direction 0.3 0.25 edge profile/5 first derivative second derivative 0.3 0.25 edge profile/5 first derivative second derivative 0.2 0.2 0.15 0.15 0.1 0.1 0.05 0.05 0 0 0.05 0.05 0.1 0.1 0.15 0.15 0.2 75 80 85 90 95 100 105 110 0.2 105 110 115 120 125 130 135 140 145 150 155

Partial derivatives 33/35 Extrema of partial derivatives are good candidates for edges.

Laplacian 34/35 Places where the Laplacian changes from positive to negative are also good potential edges.

Laplacian for sharpenning 35/35 original signal f 200 100 0 50 20 40 60 80 100 120 140 160 180 200 first derivative f / x 0 50 0 20 40 60 80 100 120 140 160 180 200 100 Second derivative Laplacian (scaled) C 2 f/ x 2 0 100 0 20 40 60 80 100 120 140 160 180 200 improved signal f C 2 f/ x 2 200 100 0 sharpened signal...... truncated to <0,255> 20 40 60 80 100 120 140 160 180 200

mask one 0.015 0.01 0.005 0 0.005 0.01 0.015 10 5 0 0 2 4 6 8 10

mask one 0.015 0.01 0.005 0 0.005 0.01 0.015 10 5 0 0 2 4 6 8 10

blurring mask 0.015 0.01 0.005 0 0.005 0.01 0.015 10 5 0 0 2 4 6 8 10

unsharp mask 0.015 0.01 0.005 0 0.005 0.01 0.015 10 5 0 0 2 4 6 8 10

0.0044 0.0053 0.0061 0.0067 0.0071 0.0073 0.0071 0.0067 0.0061 0.0053 0.0044 0.0053 0.0063 0.0073 0.0080 0.0085 0.0087 0.0085 0.0080 0.0073 0.0063 0.0053 0.0061 0.0073 0.0083 0.0092 0.0098 0.0100 0.0098 0.0092 0.0083 0.0073 0.0061 0.0067 0.0080 0.0092 0.0102 0.0108 0.0110 0.0108 0.0102 0.0092 0.0080 0.0067 0.0071 0.0085 0.0098 0.0108 0.0115 0.0117 0.0115 0.0108 0.0098 0.0085 0.0071 0.0073 0.0087 0.0100 0.0110 0.0117 1.9880 0.0117 0.0110 0.0100 0.0087 0.0073 0.0071 0.0085 0.0098 0.0108 0.0115 0.0117 0.0115 0.0108 0.0098 0.0085 0.0071 0.0067 0.0080 0.0092 0.0102 0.0108 0.0110 0.0108 0.0102 0.0092 0.0080 0.0067 0.0061 0.0073 0.0083 0.0092 0.0098 0.0100 0.0098 0.0092 0.0083 0.0073 0.0061 0.0053 0.0063 0.0073 0.0080 0.0085 0.0087 0.0085 0.0080 0.0073 0.0063 0.0053 0.0044 0.0053 0.0061 0.0067 0.0071 0.0073 0.0071 0.0067 0.0061 0.0053 0.0044

0.2 75 80 85 90 95 100 105 110 x direction 0.3 0.25 edge profile/5 first derivative second derivative 0.2 0.15 0.1 0.05 0 0.05 0.1 0.15

0.2 105 110 115 120 125 130 135 140 145 150 155 y direction 0.3 0.25 edge profile/5 first derivative second derivative 0.2 0.15 0.1 0.05 0 0.05 0.1 0.15

original signal f 200 100 0 50 20 40 60 80 100 120 140 160 180 200 first derivative f / x 0 50 0 20 40 60 80 100 120 140 160 180 200 100 Second derivative Laplacian (scaled) C 2 f/ x 2 0 100 0 20 40 60 80 100 120 140 160 180 200 improved signal f C 2 f/ x 2 200 100 0 sharpened signal...... truncated to <0,255> 20 40 60 80 100 120 140 160 180 200