Laboratorio di Problemi Inversi Esercitazione 2: filtraggio spettrale

Similar documents
Numerical Linear Algebra and. Image Restoration

Regularization methods for large-scale, ill-posed, linear, discrete, inverse problems

Mathematical Beer Goggles or The Mathematics of Image Processing

Preconditioning. Noisy, Ill-Conditioned Linear Systems

Preconditioning. Noisy, Ill-Conditioned Linear Systems

Inverse Ill Posed Problems in Image Processing

Advanced Numerical Linear Algebra: Inverse Problems

Regularization Parameter Estimation for Least Squares: A Newton method using the χ 2 -distribution

arxiv: v1 [math.na] 15 Jun 2009

SIGNAL AND IMAGE RESTORATION: SOLVING

Near-Optimal Spectral Filtering and Error Estimation for Solving Ill-Posed Problems

Towards Improved Sensitivity in Feature Extraction from Signals: one and two dimensional

Newton s Method for Estimating the Regularization Parameter for Least Squares: Using the Chi-curve

ITERATIVE REGULARIZATION WITH MINIMUM-RESIDUAL METHODS

Golub-Kahan iterative bidiagonalization and determining the noise level in the data

Statistically-Based Regularization Parameter Estimation for Large Scale Problems

Ill Posed Inverse Problems in Image Processing

What is Image Deblurring?

Choosing the Regularization Parameter

arxiv: v1 [math.na] 3 Jan 2019

A fast algorithm of two-level banded Toeplitz systems of linear equations with application to image restoration

A novel method for estimating the distribution of convective heat flux in ducts: Gaussian Filtered Singular Value Decomposition

Tensor-Tensor Product Toolbox

Statistical Geometry Processing Winter Semester 2011/2012

1 Linearity and Linear Systems

Truncated decompositions and filtering methods with Reflective/Anti-Reflective boundary conditions: a comparison

Scaled gradient projection methods in image deblurring and denoising

Background Mathematics (2/2) 1. David Barber

Newton s method for obtaining the Regularization Parameter for Regularized Least Squares

Mathematics and Computer Science

A Hybrid LSQR Regularization Parameter Estimation Algorithm for Large Scale Problems

CSE 554 Lecture 7: Alignment

Computational Methods. Eigenvalues and Singular Values

