Filip Malmberg 1TD396 fall 2018 Today s lecture

Similar documents
Image Filtering. Median Filtering

Digital Image Processing

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

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

Digital Image Processing

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

Image preprocessing in spatial domain

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

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

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

Filtering in the spatial domain (Spatial Filtering)

Practical Image and Video Processing Using MATLAB

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

IMAGE PROCESSING: AREA OPERATIONS (FILTERING)

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

IMAGE ENHANCEMENT IN SPATIAL DOMAIN

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

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

NON UNIFORM BACKGROUND REMOVAL FOR PARTICLE ANALYSIS BASED ON MORPHOLOGICAL STRUCTURING ELEMENT:

Image Processing for feature extraction

Prof. Vidya Manian Dept. of Electrical and Comptuer Engineering

Computer Vision, Lecture 3

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

Image filtering, image operations. Jana Kosecka

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

Computer Vision for HCI. Noise Removal. Noise in Images

EE482: Digital Signal Processing Applications

Vision Review: Image Processing. Course web page:

Images and Filters. EE/CSE 576 Linda Shapiro

CSE 564: Scientific Visualization

Chapter 6. [6]Preprocessing

Image Filtering Josef Pelikán & Alexander Wilkie CGG MFF UK Praha

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

Computer Vision. Non linear filters. 25 August Copyright by NHL Hogeschool and Van de Loosdrecht Machine Vision BV All rights reserved

Prof. Feng Liu. Winter /10/2019

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

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

Computing for Engineers in Python

Digital Image Processing 3/e

TIRF, geometric operators

Chapter 17. Shape-Based Operations

Image Enhancement using Histogram Equalization and Spatial Filtering

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

MATLAB 6.5 Image Processing Toolbox Tutorial

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

Non Linear Image Enhancement

Midterm Review. Image Processing CSE 166 Lecture 10

Digital Image Processing

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

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

Image Enhancement II: Neighborhood Operations

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

Image Enhancement in the Spatial Domain

Sampling and Reconstruction

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

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

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad

Image Processing and Computer Graphics

Binary Opening and Closing

CS/ECE 545 (Digital Image Processing) Midterm Review

Frequency Domain Enhancement

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

ELEC Dr Reji Mathew Electrical Engineering UNSW

DIGITAL IMAGE DE-NOISING FILTERS A COMPREHENSIVE STUDY

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

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

Motion illusion, rotating snakes

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

Efficient 2-D Structuring Element for Noise Removal of Grayscale Images using Morphological Operations

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

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

Convolution Pyramids. Zeev Farbman, Raanan Fattal and Dani Lischinski SIGGRAPH Asia Conference (2011) Julian Steil. Prof. Dr.

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

Image Filtering and Gaussian Pyramids

A Study On Preprocessing A Mammogram Image Using Adaptive Median Filter

Chapter 3. Study and Analysis of Different Noise Reduction Filters

Chrominance Assisted Sharpening of Images

Introduction to digital image processing

Midterm Examination CS 534: Computational Photography

ELEC Dr Reji Mathew Electrical Engineering UNSW

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

Sampling and Reconstruction

Chapter 2 Image Enhancement in the Spatial Domain

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

What is image enhancement? Point operation

PRACTICAL IMAGE AND VIDEO PROCESSING USING MATLAB

CAP 5415 Computer Vision. Marshall Tappen Fall Lecture 1

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?

Image Denoising with Linear and Non-Linear Filters: A REVIEW

IMAGE PROCESSING (RRY025) THE CONTINUOUS 2D FOURIER TRANSFORM

Digital Image Processing

Correction of Clipped Pixels in Color Images

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

Multimedia Systems Giorgio Leonardi A.A Lectures 14-16: Raster images processing and filters

Carmen Alonso Montes 23rd-27th November 2015

Anna University, Chennai B.E./B.TECH DEGREE EXAMINATION, MAY/JUNE 2013 Seventh Semester

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

Image Enhancement in the Spatial Domain Low and High Pass Filtering

CSCI 1290: Comp Photo

Tan-Hsu Tan Dept. of Electrical Engineering National Taipei University of Technology Taipei, Taiwan (ROC)

Transcription:

Today s lecture Local neighbourhood processing Convolution smoothing an image sharpening an image And more What is it? What is it useful for? How can I compute it? Removing uncorrelated noise from an image Mathematical morphology, filtering/modifying binary shapes in an image

Neighbourhoods

Local neighbourhood operation For each pixel, examine its neighbourhood and compute an output value (mean) 5 4 6 5 3 19 6 9 6 1 7 5 4 1 5 3 46 5 47 4 37 4 4 6 8 7 4 5 6 3 4 46 3 1 5 7 8 5 4 6 7 6 1 3 6 5 3 5 3 5 8