Let A an n n real nonsymmetric matrix. The eigenvalue problem: λ 1 = 1 with eigenvector u 1 = ( ) λ 2 = 2 with eigenvector u 2 = ( 1

Modeling Classes of Shapes Suppose you have a class of shapes with a range of variations: System 2 Overview

COMPUTATIONAL ISSUES RELATING TO INVERSION OF PRACTICAL DATA: WHERE IS THE UNCERTAINTY? CAN WE SOLVE Ax = b?

Numerical Methods for Separable Nonlinear Inverse Problems with Constraint and Low Rank

ETNA Kent State University

Numerical Linear Algebra

2.161 Signal Processing: Continuous and Discrete

THE SINGULAR VALUE DECOMPOSITION MARKUS GRASMAIR

A MODIFIED TSVD METHOD FOR DISCRETE ILL-POSED PROBLEMS

Singular value decomposition. If only the first p singular values are nonzero we write. U T o U p =0

Name: INSERT YOUR NAME HERE. Due to dropbox by 6pm PDT, Wednesday, December 14, 2011

HST.582J/6.555J/16.456J

LPA-ICI Applications in Image Processing

Preprocessing & dimensionality reduction

ECE295, Data Assimila0on and Inverse Problems, Spring 2015

ETNA Kent State University

UPRE Method for Total Variation Parameter Selection

Linear Algebra & Geometry why is linear algebra useful in computer vision?

One Picture and a Thousand Words Using Matrix Approximtions October 2017 Oak Ridge National Lab Dianne P. O Leary c 2017

COMS 4721: Machine Learning for Data Science Lecture 19, 4/6/2017

Main matrix factorizations

B553 Lecture 5: Matrix Algebra Review

A fast randomized algorithm for approximating an SVD of a matrix

c 2008 Society for Industrial and Applied Mathematics

AMS classification scheme numbers: 65F10, 65F15, 65Y20

Oslo Class 4 Early Stopping and Spectral Regularization

We use the overhead arrow to denote a column vector, i.e., a number with a direction. For example, in three-space, we write

Principal Component Analysis

INVERSE SUBSPACE PROBLEMS WITH APPLICATIONS

Geometric Modeling Summer Semester 2010 Mathematical Tools (1)

Numerical Linear Algebra

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

1 Number Systems and Errors 1

Linear Algebra Review. Fei-Fei Li

A matrix-free method for regularisation with unrestricted variables

ECE 501b Homework #6 Due: 11/26

Statistics 202: Data Mining. c Jonathan Taylor. Week 2 Based in part on slides from textbook, slides of Susan Holmes. October 3, / 1

Tikhonov Regularization in General Form 8.1

Part I. Other datatypes, preprocessing. Other datatypes. Other datatypes. Week 2 Based in part on slides from textbook, slides of Susan Holmes

The Chi-squared Distribution of the Regularized Least Squares Functional for Regularization Parameter Estimation

The Chi-squared Distribution of the Regularized Least Squares Functional for Regularization Parameter Estimation

1 Singular Value Decomposition and Principal Component

Recovery of Sparse Signals from Noisy Measurements Using an l p -Regularized Least-Squares Algorithm

Bindel, Fall 2016 Matrix Computations (CS 6210) Notes for

Downloaded 06/11/15 to Redistribution subject to SIAM license or copyright; see

Spectral Regularization

Math 102, Winter Final Exam Review. Chapter 1. Matrices and Gaussian Elimination

Midterm for Introduction to Numerical Analysis I, AMSC/CMSC 466, on 10/29/2015

Matrices and Vectors. Definition of Matrix. An MxN matrix A is a two-dimensional array of numbers A =

A fast nonstationary preconditioning strategy for ill-posed problems, with application to image deblurring

Numerical Methods I Non-Square and Sparse Linear Systems

Assignment #10: Diagonalization of Symmetric Matrices, Quadratic Forms, Optimization, Singular Value Decomposition. Name:

Regularization via Spectral Filtering

A Note on the Pin-Pointing Solution of Ill-Conditioned Linear System of Equations

2.161 Signal Processing: Continuous and Discrete Fall 2008

Chapter 9: Gaussian Elimination

EIGENVALE PROBLEMS AND THE SVD. [5.1 TO 5.3 & 7.4]

Linear Algebra & Geometry why is linear algebra useful in computer vision?

Estimation of the Optimum Rotational Parameter for the Fractional Fourier Transform Using Domain Decomposition

Linear Algebra Review. Fei-Fei Li

CS168: The Modern Algorithmic Toolbox Lecture #8: How PCA Works

(Mathematical Operations with Arrays) Applied Linear Algebra in Geoscience Using MATLAB

Enhanced Compressive Sensing and More

Singular Value Decomposition

7.4. The Inverse of a Matrix. Introduction. Prerequisites. Learning Outcomes

3D Computer Vision - WT 2004

An iterative multigrid regularization method for Toeplitz discrete ill-posed problems

Transcription:

Laboratorio di Problemi Inversi Esercitazione 2: filtraggio spettrale Luca Calatroni Dipartimento di Matematica, Universitá degli studi di Genova Aprile 2016. Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 1 / 17

Outline 1 Exploiting PSF structure for BCCB matrix computation 2 TSVD and Tikhonov implementation 3 Tikhonov parameter choice via GCV Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 2 / 17

A structural way to build blur operators Load the Shepp-Logan phantom im1=phantom( Modified Shepp-Logan, 256); Generate Gaussian PSF of the same size, σ 2 = 3 to blur the image. Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 3 / 17

A structural way to build blur operators Load the Shepp-Logan phantom im1=phantom( Modified Shepp-Logan, 256); Generate Gaussian PSF of the same size, σ 2 = 3 to blur the image. We want to exploit the structure of the PSF and the type of boundary conditions considered to build efficiently the blur matrix B (similar to how imfilter works). Easy case: generic PSF, periodic boundary conditions BCCB matrix: starting from PSF, elements are circularly shifted with respect to the centre of the PSF... see theory! Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 3 / 17

A structural way to build blur operators Load the Shepp-Logan phantom im1=phantom( Modified Shepp-Logan, 256); Generate Gaussian PSF of the same size, σ 2 = 3 to blur the image. We want to exploit the structure of the PSF and the type of boundary conditions considered to build efficiently the blur matrix B (similar to how imfilter works). Easy case: generic PSF, periodic boundary conditions BCCB matrix: starting from PSF, elements are circularly shifted with respect to the centre of the PSF... see theory! Determine the centre of Gaussian PSF. Use circshift to build first column of the blur matrix B (still a matrix). Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 3 / 17

Why all this? Can t we use MATLAB imfilter? Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 4 / 17

Why all this? Can t we use MATLAB imfilter? Need for inversion! No blur operator provided by MATLAB when using fspecial, only PSF and filtered results! From an inverse problem perspective, the operator B (needed for inversion) is not provided by MATLAB. Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 4 / 17

Why all this? Can t we use MATLAB imfilter? Need for inversion! No blur operator provided by MATLAB when using fspecial, only PSF and filtered results! From an inverse problem perspective, the operator B (needed for inversion) is not provided by MATLAB. The spectral properties of B can further be exploited for quick implementation!... and actually the computation of B is never directly required! but... only the first column is needed! Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 4 / 17

Notation For what follows: denote by σ i, i = 1,..., N the (complex) eigenvalues of B diagonal matrix Σ; F the 2-dimensional Fourier transform matrix; F the 2-dimensional anti-fourier transform matrix. MATLAB: use fft2 and ifft2 as (rescaled) matrix multiplication by F and F, respectively.... Vectorisation! y=bx... Warning: fft2 and ifft2 act on 2D arrays. So, from here onwards 1 First apply the functions to matrices; 2 Then, reshape. Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 5 / 17

Useful properties of BBCB matrices 1 The set of eigenvectors of every BCCB matrix can be expressed in terms of the 2D-Fourier transform: B = F ΣF, which entails: FB = ΣF Fb 1 = Σf 1 where b 1 and f 1 are the first columns of B and F matrix, respectively. We have: 1 f 1 = 1 1 N. 1 Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 6 / 17

Useful properties of BBCB matrices 1 The set of eigenvectors of every BCCB matrix can be expressed in terms of the 2D-Fourier transform: B = F ΣF, which entails: FB = ΣF Fb 1 = Σf 1 = 1 N σ where b 1 and f 1 are the first columns of B and F matrix, respectively. We have: 1 f 1 = 1 1 N. 1 2 to compute σ, the eigenvalues of B, apply fft2 to first column of blur matrix (which comes, unintuitively, as a matrix), then vectorise the result. Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 6 / 17

Why all this? We will...... create MATLAB functions that will serve as regularised solvers for the deblurring problem. Input? We will focus on Tikhonov and TSVD, both implemented by means of the σ i. Do it wisely! Using this strategy based on the use of fft2 reduces computational costs with respect to using the eig function. Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 7 / 17

Why all this? We will...... create MATLAB functions that will serve as regularised solvers for the deblurring problem. Input? We will focus on Tikhonov and TSVD, both implemented by means of the σ i. Do it wisely! Using this strategy based on the use of fft2 reduces computational costs with respect to using the eig function. Step 0: use all this to create the function naive deblur to compute deblurred version of im1 using: x = B 1 y = F Σ 1 Fy Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 7 / 17

Why all this? We will...... create MATLAB functions that will serve as regularised solvers for the deblurring problem. Input? We will focus on Tikhonov and TSVD, both implemented by means of the σ i. Do it wisely! Using this strategy based on the use of fft2 reduces computational costs with respect to using the eig function. Step 0: use all this to create the function naive deblur to compute deblurred version of im1 using: x = B 1 y = F Σ 1 Fy - compute eigenvalues as above. - standard Fourier inversion (take the real part). - we know it won t work! Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 7 / 17

Outline 1 Exploiting PSF structure for BCCB matrix computation 2 TSVD and Tikhonov implementation 3 Tikhonov parameter choice via GCV Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 8 / 17

Let s take a look at the SVD... Let B bw BCCB and let us introduce Φ, filters (like the ones we saw last time for thresholding/regularisation), we have: x = B 1 y = F ΦΣ 1 Fy Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 9 / 17

Let s take a look at the SVD... Let B bw BCCB and let us introduce Φ, filters (like the ones we saw last time for thresholding/regularisation), we have: Towards filtering... x = B 1 y = F ΦΣ 1 Fy refine naive deb giving Φ as input. In the naive case, what is Φ? vectorise Σ and blurred image as σ, y, respectively. introduce auxiliary filtering vector s filt =... and invert by multiplying. remember always to reshape before applying fft2, ifft2 and to take the real part. Output: deblurred image. Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 9 / 17

The problem x = B 1 y = F ΦΣ 1 Fy Informally, when inverting with MATLAB: Phi=speye(size(im)); phi=diag(phi); deb=ifft2((phi./s).* "fft2(b)") Note the (possible) division by 0! Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 10 / 17

Truncated Singular Value Decomposition filtering Idea: removing small singular values of σ by filtering them by multiplication by 0. { 1, i = 1,..., k, φ i = 0, i = k + 1,..., N. Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 11 / 17

Truncated Singular Value Decomposition filtering Idea: removing small singular values of σ by filtering them by multiplication by 0. { 1, i = 1,..., k, φ i = 0, i = k + 1,..., N. Task: modify Φ to eliminate small singular values. Write function tsvd fft2 with the same input as before with additional tol=0.01 value to threshold. Set small elements of σ to 0. Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 11 / 17

Truncated Singular Value Decomposition filtering Idea: removing small singular values of σ by filtering them by multiplication by 0. { 1, i = 1,..., k, φ i = 0, i = k + 1,..., N. Task: modify Φ to eliminate small singular values. Write function tsvd fft2 with the same input as before with additional tol=0.01 value to threshold. Set small elements of σ to 0. Use find to compute the vectors of the non-null elements of Φ. For these elements, compute the filtering, reshape, use ifft2 to compute the output deblurred image. Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 11 / 17

TSVD: take-home message and variations on the theme Problem solved!! Observe that the problems of the inversion are solved by the multiplication of filters which never blow up (after thresholding)! Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 12 / 17

TSVD: take-home message and variations on the theme Problem solved!! Observe that the problems of the inversion are solved by the multiplication of filters which never blow up (after thresholding)! 1 1st variation: verify the robustness of the approach after adding noise? 2 2nd variation: how does the choice of tol affect the deblurring result? Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 12 / 17

Tikhonov filtering Idea: correct Φ by imposing that the denominator never vanishes. φ i = σ2 i σ 2 i + λ, λ > 0, where λ is the Tikhonov regularisation parameter. Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 13 / 17

Tikhonov filtering Idea: correct Φ by imposing that the denominator never vanishes. φ i = σ2 i σ 2 i + λ, λ > 0, where λ is the Tikhonov regularisation parameter. Task: write Tikhonov filtering function. Write function tik fft2 with the same input as before with additional λ=0.01 regularisation parameter.. Write the filters appropriately... careful: do not divide by zero! Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 13 / 17

Tikhonov filtering Idea: correct Φ by imposing that the denominator never vanishes. φ i = σ2 i σ 2 i + λ, λ > 0, where λ is the Tikhonov regularisation parameter. Task: write Tikhonov filtering function. Write function tik fft2 with the same input as before with additional λ=0.01 regularisation parameter.. Write the filters appropriately... careful: do not divide by zero! Compute the filtering, reshape, use ifft2 to compute the output deblurred image. Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 13 / 17

Tikhonov filtering Idea: correct Φ by imposing that the denominator never vanishes. φ i = σ2 i σ 2 i + λ, λ > 0, where λ is the Tikhonov regularisation parameter. Task: write Tikhonov filtering function. Write function tik fft2 with the same input as before with additional λ=0.01 regularisation parameter.. Write the filters appropriately... careful: do not divide by zero! Compute the filtering, reshape, use ifft2 to compute the output deblurred image. + Variations: noise? Choice of λ? Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 13 / 17

The choice of λ Tikhonov functional: Heuristically: min y Bx 2 2 + λ x 2 small λ: low regularisation, high data-fitting. Reconstruction is still noisy since oscillations are preserved. large λ: high regularisation, low data-fitting. Reconstruction is over-smoothed. How to choose the optimal λ? The optimal λ is somewhere in between. Is there an automatic method to choose it? Which prior information do we need? Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 14 / 17

The choice of λ Tikhonov functional: Heuristically: min y Bx 2 2 + λ x 2 small λ: low regularisation, high data-fitting. Reconstruction is still noisy since oscillations are preserved. large λ: high regularisation, low data-fitting. Reconstruction is over-smoothed. How to choose the optimal λ? The optimal λ is somewhere in between. Is there an automatic method to choose it? Which prior information do we need? prior information on the noise level σ 2 : discrepancy principle. no prior knowledge on the noise level: Generalised Cross Validation (GCV). Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 14 / 17

Outline 1 Exploiting PSF structure for BCCB matrix computation 2 TSVD and Tikhonov implementation 3 Tikhonov parameter choice via GCV Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 15 / 17

GCV for Tikhonov filtering GCV functional for general filter matrix Φ: G(λ) = (Id Φ)ŷ 2 (tr(id Φ)) 2, so its form depends on the filter used. Note that this does not make sense when Φ = Id (non-filtered case). Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 16 / 17

GCV for Tikhonov filtering GCV functional for Tikhonov filter matrix Φ: G(λ) = N i=1 ( ŷ σ 2 i +λ ) 2 ( N i=1 ) 2 1 σi 2+λ It can be shown that the minimum of the functional G is unique and it corresponds to the optimal choice of λ (leave-one-out principe). Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 16 / 17

GCV for Tikhonov filtering GCV functional for Tikhonov filter matrix Φ: G(λ) = N i=1 ( ŷ σ 2 i +λ ) 2 ( N i=1 ) 2 1 σi 2+λ It can be shown that the minimum of the functional G is unique and it corresponds to the optimal choice of λ (leave-one-out principe). Task: implement GCV function for Tikohonov filter. In particular: Input: PSF, blurred image. Output: optimal λ. Write the GCV functional as a @ GCV (function handle). Input? use fminbound MATLAB inbuilt function to get the minimum of GCV functional. Use box constraints to bound the solution: λ=fminbnd(@ GCV, min(abs(s)), max(abs(s)), [], s, bhat); Show result with optimal λ. Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 16 / 17

References Inspiration and references are taken from: - P. C. Hansen, J. G. Nagy, D. P. O Leary, Deblurring Images, Matrices, Spectra and Filtering, SIAM, Philadelphia, 2006. - Online material and inspiring MATLAB toolboxes: http://www.imm.dtu.dk/~pcha/hno/ - Slides on blur matrices: http: //www.mathcs.emory.edu/~nagy/courses/fall06/id_lecture1.pdf Luca Calatroni (DIMA, Unige) Esercitazione 2, Lab. Prob. Inv. Aprile 2016 17 / 17