Local neighbourhood operation Possible operations to do for each neighbourhood: Neighbourhood size and shape is very important average (mean, median, etc) weighted average other statistics (variance, maximum, etc) difference (to compute derivative) round neighbourhood gives rotation invariance Adaptive filtering: changing size, shape and/or operation depending on local image properties

Smoothing an image Input image mean filter median filter

Smoothing an image Input image mean filter weighted mean filter

How to define Gaussian weights σ determines the amount of smoothing the neighbourhood size should be large enough to contain the whole Gaussian bell! rule of thumb: ceil(3σ) + 1 sum of all weights normalised to 1 1 x + y exp πσ σ ( ) ceil(3σ) + 1

Weighted mean filter For each pixel, multiply the values in its neighbourhood with the corresponding weights, then sum 1/9 1/9 1/9 1/9 1/9 1/9 5 4 6 5 3 19 6 9 6 1 7 5 4 1 5 3 46 5 47 4 37 4 4 6 8 7 4 5 6 3 4 46 3 1 5 7 8 5 4 6 7 6 1 3 6 5 3 5 3 5 8 1/9 1/9 1/9

Applications? Write down as many applications of a smoothing filter as you can come up with

Application: noise reduction input image Normally distributed noise Salt & pepper noise 3x3 mean filter 3x3 median filter

Application: abstraction Sometimes you just don t want all those details

Application: shading correction Gaussian smoothing, σ = 1 pixels

Sharpening an image Unsharp masking original smoothed (3x3) sharpened (α = 9) sharpened = (1+α) original α smoothed

Sharpening an image sharpened = (1+α) original α smoothed sharpened = original + α ( original smoothed ) 1 original 1/9 1/9 1/9 smoothed -1-1 -1 1/9 1/9 1/9-1 8-1 1/9 1/9 1/9-1 -1-1 9 diff

Laplace filter Laplace operator: Δ= = + x y 1 1 1 1 1-4 1 1-8 1 1 1 1 1 sharpened = original + 9 ( original smoothed ) sharpened = original - Laplace

Approximating derivatives A discrete function, 1D

Approximating derivatives 1st derivative by local differences

Approximating derivatives nd derivative by local differences

Laplace filter Laplace operator: Δ= = + x y

Sobel filter Approximates the first derivatives: 1-1 1 Sx, x y 1 1 - -1-1 - -1 Sy

Detecting edges Approximates the gradient magnitude: ( + x y sqrt ( Sx^ + Sy^ ) ) ( )

Adaptive filtering Many non-linear filters are meant to reduce noise without blurring the edges One common technique is to adapt the kernel so that it does not extend across any edges The bilateral filter is the most common one input image median filter bilateral filter

Bilateral filter A new kernel is designed for each output pixel Kernel weights are reduced if the corresponding pixel in the input image has a large difference in intensity with the central pixel h x ( x ) = Gσ ( x x ) Gσ (f ( x ) f ( x )) x f

What happens at the image edge?

What happens at the image edge? Write down as many different ways of extending the edge as you can think of

What happens at the image edge? Mean padding f[end+x] = mean(f) Zero order hold f[end+x] = f[end]

What happens at the image edge? Periodic boundary condition f[end+x] = f[x] Symmetric boundary condition f[end+x] = f[end-x]

Beyond smoothing and sharpening An image of a piece of text

Beyond smoothing and sharpening Filter kernel, image of letter a What happens when we apply this kernel as a linear filter? When is the output of this filter maximum/minimum?

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Beyond smoothing and sharpening After linear filtering

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Beyond smoothing and sharpening Finding all pixels brighter than a manually selected threshold value

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Beyond smoothing and sharpening Detected instances of letter a

Linear neighbourhood operation For each pixel, multiply the values in its neighbourhood with the corresponding weights, then sum 1/9 1/9 1/9 1/9 1/9 1/9 5 4 6 5 3 19 6 9 6 1 7 5 4 1 5 3 46 5 47 4 37 4 4 6 8 7 4 5 6 3 4 46 3 1 5 7 8 5 4 6 7 6 1 3 6 5 3 5 3 5 8 1/9 1/9 1/9

Linear neighbourhood operation For each pixel, multiply the values in its neighbourhood with the corresponding weights, then sum (-1,-1) (,-1) (1,-1) f(x,y) h(i,j) g(x,y) (-1,) (,) (1,) (-1,1) (,1) (1,1) (x,y) (x,y)

Correlation and convolution Two fundamental linear filtering operations Correlation: move a filter mask over the image, and compute the sum of products at each location (exactly what we have done so far) Convolution: Same as correlation, but first rotate filter by 18 degrees (or mirror it in both x and y directions)

Correlation and convolution Consider a 1D signal and small filter: Signal: 1 Filter: 31 What happens when we apply the filter as a correlation? This signal is a discrete impulse

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Correlation and convolution Consider a 1D signal and small filter: Signal: 1 Filter: 31 What happens when we apply the filter as a correlation? Result: 13 We get a mirrored copy of the filter at the location of the impulse! (Verify this)

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Correlation and convolution Consider a 1D signal and small filter: Signal: 1 Filter: 31 Mirrored filter: 13 What happens when we instead apply the filter as a convolution? Result: 31 We get a copy of the filter at the location of the impulse! (Verify this)

Convolution h is: impulse response function point-spread function convolution kernel g (t ) = f (t ) h(t ) g (t ) = f (t τ) h( τ) d τ b g [n] = f [n k ] h[k ] k =a [a,b] is the interval where h is defined, eg [-1,1]

Convolution properties Linear: Scaling invariant: C f h = C f h Distributive: f g h = f h g h Time Invariant: shift f h = shift f h Commutative: f h = h f Associative: f h1 h = f h1 h (= shift invariant)

Associativity of convolution f (h1 h ) = (f h1 ) h if h = h1 h then f h = (f h1 ) h thus: you can decompose h to speed up the operation! Eg the Gaussian can be decomposed into two one-dimensional filters: 1 G( x, y ) = e π σ x + y σ 1 = e π σ x σ 1 e π σ y σ

Kernel decomposition G = G x G y original convolved with Gx Gx and Gy are both a kernel with 31x1 values G is a kernel with 31x31 values convolved with Gy 31+31 = 6 ops 31x31 = 961 ops

Sequence of filters f (h1 h h3 ) = (((f h1 ) h ) h3 ) 3*3 ops 4(3*3) ops = 36 ops 9*9 ops = 81 ops

Sequence of filters 3*3 ops 4(3*3) ops = 36 ops 9*9 ops = 81 ops

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Max/min filters Keep/enhance bright or dark details Rank filter or order-statistic filter Max filter sets the output pixelvalue to the maximum pixel intensity under the filtermask => makes image brighter Min filter sets the output pixelvalue to the minimum intensity value under the filtermask =>makes image darker

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Max/min filters 7 x7 max original 7 x7 min

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Background correction: TopHat filter Based combination of max/min filtering 1)Need to know the approximate size of your objects of interest 1) Estimate bg by a minfiltering followed by a maxfiltering The filtersize should be larger than your objects of interest ) Subtract the bg image from the original

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Background correction: TopHat filter Circular filter with r= pixels

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Mathematical morphology Manipulation, or filtering, of objects in images, represented as binary masks (=background, 1=object) Structuring Element (SE): small set or structuring element SE to probe the image under study For each SE, define origo Shape and size must be adapted to geometric properties for the objects

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Mathematical morhphology Four basic operations: Erosion Dilation Opening Closing

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Erosion (shrinking) Does the structuring element fit inside the object? Keep only the object pixels corresponding to the origo of the SE when the SE fits entirely inside the object (min filter with binary inputs, with mirrored SE)

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Example, erosion SE =

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Dilation (growing) Grow the object with the SE Expand your object with all pixels in the SE, when the origo of the SE hits the object (max filter with binary inputs, with mirrored SE)

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Example: Dilation SE=

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Effects of erosion and dilation erosion removal of structures of certain shape and size, given by SE (structure element) Example 3x3 SE dilation filling of holes of certain shape and size, given by SE Example 3x3 SE

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Combining erosion and dilation WANTED: remove structures / fill holes without affecting remaining parts (overall size of objects) SOLUTION: combine erosion and dilation (using same SE) Opening Closing

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Opening erosion followed by dilation, denoted A B A B B A B O eliminates protrusions breaks necks smooths contour

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Rolling ball analogy opening: roll ball(=se) inside object see SE as a rolling ball boundary of A B = points in B that reaches closest to A boundary when B is rolled inside A fig 98

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Closing dilation followed by erosion, denoted A B A B B A B O smooth contour fuse narrow breaks and long thin gulfs eliminate small holes fill gaps in the contour

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Rolling ball analogy Closing: roll ball(=se) outside object boundary of A B = points in B that reaches closest to A boundary when B is rolled outside A Fill in true border after closing with ball as SE

Filip Malmberg 1TD396 fall 17 filipmalmberg@ituuse Summary of today s lecture Virtually all filtering is a local neighbourhood operation Convolution = linear and shift-invariant filters Many non-linear filters exist also eg mean filter, Gaussian weighted filter kernel can sometimes be decomposed eg median filter, bilateral filter, max/min filters, tophat filter Mathematical morphology, filtering of shapes Useful for post-processing of segmentation masks