Anisotropic Total Variation Based Image Restoration Using Graph Cuts
BjΓΈrn Rustad
Master of Science in Physics and Mathematics
Supervisor: Markus Grasmair, MATH
Department of Mathematical Sciences
Submission date: February 2015
Norwegian University of Science and Technology
AbstractIn this thesis we consider a particular kind of edge-enhancing image restorationmethod based on total variation. We want to address the fact that the totalvariation method in some cases leads to contrast loss in thin structures. To reducethe contrast loss a directional dependence is introduced through an anisotropytensor. The tensor controls the regularization applied based on the position in theimage and the direction of the gradient. It is constructed using edge informationextracted from the noisy image. We optimize the resulting functional using agraph cut framework; a discretization which is made possible by a coarea and aCauchyβCrofton formula. In the end we perform numerical studies, experimentwith the parameters and discuss the results.
SammendragI denne masteroppgaven ser vi pΓ₯ en spesifikk kant-bevarende stΓΈyfjerningsalgo-ritme basert pΓ₯ Β«total variationΒ». Vi tar for oss at Β«total variationΒ» i noen tilfellerfΓΈrer til tap av kontrast i detaljer og tynne strukturer. For Γ₯ redusere kontrast-tapetintroduserer vi en retningsavhengig anisotropitensor. Denne tensoren kontrollererstΓΈyfjerningen basert pΓ₯ posisjonen i bildet, og retningen til gradienten i punktet.Den blir konstruert basert pΓ₯ kant-informasjon fra det opprinnelige stΓΈyete bildet.Vi minimerer den resulterende funksjonalen i et graf-kutt-rammeverk, som er gjortmulig ved hjelp av en coarea- og en CauchyβCrofton-likning. Vi avslutter med ennumerisk studie, eksperimentering med parametrene og diskusjon av resultatene.
Preface
This master thesis concludes my study at the Applied Physics and Mathemat-ics Masterβs degree program with specialization in Industrial Mathematics at theNorwegian University of Science and Technology (NTNU).
I would like to thank my supervisor Markus Grasmair at the Department of Math-ematical Sciences for invaluable help and discussion throughout my work with myproject and this thesis.
Finally I would like to thank my family for their support, and Mats, Lars, Kine,Hager, Edvard and Henrik for productive discussions around the coffee pot.
BjΓΈrn Rustad, February 8, 2015.
Contents
1 Introduction 1
2 Methods in image restoration 32.1 Diffusion filtering . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42.2 Total variation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
3 Continuous formulation 113.1 Anisotropic total variation . . . . . . . . . . . . . . . . . . . . . . . 113.2 Well-posedness . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163.3 Anisotropic coarea formula . . . . . . . . . . . . . . . . . . . . . . . 193.4 Anisotropic CauchyβCrofton formula . . . . . . . . . . . . . . . . . 24
4 Discrete formulation 324.1 Discretization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324.2 Graph cut approach . . . . . . . . . . . . . . . . . . . . . . . . . . 41
5 Maximum flow 475.1 Flow graphs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 475.2 Augmenting path algorithms . . . . . . . . . . . . . . . . . . . . . . 495.3 Other algorithms . . . . . . . . . . . . . . . . . . . . . . . . . . . . 505.4 Pushβrelabel algorithm . . . . . . . . . . . . . . . . . . . . . . . . . 515.5 BoykovβKolmogorov algorithm . . . . . . . . . . . . . . . . . . . . 60
6 Results 666.1 Tensor parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . 666.2 Neighborhood stencils . . . . . . . . . . . . . . . . . . . . . . . . . 706.3 Restoration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
7 Discussion and conclusion 76
iii
iv CONTENTS
Bibliography 79
List of Figures 83
List of Tables 85
List of Symbols 87
A C++ implementation 89A.1 main.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90A.2 image.hpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92A.3 image.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93A.4 anisotropy.hpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96A.5 anisotropy.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96A.6 graph.hpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 99A.7 graph.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101A.8 selectionrule.hpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109A.9 selectionrule.cpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110A.10 neighborhood.hpp . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Chapter 1Introduction
Image processing is becoming an increasingly important part of our modern com-puterized world. Tasks previously only performed by humans, like detecting edges,recognizing textures and inferring shapes and motions can now be performed al-gorithmically. The background of these methods spans several fields, includingpsychology and biology for the study of human vision, statistics and analysis forthe mathematical background, and computer science for their implementation andperformance analysis.
Image restoration methods are concerned with trying to remove noise or recoverotherwise degraded images. Possible noise can result from the physical nature oflight traveling to your sensor, dust on your lens, and many other sources. Thereforenumerous different approaches to denoising exist, each having their own strengthsand weaknesses. Some of these are introduced in Chapter 2, and one of the mainchallenges they all face is the recovery of edges.
A method well known for recovering edges is the total variation method, as thetotal variation does not favor smooth gradients over edges. I gave an overview ofthis method in my project work [1], where I used a graph cut framework to obtaina numerical solution. The method consists of trying to reduce the total variationof the image, while still staying βcloseβ to the original.
A problem with the total varation method is that contrast is often lost, espe-cially in fine details and thin structures. In this thesis we try to alleviate this. Weextend the method by introducing an anisotropy tensor into the total variation,thus making it directionally dependent. This means we can control the regular-ization applied to the image based on position and direction. The main idea isthen to reduce the regularization applied across edges in the image, while we stillregularize along them.
The variational problem we obtain is a convex minimization problem, andmany optimization approaches exist. We choose to discretize in such a way that
1
2 CHAPTER 1. INTRODUCTION
we can apply the same graph cut framework used in my project work [1]. Throughthe coarea formula, the functional is decomposed into a sequence of minimizationproblems, one for each level of the image. These separate level problems are thentransformed and discretized further using an anisotropic CauchyβCrofton formulathat we develop. Similar formulas have been presented before in other contexts.
A nice property of this numerical approach is that we can prove that thegraph cut framework finds an exact global minimizer of the discrete functional.Additionally we verify that the discrete functional is consistent with the continuousone.
We present and implement two maximum flow algorithms that allow us to findminimum cuts corresponding to minimizers of the discrete functionals. The push-relabel algorithm is considered to be the fastest and most versatile for generalgraphs, while the BoykovβKolmogorov algorithm is specially tailored for the typeof graphs we find in these kinds of imaging applications. We describe every partof the method in detail such that it can be easily implemented by the reader. Inaddition, a C++ implementation is attached.
In the end we present numerical results that show how the different parame-ters affect the restoration, and we look into and explain some artifacts caused byapproximations in the discretization. Further we look at how the introduction ofthe anisotropy in certain cases amend some of the weaknesses of the total variationmethod. We particularly look at how contrast loss is reduced in images containingthin structures such as fingerprints.
Chapter 2Methods in image restoration
There are numerous methods in image restoration, but we do not have time norspace to discuss them all. In short overview, which is an extension of the onegiven in my project [1], we will focus on the methods related to the anisotropictotal variation method considered later in this thesis. See [2] and [3] for morebackground on image processing in general.
In this chapter, and also in the rest of the thesis we will assume that we aregiven an image π βΆ Ξ© β β where Ξ© is a rectangular, open domain. Because oflimitations in the numerical method used, the codomain is β and we are thusrestricted to monochrome, or grayscale images. Such images are produced in largenumbers by for example ultrasound, X-ray and MRI machines.
The space in which the image π resides in will vary, but since we are lookingat image restoration methods, we assume that it includes some kind of noise.Depending on the application and how the image is obtained, one might constructdifferent models describing different types of noise.
We will assume that the given image π is a combination of an underlying,actual image π’β, and some noise πΏ. The simplest model is additive noise where theassumption is that π = π’β + πΏ. There is also multiplicative noise where π = π’β β πΏ.An other much seen noise type is salt and pepper noise, which is when black andwhite pixels randomly appear in the image.
These are only models, and in the real world the noise might be more complex,and even come from a combination of sources. Depending on the application, thegoal might not even be to recover π’β, but rather to obtain an output which fulfillscertain smoothness or regularity properties. In any case, we will continue denotingthe noisy input image π and use π’ for the output image in the description of therestoration methods.
3
4 CHAPTER 2. METHODS IN IMAGE RESTORATION
2.1 Diffusion filteringDiffusion filtering is a broad group of filtering and restoration methods based onphysical diffusion processes. The basic idea is to take the noisy image as theinitial value of some diffusion process, and then let it evolve for some time. Thebest known method is probably the Gaussian filter or Gaussian blur, in which oneconvolves the image with the Gaussian function
πΎπ(π₯, π¦) =1
2ππ2 exp (βπ₯2 + π¦2
2π2 ) . (2.1)
In the discrete setting where the image consists of a grid of pixels, the Gaussianblur amounts to calculating each pixel in the output image as a weighted averageof its neighboring pixels in the input image.
The Gaussian function happens to be the fundamental solution of the heatequation ππ‘π’ = Ξπ’. Convolving πΎπ(π₯, π¦) with the original image π is thereforeequivalent to solving the heat equation with π as initial value, until some timeπ > 0 depending on π. Boundary conditions have to be specified of course, andone common choice is to symmetrically extend the image in π₯ and π¦ directions,which corresponds to zero flux boundary conditions.
By basic Fourier analysis it is possible to show that the Gaussian filter is alow-pass filter which attenuates high frequencies. Further theory can be found inWeickertβs book on anisotropic diffusion [4].
The main concern with the Gaussian filter is that it will, in addition to smooth-ing out possible noise, remove details from the image, which motivates the nextset of methods, where the amount of diffusion can vary between different parts ofthe image.
2.1.1 Non-linear diffusion filteringIn the theory of the heat equation one can introduce a thermal diffusivity πΌ suchthat the equation becomes
{ ππ‘π’ = div (πΌ(βπ’)βπ’),π’|π‘=0 = π.(2.2)
The thermal diffusivity πΌ(βπ’) = πΌ(π₯, βπ’) is material dependent, and can alsovary throughout the object. It specifies how well heat travels through the specificpoint in the object. We can make use of this in the image restoration context byspecifying different diffusivity in different parts of the image, in an effort to reducenoise without loosing image detail. Optimally, we would like there to be a lot of
2.1. DIFFUSION FILTERING 5
diffusion in smooth parts of the image, and not so much in areas with a lot ofdetails.
One much-studied non-linear diffusion equation is the PeronaβMalik equation
ππ‘π’ = div ( βπ’1 + |βπ’|2π2) . (2.3)
The thermal diffusivity πΌ(βπ’) = (1 + |βπ’|2/π2)β1 varies from 1 in smooth areas to0 as the norm of the gradient |βπ’| grows.
This particular form of the thermal diffusivity has been shown to be relatedto how brightness is perceived by the human visual system. The model has sometheoretical problems related to well-posedness, for more information see [4].
A different kind of non-linear diffusion model is the total variation flow whichcan be formulated as
ππ‘π’ = divβπ’|βπ’|, (2.4)
where the diffusivity has a similar effect of reducing the diffusion in areas of highvariation. As the name suggests, this model can be related to the variational totalvariation formulation presented later. One forward Euler time-step in the solutionof this partial differential equation corresponds to the EulerβLagrange equation ofthe variational formulation.
Note that we follow Weickertβs terminology when it comes to the distinctionbetween non-linear and anisotropic diffusion methods. The PeronaβMalik equa-tion, and other diffusion equations with non-homogenous diffusivities, are often byothers called anisotropic, as the diffusivity depends on the location. We will namethese methods non-linear and spare the anisotropy term for the βrealβ anisotropicmethods. These are methods where the diffusivity is a tensor, and thus bothlocation and direction dependent.
2.1.2 Anisotropic diffusionThe diffusivity is made directionally dependent by introducing a diffusion tensorπ΄(π’) such that the initial boundary value problem becomes
β§{β¨{β©
ππ‘π’ = div (π΄(π’)βπ’) on Ξ© Γ (0, β),π’|π‘=0 = π on Ξ©,
π΄(π’)βπ’ β π = 0 on πΞ© Γ (0, β),(2.5)
where π is the outer normal of Ξ©. The tensor π΄(π’) is constructed such as todiminish the effect of βπ’ across what we believe to be edges in the image. This
6 CHAPTER 2. METHODS IN IMAGE RESTORATION
way, there will also be less diffusion through these edges. Weickert [4] suggestsconstructing π΄(π’) based on the edge estimator βπ’π where
π’π βΆ= πΎπ β οΏ½ΜοΏ½ (2.6)
and οΏ½ΜοΏ½ is an extension of π’ from Ξ© to β2 made by symmetrically extending π’ acrossthe boundary of Ξ©. Assuming we are at an edge in the image, the direction of βπ’πshould be perpendicular to the edge, while its magnitude will provide informationon the steepness of the edge.
To extract this information, and also to identify features on a larger scale, thestructure tensor is introduced
ππ(π₯) βΆ= πΎπ β (βπ’π β βπ’π), (2.7)
where the convolution with the Gaussian function πΎπ is done component-wise.The anisotropy tensor π΄(π’) can then be constructed based on the eigenvectorsand eigenvalues of ππ(π₯). The structure tensor and its properties will be discussedfurther when we introduce our anisotropic total variation functional.
Assuming some smoothness, symmetry and uniform positive definiteness onπ΄(π’) one can prove well-posedness, regularity and an extremum principle of theproblem (2.5) as done in [4].
However, even if the diffusivity tensor was introduced to reduce the amount ofsmoothing across edges, the solution of (2.5) will still be infinitely differentiable[4], i.e. π’(π ) β πΆβ(Ξ©) for π > 0. Thus there are no real discontinuities, and noreal edges in the solution.
Further, the anisotropic diffusion may introduce structure based on noise, whenthere really was no structure to begin with. This is a problem we aim to avoid inour anisotropic total variation method.
2.2 Total variationTotal variation was initially introduced to the field of image restoration by Rudin,Osher and Fatemi in [5] and is usually formulated as a minimization problem
minπ’βπΏπ(β¦)
πΉ(π’),
πΉ(π’) = β«β¦
|π’ β π|π ππ₯βββββββ
fidelity term
+ π½ β«β¦
|βπ’| ππ₯βββββ
regularization term
, (2.8)
where π is normally taken to be 1 or 2. The fidelity term penalizes images π’ thatare far from the original image π . The regularization term is the total variation
2.2. TOTAL VARIATION 7
of the image, and minimizing it will reduce the variation and thus regularize theimage. The π½ parameter controls the strength of the regularization. Note thatπ’ = π is a minimizer of the fidelity term, while a constant image π’ = π is aminimizer of the regularization term.
As this restoration method is the one which will be extended later in thisthesis, we will look a little bit more deeply into the background and the numericalmethods relating to it.
Since we do not only want to consider differentiable images π’ β πΆ1(Ξ©) forwhich the gradient exists, we introduce the total variation using the distributionalderivative.
Definition 2.1 (Total variation). Given a function π’ β πΏ1(Ξ©), the total vari-ation of π’, often written β«β¦ |π·π’| ππ₯, where the π· is the gradient taken in thedistributional sense, is
TV(π’) = β«β¦
|π·π’| ππ₯ = sup {β«β¦
π’ β div π ππ₯ βΆ π β πΆβπ (Ξ©, β2) , βπβπΏβ(β¦) β€ 1} .(2.9)
The test functions π are taken from πΆβπ (Ξ©, β2), the space of smooth functionsfrom Ξ© to β2 with compact support in Ξ©.
Note that since Ξ© is open and bounded, the test functions π vanish on theboundary of Ξ©. Thus no variation is measured at the boundary.
As we are searching for an image with low total variation, it is useful to intro-duce the space of functions of bounded variation.
Definition 2.2 (Functions of bounded variation). The space of functions of boundedvariation BV(Ξ©) is the space of functions π’ β πΏ1(Ξ©) for which the total variationis finite, i.e.,
BV(Ξ©) = {π’ β πΏ1(Ξ©) βΆ TV(π’) < β} . (2.10)
Our optimization problem has thus become
minπ’βBV(β¦)
β«β¦
|π’ β π£|π ππ₯ + π½ TV(π’). (2.11)
As with any restoration method, the total variation method has its strengthsand weaknesses. Its main strength is its ability to recover edges in the input image.The total variation of a section only takes the absolute change into account, anddoes not favor gradual changes like the diffusion methods.
There is also a theoretical result stating that the set of edges in the solutionπ’ is contained in the set of edges in the original image π , thus no new edges arecreated [6]. However, in the presence of noise, the method may introduce or rather
8 CHAPTER 2. METHODS IN IMAGE RESTORATION
(a) Noisy gradient (b) Total variation restoration
Figure 2.1: Although the original gradient was smooth, the total variationmethod manages to find structure in the noise, and create edges in therestored image.
Figure 2.2: A fingerprint heavily regularized using the total variationmethod. The originally white and black ridges have been brought closer invalue, to reduce the total variation.
βfindβ new edges that were not in the original image, since flat sections of zerovariation are encouraged by the functional. This effect is called the stair-casingeffect, and can be seen in Figure 2.1 where a noisy gradient has been restored usingthe total variation method.
Fine details, thin objects and corners may suffer from contrast loss since bring-ing them closer to their surroundings reduces the total variation. An example ofthis is shown in Figure 2.2, where a not particularly noisy fingerprint image hasbeen strongly regularized. The original black and white levels have been broughtcloser to yield a lower total variation in the regularized image.
2.2. TOTAL VARIATION 9
2.2.1 Numerical methodsSee [7] for an overview of some of the numerical methods relating to total vari-ation image restoration. Amongst others it describes some dual and primal-dualmethods, as well as the graph cut approach we take in this thesis.
Graph cut approach
Using graph cuts is the approach we will be taking later when considering theanisotropic total variation regularization, and it is therefore valuable to brieflylook into how graph cuts are used in the case of regular total variation.
A graph cut is a set of edges that when removed will separate the graph intotwo disconnected parts. A minimum cut is a cut such that the sum of the weightof the edges in the cut is minimal. It has been shown that for some discrete func-tionals, it is possible to construct graphs for which the minimum cuts correspondto minimizers of the functional.
In the discrete setting our image consists of pixels, and is represented by afunction π’ βΆ π’ β π« where π’ is a regular grid over Ξ©, and π« = {0, β¦ , πΏ β 1} is thediscrete set of pixel values, or levels. We denote the value in pixel π₯ as π’(π₯) = π’π₯.
For an image π’ and a level π we denote the level set by {π’ > π}, defined as theset {π₯ β Ξ© βΆ π’π₯ > π}. The thresholded image π’π, an indicator function, is thendefined as
π’π = ππ’>π. (2.12)Here, ππΈ signifies the characteristic function of the set πΈ, the function which isequal to one in every point in πΈ, and zero elsewhere.
The idea of the graph cut approach is to decompose the minimization probleminto one minimization problem for each level of the image, and then solve themseparately before combining the results.
Through careful manipulation of the continuous functional in (2.11) it is pos-sible to obtain a discrete functional decomposed as a sum over all the level valueson the form
πΉ(π’) =πΏβ2βπ=0
βπ₯
πΉ π₯π (π’ππ₯) + π½πΏβ2βπ=0
β(π₯,π¦)
πΉ π₯,π¦(π’ππ₯, π’ππ¦) =βΆπΏβ2βπ=0
πΉπ(π’π) (2.13)
where the sum over (π₯, π¦) is over all pixel pairs (π₯, π¦) in a neighbor relation, i.e.pixels that are βcloseβ to each other. The actual form of the functional, and thesteps to construct it will be presented later.
The graph cut we find will for each level π give us the thresholded image π’π,and they can then be combined to form the complete image π’.
When constructing the graph used to find the thresholded image π’π, we havetwo special vertices, one representing the set {π’ > π}, and one which represents
10 CHAPTER 2. METHODS IN IMAGE RESTORATION
the set {π’ β€ π}. The pixels are then connected to these vertices with a weightrepresenting how strongly they are related to the corresponding set. This weightwill be based on the value of πΉ π₯π .
Additionally there are connections between pixels in a neighborhood relation,representing the energy πΉ π₯,π¦. Thus when finding a cut, we partition the pixelsinto the sets {π’ > π} and {π’ β€ π}. And if in addition the cut is minimal, weknow that the edges cut have minimal weight, and can prove that the π’π foundminimizes the functional in (2.13).
Chapter 3Continuous formulation
In the previous chapter we saw that there are many different approaches to theimage restoration problem, all with their own strengths and weaknesses. Themethod considered in this thesis is an anisotropic total variation formulation, andthe aim is to keep the strengths of the anisotropic diffusion and total variationmethods, while eliminating some of their weaknesses.
This chapter will be devoted to the continuous formulation of the method. Wewill look at the functional we want to minimize and its different forms, and brieflydiscuss its well-posedness. Through the anisotropic coarea formula, the anisotropictotal variation is rewritten as an integral of the perimeter of all the level sets ofthe image.
Following that, the anisotropic CauchyβCrofton formula is introduced to makeit feasible to calculate the perimeter of these level sets. All of this leads up to thediscretization of our functional in the next chapter.
3.1 Anisotropic total variationThe method considered will build on the total variation regularization methodof Section 2.2. From anisotropic diffusion in Section 2.1.2 we borrow the idea ofmaking the regularization in each point directionally dependent. We introduce theanisotropic total variation
TVπ΄(π’) = β«β¦
ββπ’(π₯)π π΄(π₯)βπ’(π₯) ππ₯ (3.1)
for all π’ β πΆ1(Ξ©). We assume here that π΄(π₯) is continuous and positive definite,and we will later need the eigenvalues of π΄(π₯) to be uniformly bounded below andabove. If π΄(π₯) is the identity matrix we get the regular total variation found in
11
12 CHAPTER 3. CONTINUOUS FORMULATION
(2.8). When minimizing the regular total variation, we will also try to reduce thevariation over known edges in the image. This can lead to unwanted contrast loss,especially in fine details. By controlling π΄(π₯) such that the contribution of βπ’(π₯)is reduced across known edges, we hope to retain the regularization properties ofthe original method while reducing this contrast loss. If the variation across anedge is βignoredβ by the functional, there is no gain in reducing the height of theedge as before.
Note that π’(π₯) and π΄(π₯) are always dependent on the position in the image π₯,but we will sometimes drop the π₯, when the intended meaning is clear.
As we will not always be working with differentiable images, we extend thedefinition of the total variation functional. Being symmetric positive definite, thematrix π΄ can be factored into two symmetric matrices as π΄ = π΄1/2π΄1/2. We canthen write
TVπ΄(π’) = β«β¦
β£π΄1/2βπ’β£ ππ₯
= sup|π(π₯)|β€1
β«β¦
(π΄1/2βπ’)π π ππ₯
= sup|π(π₯)|β€1
β«β¦
βπ’ β π΄1/2π ππ₯
= sup|π(π₯)|β€1
β«β¦
π’ div(π΄1/2π) ππ₯
= supππ π΄β1πβ€1
β«β¦
π’ div π ππ₯,
(3.2)
where π and π = π΄1/2π are in πΆβπ (Ξ©, β2), the space of smooth vector fields withcompact support. In the following we define the norms βπβπ΄ = supπ₯(ππ π΄π)
1/2 andβπββπ΄ = supπ₯(ππ π΄β1π)
1/2, and with that we present the formal definition of theanisotropic total variation.
Definition 3.1 (Anisotropic total variation). For a function π’ β πΏ2(Ξ©) and a con-tinuous symmetric positive definite tensor π΄ βΆ Ξ© β β2Γ2 we define the anisotropictotal variation
TVπ΄(π’) = sup {β«β¦
π’ div π ππ₯ βΆ π β πΆβπ (Ξ©, β2), βπββπ΄ β€ 1} . (3.3)
With this extended definition, we have arrived at a minimization problem wherewe seek to find a minimizer of the functional
πΉ(π’) = β«β¦
(π’ β π)2 ππ₯ + π½ TVπ΄(π’). (3.4)
3.1. ANISOTROPIC TOTAL VARIATION 13
Figure 3.1: A noisy fingerprint on the left, and the largest eigenvalue of thestructure tensor is |βππ(π₯)|2 on the left, whichβas we can seeβfunctionsas an edge detector.
Similar functionals have been considered in [8] and [9]. The question is now howto construct the anisotropy tensor π΄(π₯) to get the improvements we hope for, andhow the introduction of the tensor affects our numerical solution method.
3.1.1 Anisotropy tensorThere are many possible choices for the anisotropy tensor π΄(π₯). Our constraintsare that we have assumed it to be continuous and symmetric positive definite,and we have some wishes for its properties. We would first and foremost like it todown-weight βπ’ in (3.1) across true edges, while maintaining normal regularizationproperties in smooth sections.
By true edges we mean that that we do not want the tensor to be sensitive tonoise in the image, and thus find edges where there are none, so we somehow wantto be sure about the edges we find.
Edges can be found in many different ways, but as suggested by Weickert in hisbook on Anisotropic Diffusion [4], and briefly mentioned in Section 2.1.2, a goodstarting point is the edge detector βππ. The image is smoothed by a Gaussianfilter as described in Section 2.1: ππ = πΎπ β Μπ , where Μπ is the symmetric extensionof the initial image π in β2. The smoothing parameter π is called the noise scale,and it controls the scale at which details are considered to be noise.
As seen in Figure 3.1, the edge detector is fine for detecting edges, but itcan not give us information about larger structures, like corners and textures,
14 CHAPTER 3. CONTINUOUS FORMULATION
which is why we introduce the structure tensor ππ(π₯). First consider the tensorπ0(π₯) = βππ(π₯) β βππ(π₯). It is symmetric positive semi-definite, and obviouslycontains no more information than the edge detector itself. Its eigenvalues areπ1 = |βππ(π₯)|2 and π2 = 0 with corresponding eigenvectors π£1 and π£2 paralleland perpendicular to βππ(π₯) respectively.
To detect features in a neighborhood around the point π₯, such as corners,curved edges and coherent structures we introduce the component-wise convolutionwith πΎπ such that
ππ(π₯) βΆ= πΎπ β (βππ(π₯) β βππ(π₯))(π₯). (3.5)
The parameter π, called the integration scale, controls the size of the neighborhoodwhich affects the structure tensor. Thus it defines the size of the structures wewant our anisotropy tensor to be sensitive to.
The smoothed tensor ππ(π₯) can easily be verified to be symmetric positivesemi-definite, just like π0(π₯). In addition, when π > 0, the elements of ππ aresmooth maps from Ξ© to β.
We order the two real eigenvalues such that π1 β₯ π2 and denote the correspond-ing eigenvectors π£1 and π£2. From the characteristic polynomial of ππ(π₯) = ( π 11 π 12π 12 π 22 )we obtain a closed form expression for the eigenvalues
π = 12 (π 11 + π 22 Β± β(π 11 β π 22)2 + 4π 212) . (3.6)
The vector π£1 will then indicate the direction of most variation in the neighbor-hood. An edge will give π1 β« π2 β 0, while smooth areas will give π1 β π2 β 0.In corners we have variation in the direction of π£1 but also perpendicular to π£1,so we will have π1 β π2 β« 0. Thus the quantity (π1 β π2)2 will be large aroundedges and small in smooth or non-coherent areas.
To extract this information from the structure tensor, we decompose it as
ππ(π₯) = π(π₯)Ξ(π₯)π(π₯)π , (3.7)
whereΞ(π₯) = (π1 00 π2
) (3.8)
has the eigenvalues π1 β₯ π2 on its diagonal, while π(π₯) is a rotation matrix andhas the eigenvectors of ππ(π₯) as its columns. From this we construct a new matrixπ΄(π₯) = π(π₯)Ξ£(π₯)π(π₯)π where
Ξ£(π₯) = (π1 00 π2) . (3.9)
3.1. ANISOTROPIC TOTAL VARIATION 15
..
π1
.
π2
(a) The structure tensor ππ...
1
.
π1
(b) The anisotropy tensor π΄.
Figure 3.2: An edge with the structure and anisotropy tensors visualizedusing their eigenvectors and eigenvalues.
and for π1 and π2 we choose
π1 = (1 +(π1 β π2)2
π2 )β1
,
π2 = 1.(3.10)
Thus the eigenvectors of π΄(π₯) and ππ(π₯) are equal, while the eigenvalues aredifferent. A visualization of the two tensors can be seen in Figure 3.2 where thetwo tensors are shown at an edge in the image.
In smooth areas, π1 β 1 and π΄(π₯) will be close to the identity matrix. At oraround edges, π1, which corresponds to the eigenvector perpendicular to the edge,will be small.
Around corners π΄(π₯) will be close to the identity matrix, which gives regu-larization similar to smooth areas. This is one possible down-side of this tensorchoice, as rounded corners may occur.
The parameter π controls the amount of anisotropy in the method, such thatif it is very large we are left with the identity matrix and our method becomes theregular total variation method. Note also that changing the parameter π implicitlyaffects the amount of regularization applied. For an image π’, decreasing π will, allelse being equal, decrease the lowest eigenvalue of π΄(π₯) and in turn decrease theanisotropic total variation TVπ΄(π’).
For the case where π1 = π2, the π(π₯) in our decomposition is not well-defined.This is not a problem however, since Ξ£(π₯) will be the identity matrix, so anyorthogonal matrix will suffice for π(π₯).
Note that the eigenvalues of ππ are continuous, and so are the eigenvectors(ignoring their sign) except possibly when π1 = π2. Thus π΄ is also continuousexcept possibly in these points. When π1 = π2 however, the eigenvalues π1 andπ2 of π΄ will both be 1, and π΄ is the identity matrix. Thus we can argue that ifππ(π₯) β ππΌ then π΄(π₯) β πΌ and π΄ is continuous in all of Ξ©.
16 CHAPTER 3. CONTINUOUS FORMULATION
See [10] for a different tensor construction, made to enhance flow structures inthe image, relevant in for example fingerprint analysis.
3.2 Well-posednessThe theory of existence and uniqueness for these kinds of variational methods isa minefield of more or less subtle problems. Even if we restrict ourselves to a nicespace such as πΏ2(Ξ©) we will at some point run into problems. The discussion hereis not meant to give the most rigorous background, but rather an overview of whatneeds to be shown. Some problems will be worked around, while others will beskipped with a reference to further theory.
The basic things we ask of our functional
πΉ(π’) = β«β¦
(π’ β π)2 + π½ TVπ΄(π’) (3.11)
to have a well-posed problem are lower semi-continuity and coercivity for existence,and convexity for uniqueness. We restrict ourself to πΏ2(Ξ©) which makes sense withour fidelity term, assuming that π β πΏ2(Ξ©).
We consider the weak topology, as it will allow us to arrive at an existenceresult relatively easily. We say that a sequence ππ in πΏ2(Ξ©) converges weakly to πif
limπββ
β«β¦
ππ π ππ₯ = β«β¦
π π ππ₯ (3.12)
for all π β πΏ2(Ξ©) and we write ππ β π . A weakly convergent sequence is a sequencethat converges in the weak topology.
3.2.1 ConvexityWe start with convexity as it is the easiest to show. Being quadratic, the fidelityterm of our functional
β«β¦
(π’ β π)2 ππ₯ (3.13)
is obviously strictly convex. This can be shown by expanding and rearranging thestrict convexity condition
β«β¦
(ππ’1 + (1 β π)π’2 β π)2 ππ₯ < π β«β¦
(π’1 β π)2 ππ₯ + (1 β π) β«β¦
(π’2 β π)2 ππ₯ (3.14)
to obtain that it is equivalent to
β π(1 β π) β«β¦
(π’1 β π’2)2 ππ₯ < 0 (3.15)
3.2. WELL-POSEDNESS 17
.. π₯..
Figure 3.3: A lower semi-continuous function π βΆ β β β can havediscontinuities, but for a convergent sequence π₯π β π₯ we always haveπ(π₯) β€ lim infπββ π(π₯π).
which is true for 0 < π < 1 and π’1 β π’2.The anisotropic total variation
TVπ΄(π’) = supβπββπ΄β€1
β«β¦
π’ div π ππ₯ (3.16)
can be thought of asβand has the properties ofβa semi-norm, and is thereforeconvex. The sum of the fidelity and regularization terms is thus strictly convex,which, given the existence of a minimizer, implies uniqueness.
3.2.2 CoercivityCoercivity relates to how the functional behaves when the norm of the imageπ’ tends to infinity. What we need in order to conclude with existence is weaksequential coercivity. Thus we need all level sets πΉ πΌ = {π’ β πΏ2(Ξ©) βΆ πΉ(π’) β€ πΌ} tobe weakly sequentially pre-compact, meaning that all sequences in the set containa subsequence weakly converging to an element of the closure of the set.
It is obvious from the fidelity term that for some fixed π β πΏ2(Ξ©), if βπ’βπΏ2 β βthen πΉ(π’) β β. This implies that all the level sets πΉ πΌ are bounded. Since πΏ2(Ξ©)is a Hilbert space all bounded sequences contain a weakly convergent subsequence.Thus all the level sets πΉ πΌ are weakly sequentially pre-compact.
3.2.3 Lower semi-continuityThe lower semi-continuity is the most tricky part, and this is where we will takesome shortcuts. Lower semi-continuity for a functional πΉ at a point π’ meansthat at points π’π close to π’, the functional takes values either close to or aboveπΉ(π’). More specifically, for every sequence π’π converging to π’, we have πΉ(π’) β€lim infπ πΉ(π’π). For a function π βΆ β β β this can be visualized as in Figure 3.3.
18 CHAPTER 3. CONTINUOUS FORMULATION
Since our space πΏ2(Ξ©) is of infinite dimensions things become a little prob-lematic here. The problem lies in the fact that a functional which is continuouswith respect to sequences is not necessarily continuous with respect to the under-lying topology. In other words, in these spaces, there can be a difference betweensequential continuity and topological continuity. Topological continuity impliessequential continuity, but the converse does not hold. One way to get around thiswould be to consider topological nets, an extension of sequences, but for simplic-ity, and because it might not add much to the understanding of the restorationmethod, we will stick to proving sequential lower semi-continuity and referring tofurther theory. For further reading on the theory of sequential versus topologicalcontinuity see for example Megginsonβs book on Banach space theory [11].
The mapping π’ β¦ β«β¦ π’π ππ₯ is weakly continuous for all π β πΏ2(Ξ©). Note that
when we write weakly continuous it is not a weaker version of continuity, but rathercontinuity in the weak topology, and the same goes for weak lower semi-continuity.
Before arguing that our own functional is sequentially weakly lower semi-continuous, we present a needed result.
Lemma 3.2. Assume that the functional πΉ βΆ πΏ2(Ξ©) β β is defined by
πΉ = supπ
πΉπ (3.17)
where all the πΉπ are sequentially weakly lower semi-continuous, then πΉ is sequen-tially weakly lower semi-continuous, meaning that for any sequence π’π β π’ wehave πΉ(π’) β€ lim infπ πΉ(π’π).
Proof. For any sequence π’π β π’ in πΏ2(Ξ©) we have
πΉ(π’) = supπ
πΉπ(π’) β€ supπ
lim infπββ
πΉπ(π’π) (3.18)
from the sequential weak lower semi-continuity of πΉπ. Using that lim infπββ π’π =supπ inf πβ₯π π’π, we obtain
πΉ(π’) β€ supπ
supπ
infπβ₯π
πΉπ(π’π)
= supπ
supπ
infπβ₯π
πΉπ(π’π)
β€ supπ
infπβ₯π
supπ
πΉπ(π’π)
= lim infπββ
πΉ(π’π)
(3.19)
which proves that πΉ is sequentially weakly lower semi-continuous.
3.3. ANISOTROPIC COAREA FORMULA 19
In our functional in (3.4), we first consider the fidelity term, and rewrite it asa supremum
β«β¦
(π’ β π)2 ππ₯ = sup {β«β¦
(π’ β π)π ππ₯ βΆ π β πΏ2(Ξ©), |π(π₯)| β€ |π’(π₯) β π(π₯)|} (3.20)
As the map π’ β¦ β«β¦(π’βπ£)π ππ₯ is continuous in the weak topology, the fidelity termis thus a supremum of weakly continuous functionals, and is thus by Lemma 3.2sequentially lower semi-continuous.
For the regularization term the approach is similar. With our extended defini-tion from (3.3), we have
TVπ΄(π’) = sup {β«β¦
π’ div π ππ₯ βΆ π β πΆβπ (Ξ©, β2), βπββπ΄ β€ 1} (3.21)
This is again a supremum of weakly continuous functionals. Thus the regulariza-tion term is by Lemma 3.2 also sequentially weakly lower semi-continuous.
The sum of the two terms is trivially sequentially weakly lower semi-continuousfunctional since
πΉ1(π’) + πΉ2(π’) β€ lim infπββ πΉ1(π’π) + lim infπββ πΉ2(π’π)
= limπββ
(infπβ₯π
πΉ1(π’π) + infπβ₯π πΉ2(π’π))
β€ lim infπββ
(πΉ1(π’π) + πΉ2(π’π)) ,
(3.22)
and thus our functional is sequentially weakly lower semi-continuous.The usual ways of going from coercivity and lower semi-continuity to existence
do not work in infinite dimensions. But with sequential coercivity and sequentiallower semi-continuity in the weak topology we can conclude that we have existencefrom [12, Theorem 5.1].
3.3 Anisotropic coarea formulaThe anisotropic coarea formula we present here will allow us to write the an-isotropic total variation as an integral over the levels of the image. For a similarpresentation of the regular coarea formula for all π β BV(Ξ©) see [13].
First we define the thresholded image at level π .Definition 3.3 (Thresholded image). The thresholded image at level π is thefunction
π’π (π₯) = {1 if π’(π₯) > π ,0 otherwise. (3.23)
20 CHAPTER 3. CONTINUOUS FORMULATION
This will be used throughout the rest of the thesis. Note that given the thresh-olded image for every level, we are able to reconstruct the image as
π’(π₯) = sup {π βΆ π’π (π₯) = 1} . (3.24)The thresholded image definition also allows us to write a non-negative imageπ’ β₯ 0 as an integral over all the layers
π’(π₯) = β«β
0π’π (π₯)ππ . (3.25)
Note that (3.25) only holds for non-negative images, which complicates the proofof the anisotropic coarea formula a little.Theorem 3.4 (Anisotropic coarea formula). Given an image π’ β BV(Ξ©), theanisotropic total variation can be written as an integral over all the levels
TVπ΄(π’) = β«β
ββTVπ΄(π’π )ππ . (3.26)
For the proof we will avoid measure theory and follow a proof given in [9], butfirst we will present a necessary result from measure theory.Theorem 3.5 (Lebesgueβs Dominated Convergence theorem). Let {ππ} be a se-quence of real-valued measurable functions on a space π with measure ππ whichconverges almost everywhere to a real-valued measurable function π. If there existsan integrable function π such that |ππ| β€ π for all π, then π is integrable and
limπββ
β«π
ππ ππ = β«π
π ππ. (3.27)
For a proof and further background on measure theory and Lebesgue integra-tion theory see for example [14].
Proof of the anisotropic coarea formula. Assume that π’ β πΆ1(Ξ©) β© BV(Ξ©). Theextension to all functions π’ β BV(Ξ©) will not be considered here, but for the caseof regular total variation see [15, Theorem 5.3.3].
Proof of upper bound. Assume that π’ β₯ 0 such that the integral repre-sentation in (3.25) holds, then inserting (3.25) into the extended total variationdefinition in (3.3) gives
TVπ΄(π’) = supβπββπ΄β€1
β«β¦
(β«β
0π’π ππ ) div π ππ₯ = sup
βπββπ΄β€1β«
β¦β«
β
0π’π div π ππ ππ₯
β€ β«β
0( sup
βπββπ΄β€1β«
β¦π’π div π ππ₯) ππ = β«
β
0TVπ΄(π’π )ππ .
(3.28)
3.3. ANISOTROPIC COAREA FORMULA 21
For π’ β€ 0 we use that TVπ΄(βπ£) = TVπ΄(π£) and that TVπ΄(π + π£) = TVπ΄(π£) forany constant π. Note that βπ’ β₯ 0 and that its thresholded image (βπ’)π will beexactly the opposite of π’βπ , that is (βπ’)π = 1 β π’βπ . This allows us to show that
TVπ΄(π’) = TVπ΄(βπ’) β€ β«β
0TVπ΄((βπ’)π)ππ = β«
β
0TVπ΄(1 β π’βπ)ππ
= β«β
0TVπ΄(π’βπ)ππ = β«
0
ββTVπ΄(π’π )ππ .
(3.29)
Following from the supremum definition of the anisotropic total variation in (3.3),we obtain the inequality
TVπ΄(π’1 + π’2) = supβπββπ΄β€1
β«β¦
(π’1 + π’2) div π ππ₯
β€ supβπββπ΄β€1
β«β¦
π’1 div π ππ₯ + supβπββπ΄β€1
β«β¦
π’2 div π ππ₯
= TVπ΄(π’1) + TVπ΄(π’2).
(3.30)
Next, we write a general π’ as a difference of two positive functions π’ = π’+ β π’βwhere π’+ = max{π’, 0} and π’β = β min{π’, 0}. Inserting (3.28) and (3.29) into(3.30) we obtain
TVπ΄(π’) β€ TVπ΄(π’β) + TVπ΄(π’+) = TVπ΄(βπ’β) + TVπ΄(π’+)
β€ β«0
ββTVπ΄((βπ’β)π )ππ + β«
β
0TVπ΄(π’π +)ππ
= β«0
ββTVπ΄(π’π )ππ + β«
β
0TVπ΄(π’π )ππ = β«
β
ββTVπ΄(π’π )ππ .
(3.31)
Note that π’+ and π’β will not be differentiable everywhere, but we did not use thedifferentiability of π’ in this part of the proof.
Proof of lower bound. Define the function
π(π‘) = β«{π₯ββ¦βΆπ’(π₯)β€π‘}
ββπ’βπ΄ ππ₯, (3.32)
and note that π(β) = TVπ΄(π’) and π(ββ) = 0. Since π(π‘) is non-decreasingwith π‘, we can apply the existence theorems of Lebesgue [16, Thm. 17.12, 18.14]to conclude that πβ²(π‘) exists almost everywhere and that the following inequalityholds:
β«β
ββπβ²(π‘)ππ‘ β€ π(β) β π(ββ) = TVπ΄(π’). (3.33)
22 CHAPTER 3. CONTINUOUS FORMULATION
.. π‘..π
.π + π
.
1
(a) ππ(π‘)
.. π‘..π
.π + π
(b) πβ²π(π‘)
Figure 3.4: Visualization of the cut-off function ππ(π‘) and its derivative.
Next, fix an π β β and define the cut-off function
ππ(π‘) =β§{β¨{β©
0 if π‘ < π ,(π‘ β π )/π if π β€ π‘ < π + π,1 if π‘ β₯ π + π,
ππβ²(π‘) =β§{β¨{β©
0 if π‘ < π ,1 if π < π‘ < π + π,0 if π‘ > π + π,
(3.34)
visualized in Figure 3.4. By composing the function ππ with our image π’ and usingGreenβs formula, for example from [8, Corollary 9.32] we obtain
β«β¦
βππ(π’) div π ππ₯ = β«β¦
ππβ²(π’)βπ’ β π ππ₯ =1π β«{π
3.3. ANISOTROPIC COAREA FORMULA 23
From (3.36) we then obtain
πβ²(π ) β₯ β β«β¦
π’π div π ππ₯. (3.38)
As this holds for any βπββπ΄ β€ 1, we get from the extended total variation definitionin (3.3) that πβ²(π ) β₯ TVπ΄(π’π ) almost everywhere and conclude using (3.33) that
TVπ΄(π’) β₯ β«β
ββπβ²(π‘)ππ‘ β₯ β«
β
ββTVπ΄(π’π )ππ . (3.39)
Combining the upper and lower bounds just proved, we have equality.
This coarea formula is our first step in transforming the anisotropic total vari-ation into an easily discretizable expression. It allows us to consider each level πseparately when calculating the anisotropic total variation.
The anisotropic total variation of the thresholded images occurring in theanisotropic coarea formula is very much related to the size of the boundary ofthe level set, as the only variation in a characteristic function occurs at the bound-ary of the set. This is why we introduce the following definition of the anisotropicset perimeter.
Definition 3.6 (The anisotropic set perimeter). Given an anisotropy tensor π΄the anisotropic perimeter of a set π in Ξ© is defined as
Perπ΄(π; Ξ©) = TVπ΄(ππ). (3.40)The anisotropic set perimeter is not like the regular set perimeter and does not
measure the length of the boundary of the set, but it can for sufficiently nice levelsets be calculated in the following way
Perπ΄({π’ > π }; Ξ©) = TVπ΄(π’π )
= supβπββπ΄β€1
β«β¦
π’π div π ππ₯
= supβπββπ΄β€1
β«{π’>π }
div π ππ₯
= supβπββπ΄β€1
β«π{π’>π }
ππ β π ππ‘
= supβπββ€1
β«π{π’>π }
ππ β π΄1/2π ππ‘
= β«π{π’>π }
βππ π΄ππ ππ‘.
(3.41)
24 CHAPTER 3. CONTINUOUS FORMULATION
.. π₯.
π¦
.....
π
.
π
.π
Figure 3.5: The blue line is parametrized by the angle π and the distancefrom the origin to the line π, or alternatively, the pair (π, π).
Here, ππ is the unit exterior normal of the level set {π’ > π }. Note that becauseof the compact support of π in Definition 3.1, the parts of the boundary of π thatoverlap with the boundary of Ξ© will not be included in the perimeter.
Exterior normals and perimeters of level sets of any function π’ β BV(Ξ©) willnot be considered here, but can for the isotropic case be found in for example [15,Section 5.4 and 5.5].
Using the anisotropic coarea formula and inserting the anisotropic perimeterdefinition we transform the anisotropic total variation and are left with the problemof minimizing the following functional
πΉ(π’) = β«β¦
(π’ β π)2 ππ₯ + π½ β«β
ββPerπ΄({π’ > π}; Ξ©)ππ. (3.42)
The transformation is motivated by our upcoming anisotropic CauchyβCrofton in-tegration formula, and the discretization, where an approximation of the perimeterwill be computed using a graph cut machinery.
3.4 Anisotropic CauchyβCrofton formulaIn the fields of integral geometry and geometric measure theory there are a numberof interesting integral formulas. Several of them fall in a category often referredto as CauchyβCrofton style formulas, and give ways to measure geometric objectsusing the set of all lines in the plane. The formulas presented here will give a wayto measure the length of a curve by counting the times it intersects lines in the setof all lines. The first formula will be for the isotropic case, and we will use it toprove the anisotropic formula following it.
3.4. ANISOTROPIC CAUCHYβCROFTON FORMULA 25
We write β for the set of all lines in the plane, and parametrize them as shownin Figure 3.5. A line is parametrized by the angle π β [0, 2π) of the normal goingto the origin, and the distance π β [0, β) from origin to the line. Sometimesit is more convenient to consider a unit vector π giving the direction of the lineinstead of the angle parameter π. We denote a line by βπ,π = βπ,π where π is aunit vector along the line, i.e. π = (β sin π, cos π)π . By defining the measure onthis set πβ = ππ ππ we are ready to introduce the CauchyβCrofton formula. Notethat the measure πβ is invariant under rotations.
Theorem 3.7 (The Euclidean CauchyβCrofton formula). Given a differentiablecurve πΆ in β2, the length of this curve |πΆ| is related to the set of lines β as follows
β«β
#(βπ,π β© πΆ)πβ(βπ,π) = 2 |πΆ| , (3.43)
where #(βπ,π β© πΆ) is the number of times the line βπ,π intersects the curve πΆ.
Proof. See [17, Theorem 3, Section 1-7].
If our space is equipped with a metric tensor π(π₯) such that the inner productof two vectors π and π in a point π₯ is calculated as β¨π, πβ©π = β¨π, π(π₯)πβ©, then thelength of a curve πΎ parametrized by some parameter π‘ becomes
|πΎ|π = β«πΎ
ββ¨ ΜπΎ, π(πΎ(π‘)) ΜπΎβ© ππ‘. (3.44)
We will now present and prove a CauchyβCrofton formula in this case where ourdomain is equipped with a metric tensor in each point. This elegant formula isvery useful when we later will discretize our perimeter calculation. The set of linesβ is then discretized in a reasonable way, and the length of the curve πΆ can beapproximated by a sum over all these lines.
Theorem 3.8 (The anisotropic CauchyβCrofton formula). Assume that our spaceΞ© is equipped with a continuous positive definite metric tensor π(π₯), whose eigen-values are bounded by 0 < π β€ π2 β€ π1 β€ πΎ < β for all π₯ β Ξ©. The CauchyβCrofton formula for a differentiable curve πΆ of finite length then becomes
|πΆ|π = β«β
βπ₯ββπ,πβ©πΆ
det π(π₯)2 (ππ β π(π₯) β π)3/2
πβ(βπ,π). (3.45)
Proof of the anisotropic CauchyβCrofton formula. Assume first that our space isequipped with a constant metric tensor π . The length of a curve in this space
26 CHAPTER 3. CONTINUOUS FORMULATION
can be calculated by transforming the curve and applying the Euclidean CauchyβCrofton formula
|πΆ|π = β«πΆ
ββ¨ ΜπΆ, π ΜπΆβ© ππ‘ = β«πΆ
ββ¨π 1/2 ΜπΆ, π 1/2 ΜπΆβ© = β£π 1/2πΆβ£ (3.46)
= β«β
#(βπ,π β© π 1/2πΆ) πβ(βπ,π) (3.47)
= β«β
#(πβ1/2βπ,π β© πΆ)πβ(βπ,π) (3.48)
= β«β
#(ππ,π β© πΆ) β£π½π(βπ,π)β£ πβ(ππ,π). (3.49)
Here π½π(βπ,π) is the Jacobian of the coordinate transformation πΉ βΆ β β β, whichmaps βπ,π β¦ π 1/2βπ,π.
We will now compute the Jacobian π½π(βπ,π). As π β β2Γ2 is symmetric,so is π 1/2, and it admits a decomposition π 1/2 = πΞ£ππ where the componentscorrespond to the following coordinate transformations
π(βπ,π) = βπ+π,π = βππ,π (3.50)ππ (βπ,π) = βπβπ,π = βππ π,π (3.51)
Ξ£ = (π1 00 π2) = (βπ1 00 βπ2
) (3.52)
As π and ππ correspond to rotations and our measure β is invariant under rota-tions, π and ππ do not have direct contributions to the Jacobian. They do howeveraffect the input angle of the operator Ξ such that π½π(βπ,π) = π½Ξ£2(ππ βπ,π). Thuswe will now compute π½Ξ£2(βπ,π). Given a line
βπ,π = (π β cos ππ β sin π) + β (
β sin πcos π ) , (3.53)
the operator Ξ£ transforms it into
Ξ£βπ,π = (π1π β cos ππ2π β sin π
) + β (βπ1 sin ππ2 cos π) , (3.54)
which equals the line βπ,π with
π = arctan (π1π2tan π) (3.55)
π = β¨(π1π β cos ππ2π β sin π) , (cos πsin π)β© = π1π β cos π β cos π + π2π β sin π β sin π. (3.56)
3.4. ANISOTROPIC CAUCHYβCROFTON FORMULA 27
As πππ = 0, the Jacobian becomes β£π½Ξ£2(βπ,π)β£ = πππ β πππ. Differentiation yields
πππ =π1π2 sec2 π
1 + π21π22 tan2 π
= π1π2π21 sin2 π + π22 cos2 π, (3.57)
πππ = π1 cos π β cos π + π2 sin π β sin π. (3.58)
In the expression for πππ we insert π from (3.55) and use that sin(arctan(π₯)) =π₯/
β1 + π₯2 and that cos(arctan(π₯)) = 1/
β1 + π₯2 to obtain
πππ =π1 cos π + π2 sin π π1π2 tan π
β1 + π21π22 tan2 π
= π1π2βπ21 sin2 π + π22 cos2 π
. (3.59)
If π = (ππ₯, ππ¦)π is a unit vector along the line βπ,π = βπ,π then
β£π½Ξ£2(βπ,π)β£ =π21π22
(π21 sin2 π + π22 cos2 π)3/2 =
π21π22(π21π2π₯ + π22π2π¦)
3/2 =det Ξ£2
(ππ β Ξ£2 β π)3/2 .
(3.60)We are interested in the Jacobian of the whole transformation π½Ξ£2(ππ βπ,π), so allthat is left to do is insert ππ βπ,π to obtain
β£π½π(βπ,π)β£ = β£π½Ξ£2(ππ βπ,π)β£ =det π
(ππ π β Ξ£2 β ππ π)3/2= det π
(ππ β π β π)3/2(3.61)
We have now proved that for a constant metric tensor π , the length of the differ-entiable curve πΆ with regards to this tensor can be calculated as
|πΆ|π = β«πΆ
ββ¨ ΜπΆ, π ΜπΆβ© ππ‘ = β«β
#(βπ,π β© πΆ)det π
(ππ β π β π)3/2πβ(βπ,π). (3.62)
Further we argue that the similar formula in (3.45) holds for a non-constant butcontinuous metric tensor π(π₯). By partitioning the domain into disjoint sets ππsuch that Ξ© = βͺπππ, we make a piecewise constant approximation ππ(π₯) suchthat if π₯ β ππ then ππ(π₯) = π(π₯π) for some fixed π₯π β ππ. We then approximate(3.62) by
|πΆ|ππ = βπβ«
β#(βπ,π β© πΆ β© ππ)π€π(π)πβ(βπ,π) (3.63)
where π€π is the weight-function used in the set ππ, that is,
π€π(π) =det π(π₯π)
(ππ β π(π₯π) β π)3/2 . (3.64)
28 CHAPTER 3. CONTINUOUS FORMULATION
We further simplify the approximation by introducing the global weight-functionπ€π(π, π₯) which is equal to π€π(π) when π₯ β ππ. It can be written as
π€π(π, π₯) =det ππ(π₯)
(ππ β ππ(π₯) β π)3/2 . (3.65)
Using this weight in (3.63) we can get rid of the sum over the partition π and forma sum of all intersection point of πΆ and the line βπ,π currently being integratedover. The approximation becomes
|πΆ|ππ = βπβ«
ββ
π₯ββπ,πβ©πΆβ©πππ€π(π, π₯)πβ(βπ,π)
= β«β
βπ₯ββπ,πβ©πΆ
π€π(π, π₯)πβ(βπ,π).(3.66)
Now it only remains to show that the left- and right-hand side of (3.66) convergesto the left- and right-hand side of (3.45).
As our partition π is refined, the weight π€π(π₯) converges pointwise to thecontinuously varying weight
π€(π, π₯) = det π(π₯)(ππ β π(π₯) β π)3/2
(3.67)
found in (3.45).Recall from (3.44) that the left-hand side is calculated as
|πΆ|ππ = β«πΆβ£ ΜπΆ(π‘)β£
ππππ‘ = β«
πΆβ ΜπΆ(π‘)π ππ(πΆ(π‘)) ΜπΆ(π‘) ππ‘. (3.68)
We know that ππ(π₯) converges pointwise to π(π₯), and thus | ΜπΆ(π‘)|ππ convergespointwise to | ΜπΆ(π‘)|π . We have assumed bounds on the eigenvalues of π(π₯) suchthat, according to the Rayleigh principle
πΎ β₯ π1 = maxπππ ππ(π₯)π
ππ π (3.69)
and therefore we have the bound
ππ ππ(π₯)π β€ πΎ βπβ2 , βπ. (3.70)
Thus the integrand of (3.68) is bounded by π(π‘) = (πΎ β ΜπΆ(π‘)π ΜπΆ(π‘))1/2. We knowthat π(π‘) is integrable as its integral is exactly
βπΎ |πΆ| and we have assumed that
3.4. ANISOTROPIC CAUCHYβCROFTON FORMULA 29
the curve is of finite length. This means we can apply Lebesgueβs dominatedconvergence theorem to see that |πΆ|ππ β |πΆ|π .
We apply the same theorem to show that the right-hand side of (3.66) con-verges. Recall the definition of π€π in (3.65). The numerator is equal to π21π22 =π1π2 and is by assumption bounded from above by πΎ2.
Next we need to bound ππ ππ(π₯)π away from zero. According to the Rayleighprinciple
π2 = minβπβ=1 ππ ππ(π₯)π (3.71)
and thus ππ ππ(π₯)π β₯ π2 β₯ π. The weight function π€π is then bounded such that
βπ₯ββπ,πβ©πΆ
π€π(π, π₯) β€ βπ₯ββπ,πβ©πΆ
πΎ2π3/2 =
πΎ2π3/2 β #(βπ,π β© πΆ) =βΆ π(βπ,π). (3.72)
This is integrable following from the Euclidean CauchyβCrofton formula in Theo-rem 3.7 and the fact that we assumed πΆ to be of finite length:
β«β
π(βπ,π)πβ(βπ,π) =πΎ2π3/2 |πΆ| < β. (3.73)
Thus we can apply the dominated convergence theorem again and conclude that
β«β
βπ₯ββπ,πβ©πΆ
π€π(π, π₯)πβ(βπ,π) β β«β
βπ₯ββπ,πβ©πΆ
π€(π, π₯)πβ(βπ,π) (3.74)
whichβas both sides of the equality in (3.66) have been shown to convergeβleavesus with what we wanted to prove
|πΆ|π = β«β
βπ₯ββπ,πβ©πΆ
det π(π₯)2 (ππ β π(π₯) β π)3/2
πβ(βπ,π). (3.75)
With the anisotropic coarea formula in Theorem 3.4 we have a way to calculatethe anisotropic total variation by integrating the anisotropic perimeter of each levelset of the image. We will now see how the anisotropic CauchyβCrofton formulacan help us calculate the perimeters of the level sets. In the Euclidean case, whichhere would amount to setting the anisotropy tensor π΄ equal to the identity matrixπΌ , the perimeter coincides nicely with the length of the boundary curve, assumingsome regularity for the boundary. In the general case we need to be more careful.As can be seen in (3.41), the anisotropic perimeter is calculated by integratingthe norm of the normal vector around the boundary, while the anisotropic curve
30 CHAPTER 3. CONTINUOUS FORMULATION
length in (3.44) is the integral of the norm of the tangent vector of the curve. Thusa 90Β° rotation separates the two.
If π is a 90Β° rotation matrix we have
Perπ΄(π; Ξ©) = β«ππ
ββ¨πππ , π΄(π₯)πππβ© ππ‘
= β«ππ
ββ¨ππππ , ππ΄(π₯)π π ππππβ© ππ‘.(3.76)
We simplify the equation by defining the metric tensor π(π₯) = ππ΄(π₯)π π andletting πΎ = ππ β© Ξ© be an arclength parametrization of the boundary of π thatdoes not overlap with the boundary of Ξ©
Perπ΄(π; Ξ©) = β«πΎ
ββ¨ ΜπΎ, π(π₯) ΜπΎβ© ππ‘. (3.77)
Now we make sure that all the assumptions of the anisotropic CauchyβCroftonformula in Theorem 3.8 are fulfilled so that it can be applied to the curve lengthintegral we have constructed in (3.77).
The structure tensor is constructed as described in Section 3.1.1
ππ(π₯) = (πΎπ β (βππ β βππ)) (π₯). (3.78)
Because of the convolutions with the Gaussian function, this is a smooth mapfrom Ξ©Μ to β2Γ2. As we can see in (3.6), the eigenvalues depend continuously onthe coefficients of the elements in the structure tensor ππ(π₯). The extreme valuetheorem states that a continuous real-valued function on a nonempty compactspace is bounded above. Thus the eigenvalues π1 β₯ π2 of ππ(π₯) are boundedabove. Moreover, by the construction in (3.10), there exists uniform bound π suchthat the smallest eigenvalue π1 of the anisotropy tensor π΄(π₯) is bounded awayfrom zero, as
π1 = (1 +(π1 β π2)2
π2 )β1
β₯ (1 + π21
π2 )β1
β₯ π > 0. (3.79)
Hence our metric tensor π(π₯) = ππ΄(π₯)π π is continuous and positive definite withbounded eigenvalues π β€ π1 β€ π2 β€ πΎ = 1 and thus the curve length calculationin (3.77) fulfills all the assumptions of the anisotropic CauchyβCrofton formula inTheorem 3.8. Hence we can apply the formula to calculate the perimeter in (3.77)as
Perπ΄(π; Ξ©) = β«β
βπ₯ββπ,πβ©πΎ
det π(π₯)2 (ππ β π(π₯) β π)3/2
πβ(βπ,π)ππ , (3.80)
3.4. ANISOTROPIC CAUCHYβCROFTON FORMULA 31
where πΎ = ππ β© Ξ©. Note that π does not affect the determinant, i.e. det π΄ =det ππ΄π π = det π , and from our decomposition in (3.10) we see that the trans-formation ππ΄π π β π actually amounts to switching the two eigenvalues π1 andπ2 in Ξ£.
This concludes the treatment of the continuous problem. We have seen how theanisotropic coarea formula in Theorem 3.4 allows us to calculate the anisotropictotal variation as an integral of the perimeter of all the level sets. Through theanisotropic CauchyβCrofton formula in Theorem 3.8 these perimeters are calcu-lated by an integral over the set of all lines. We are then left with the functional
πΉ(π’) = β«β¦
(π’ β π)2 + π½ TVπ΄(π’), (3.81)
where
TVπ΄(π’) = β«β
βββ«
ββ
π₯ββπ,πβ©πΎπ
det π(π₯)2 (ππ β π(π₯) β π)3/2
πβ(βπ,π)ππ , (3.82)
and πΎπ = π{π’ > π } β© Ξ©. Within the restrictions that these theorems put on thetensor π(π₯), we have chosen a construction where one eigenvalue is always 1,while the other varies from 1 in smooth areas towards 0 around edges, with thecorresponding eigenvector perpendicular to the edge.
Chapter 4Discrete formulation
The whole transformation from the initial functional in (3.4), through the an-isotropic coarea formula and the CauchyβCrofton formula was motivated by thediscrete formulation which will be described here. After discretizing the functional,we will see how a graph cut approach can be used to find a global minimizer inpolynomial time.
4.1 DiscretizationAssume that our discrete images are given on a uniform grid π’, where each gridpoint is called a pixel. The image is a function giving each pixel a value in the setof levels π« = {0, β¦ , πΏ β 1}, such that π’ βΆ π’ β π«. This is a reasonable assumptionfor digital grayscale images. Thus, when discretizing the functional in (3.81), wehave to consider that our images now have both discrete domain and co-domain.
The integrals in (3.81) will be approximated by discrete sums. First the fidelityterm is discretized without too much trouble, while with the regularization term,there is more choice as to how to discretize the set of lines β. In the end we willverify that our discretization is consistent with the continuous functional.
4.1.1 Fidelity termSince it is not affected by our introduction of the anisotropy tensor, the fidelityterm can be discretized as in my project work [1]. For some pixel position π₯ β π’and some level value π β π«, we define the following function
ππ₯(π) = |π β ππ₯|2 (4.1)
32
4.1. DISCRETIZATION 33
which is the value of the fidelity term if we were to give π’π₯ a value of π. Thisallows us write
β«β¦
|π’ β π|2 ππ₯ β βπ₯βπ’
|π’π₯ β ππ₯|2 Ξπ₯ = βπ₯βπ’
ππ₯(π’π₯)Ξπ₯. (4.2)
The reason we introduce the function ππ₯(π) is that we want to apply the followingdecomposition formula, which holds for any function πΉ(π) taking values π β π«:
πΉ(π) =πβ1βπ=0
(πΉ(π + 1) β πΉ(π)) + πΉ(0)
=πΏβ2βπ=0
(πΉ(π + 1) β πΉ(π))πΌ(π < π) + πΉ(0),(4.3)
where πΌ(π₯) is the indicator function that takes the value 1 if π₯ is true, and 0 if π₯is false. Since πΌ(π < π’π₯) = π’ππ₯ we rewrite (4.2) and obtain
βπ₯βπ’
|π’π₯ β ππ₯|2 = βπ₯βπ’
ππ₯(π’π₯) =πΏβ2βπ=0
βπ₯βπ’
(ππ₯(π + 1) β ππ₯(π))π’ππ₯ + ππ₯(0). (4.4)
As our domain is discretized uniformly, we drop the constant Ξπ₯, and absorbit into our parameter π½ of (3.81). Note that since our image takes values inπ« = {0, β¦ , πΏ β 1}, the thresholded image π’πΏβ1 is equal to zero everywhere.
4.1.2 Regularization term
Discretizing the regularization term is more challenging. We introduce the discretelevels to get
β«β
ββPerπ΄({π’ > π}; Ξ©)ππ β
πΏβ2βπ=0
Perπ΄({π’ > π}; Ξ©)Ξπ. (4.5)
As with the Ξπ₯ difference, we can absorb the Ξπ difference into the π½ parameter of(3.81). The perimeter is then calculated using a discretized version of the CauchyβCrofton formula introduced in Theorem 3.8. Again, we stop the sum at πΏβ2 sincethe level set {π’ > πΏ β 1} is empty and has zero perimeter.
34 CHAPTER 4. DISCRETE FORMULATION
.......................................................
Ξπ
(a) The discrete set of lines βπ· visual-ized as a neighborhood.
......................................
Ξπ
(b) One family of lines having the sameπ parameter.
Figure 4.1: The set of lines β is discretized to βπ· where each line belongsto a family given by π, the angle parameter.
Discrete anisotropic CauchyβCrofton formula
By approximating the integral Theorem 3.8 by a discrete sum we obtain the ap-proximation
|πΆ|π = β«β
βπ₯ββπ,πβ©πΆ
det π(π₯)2 (ππ β π(π₯) β π)3/2
πβ(βπ,π)
β ββπ,πββπ·
βπ₯ββπ,πβ©πΆ
det π(π₯)2 (ππ β π(π₯) β π)3/2
Ξβπ,π
= βπ
βπ
βπ₯ββπ,πβ©πΆ
det π(π₯)2 (ππ β π(π₯) β π)3/2
Ξπ Ξπ.
(4.6)
The set of lines β has been discretized into the set βπ·. Note that πΆ is still adifferentiable curve, not yet discretized. Being a difference in the π parameter ofour line discretization in Figure 3.5, the difference Ξπ represents the distance fromone line to the next in a line family as shown in Figure 4.1b, and thus dependson the angle π considered. The difference Ξπ is taken to be the average of thedistance to the two neighboring line families as shown in Figure 4.1a, and thusalso depends on π.
The choice of our discrete set of lines βπ· is important, as it will decide theaccuracy of our approximation. We need some sensible restrictions on the set
4.1. DISCRETIZATION 35
...........
π
.
π
Figure 4.2: Here our intersection approximation would not be correct, asonly the intersection with edge π is counted in (4.15), even though the curveintersects edge π twice.
βπ· to simplify the further discussion. All lines intersect at least two grid points,and from the periodicity of our grid they thus intersect an infinite number of gridpoints. This puts some restrictions on the angles we can choose. For each angleincluded, we include all possible lines of that family, meaning there are no gridpoints without a line of that family intersecting it.
The set of lines can then be represented by the neighborhood of a pixel as shownin Figure 4.1a. We write π©(π₯) for the neighborhood of grid point π₯. Extendingthe edges shown in Figure 4.1a gives all lines going through the point considered.Figure 4.1b shows all lines of a given family, i.e. lines having the same angleparameter π.
Thus not only have we discretized the set of lines, but each line is made up ofedges going from one grid point to the next. We will denote such an edge by π orπππ when its endpoints are π, π β π’. Thus we rewrite the discretization of (4.6),and sum over all the edges in the discretization βπ· to obtain
|πΆ|π β βπ
βπ₯βπβ©πΆ
det π(π₯) βπβ3
2 (ππ β π(π₯) β π)3/2Ξπ Ξπ. (4.7)
This is beginning to look like something we can calculate. One difficulty is findingthe intersections π β© πΆ. The exact calculations of these points will not fit into ourgraph cut framework later, and thus for an edge π we will only consider the questionof βdid π cross πΆ or not?β This amounts to checking whether the terminals of πlie on different sides of the curve πΆ. This approximation is exact for zero or oneintersection points, but will, as we see in Figure 4.2, be wrong when we have more.
The second difficulty is that in the discrete setting, we will only have an ap-proximation of the metric tensor π(π₯) for each point π₯ β π’, and it is thus notavailable for arbitrary intersection points in Ξ©. For an intersection of edge π wewill utilize the average of the tensor in the two endpoints of the edge. Thus for an
36 CHAPTER 4. DISCRETE FORMULATION
.........................
Figure 4.3: A visual argument showing that πΏ2 = Ξπ βπβ. If extendedto the whole plane, there will be the same amount of blue squares as redrectangles as each grid point is the upper left corner of both a blue and ared rectangle. Thus their areas must be equal.
intersection point π₯ somewhere on the edge πππ, we approximate the metric tensorby
π(π₯) β π(πππ) =π(π) + π(π)
2 , (4.8)
the component-wise average of the tensors in the two end points of the edge. Recallthat we have already done some spatial smoothing of the structure tensor in (3.5)corresponding to the integration scale π, and thus we expect the tensors π(π) andπ(π) to be similar for edges π of reasonably short length.
We also remark that using the Rayleigh principle, it is easy to conclude thatthe eigenvalues of the tensor approximation π(πππ) are bounded below and aboveby the smallest and largest eigenvalues of π(π) and π(π).
We have now almost arrived at our final curve length approximation, but weneed a way to calculate the inter-line distance Ξπ which will be provided by thefollowing lemma.
Lemma 4.1. For each family of lines given by an angle parameter π in the uniformgrid of size πΏ we have the relation
πΏ2 = βπβ Ξπ. (4.9)
Proof. Consider a line β intersecting the point in the grid given by the indices(π, π) β β€2. The distance Ξπ from this line β to the neighboring lines can then becalculated as a minimum over the distance to all other grid points.
The lines are split into edges π = (πΏπ , πΏπ‘)π where π , π‘ β β€ are coprime suchthat π does not intersect any other grid points than its two endpoints.
4.1. DISCRETIZATION 37
We then calculate the minimal distance to a grid point not on the line β as
Ξπ = min(πβ²,πβ²)βπ’\β
{β¨πΏ[π β πβ², π β πβ²], πβ
βπβββ©}
= min(πβ²,πβ²)βπ’\β
{πΏ2 β π‘(π β πβ²) β π (π β πβ²)βπβ } .(4.10)
Since π and π‘ are coprime, there exists π, π β β€ such that ππ‘ β ππ = 1, and sincethe Ξπ cannot be zero, we obtain
Ξπ = πΏ2
βπβ. (4.11)
A visual argument for the same result can be seen in Figure 4.3.
Inserting Ξπ = πΏ2/ βπβ and the tensor approximation of (4.8) into the curvelength approximation of (4.7) we obtain
|πΆ|π β βπβ©πΆ
det π(π) βπβ2 πΏ2 Ξπ2 (ππ β π(π) β π)3/2
, (4.12)
where the sum is over all edges crossing the curve.The curve length we initially wanted to calculate was the level set perimeter
Perπ΄({π’ > π}; Ξ©) in (4.5). To find edges that crosses this boundary curve, weidentify the edges that have one terminal inside the level set, and the other outside.Thus we rewrite the sum over π β© πΆ such that
Perπ΄({π’ > π}; Ξ©) β βπππ
β£π’ππ β π’ππ β£det π(πππ) βπππβ2 πΏ2 Ξπ2 (ππππ β π(πππ) β πππ)
3/2 . (4.13)
The absolute value β£π’ππ β π’ππ β£ is 1 if one of π and π lie inside the level set and theother lies outside, and 0 otherwise. In other words the absolute value is one if πππcrosses the perimeter of {π’ > π} an odd number of times, and zero otherwise.
Thus we have arrived at our final discretization, which takes the form
πΉ(π’) = βπ
βπ₯
πΉ ππ₯ (π’ππ₯) + π½ βπ
β(π₯,π¦)
πΉ ππ₯,π¦(π’ππ₯, π’ππ¦) =βΆ πΉ π(π’π), (4.14)
πΉ ππ₯ (π’ππ₯) = (ππ₯(π + 1) β ππ₯(π)) β π’ππ₯,
πΉ ππ₯,π¦(π’ππ₯, π’ππ¦) = β£π’ππ₯ β π’ππ¦ β£det π(ππ₯π¦) β₯ππ₯π¦β₯
2 πΏ2 Ξπ2 (πππ₯π¦ β π(ππ₯π¦) β ππ₯π¦)
3/2 .(4.15)
Recall that ππ₯(π) = |π β ππ₯|2.
38 CHAPTER 4. DISCRETE FORMULATION
If we minimize πΉπ to obtain π’π for each level separately, it is obvious thatwe will also minimize the sum over all πΉπ. However, it is not guaranteed thatthe obtained thresholded images π’π can be combined to make an output image π’.They were defined as π’π = ππ’>π, so we need them to be monotonically decreasingin increasing level values, i.e.
π’ππ₯ β₯ π’ππ₯, βπ β€ π, βπ₯ β π’. (4.16)
Later we will present two graph cut algorithms that find the thresholded imagesminimizing each level, while guaranteeing that they meet this requirement.
Consistency
Consistency relates to whether a solution to the continuous problem fits in the dis-cretized equation, in other words, whether the discretized equation approximatesthe continuous one.
It is obvious that the discretization of the fidelity term in (4.2) is consistent.The sum is a midpoint rule approximation of the integral. As the grid is refinedand πΏ β 0 the sum will converge to the integral.
For the regularization term we will argue that for a differentiable curve πΆ, thediscretization of our domain Ξ© and the set of lines β gives a discrete CauchyβCrofton formula that is consistent with the continuous one. We will show that foran increasingly refined discrete domain π’, there exists a choice for βπ· that leads toa consistent CauchyβCrofton formula. For convenience we will use a neighborhoodrepresentation of βπ· similar to the one in Figure 4.1a.
If we consider the edges π of each family separately, the curve length approxi-mation in (4.12) can be written
|πΆ|π = β«π
β«π
βπ₯ββπ,πβ©πΆ
det π(π₯)2 (ππ β π(π₯) β π)3/2
ππ ππ
β βπ
βπ
βππ,πβ©πΆ
det π(ππ,π) β₯ππ,πβ₯3
2 (πππ,π β π(ππ,π) β ππ,π)3/2 Ξπ Ξπ.
(4.17)
As described in the construction of this formula, there are four main approxima-tions used. Firstly there is the fact that we do not consider the actual intersectionpoints, but only whether an edge crosses the curve or not. Secondly we have thetensor which is averaged as in (4.8). And then we have the discretizations of ourtwo line parameters π and π.
It is intuitive that if sup βπβ β 0, the number of times the differentiable curveπΆ can cross a given edge decreases. We will not prove convergence, but ratherassume that the special cases where it might not work, are negligible.
4.1. DISCRETIZATION 39
..............
βπ
Figure 4.4: The discretization in the π dimension can be regarded as amidpoint rule approximation of the integral, since the difference Ξπ thesame for all lines in one line family.
...
ππβ1
.
ππ
.
ππ+1
.
Ξππ
Figure 4.5: We showed that the maximal angle difference Ξππ goes tozero. The discretization in the π dimension can be viewed as a rectangleapproximation rule of the integral, as the summand is evaluated at ππ,somewhere inside the interval Ξππ.
Further, if sup βπβ β 0 it is obvious that the tensor average in (4.8) convergesto the tensor in the intersection point.
Consider now the discretization in π. For each π parameter, our discretizationin the π dimension can be regarded as a midpoint rule as shown in Figure 4.4.Thus if sup Ξπ β 0, this part of the discretization is consistent.
The discretization in the π dimension can also be regarded as a version of therectangle method, although not the midpoint rule. As shown in Figure 4.5, thecircle is split into intervals
[ππβ1 + ππ2 ,ππ + ππ+1
2 ] (4.18)
of length Ξππ = (ππ+1 + ππβ1)/2. The summand is evaluated at ππ, somewhereinside the interval. Thus if sup Ξππ β 0, this discretization is also consistent.
To show that all these properties can be fulfilled, we look at a particular neigh-borhood stencil construction. Consider a square centered around a grid point with
40 CHAPTER 4. DISCRETE FORMULATION
....................................................................
π
.
π
.
βπΏ
Figure 4.6: To show that we have a consistent discretization of theCauchyβCrofton integral formula, we construct a discrete set of lines βπ·such that the length of the edges βπβ, the angle differences Ξπ (here π andπ) and the distance between lines Ξπ goes to zero as πΏ β 0.
side lengthsβ
πΏ as shown in Figure 4.6. As πΏ goes to zero, the size of this squarewill go to zero. Inside this square we can fit a square of π2 = β1/
βπΏβ2 grid points.
This means that the number of grid points along the outer edge of this square πgoes to infinity.
We include all grid points inside the square in our neighborhood, except formultiple points that lie on the same line from the origin. If two or more grid pointslie on the same line, we include only the one closest to the origin. This impliesthat for each grid point along the outer edge of this square, we include in ourneighborhood a grid point having the same angle π to the π₯-axis.
This construction can be seen in Figure 4.6 for π = 5. The maximal anglebetween two lines ππ β ππβ1 will always be when one of ππ and ππβ1 is horizontalor vertical, shown in Figure 4.6 as the angle π. Thus the largest Ξππ will be whenππ = ππ/2 for π β β€, so around vertical and horizontal edges. The supremum canthen be calculated to be
sup Ξππ = 2 β supππ+1 β ππ
2 = arctan1/ππ/2 = arctan
2π2 β 0. (4.19)
Further we see that the edge length will be bounded by half of the diagonal ofthe square such that
βπβ β€ βπΏ/2 β 0. (4.20)And finally we know from Lemma 4.1 that for each line family πΏ2 = Ξπ βπβ andβπβ β₯ πΏ. Thus for the inter-line distance Ξππ we have
sup Ξππ = supπΏ2βπβ β€
πΏ2πΏ = πΏ β 0. (4.21)
4.2. GRAPH CUT APPROACH 41
Hence the approximation has been shown to be equivalent to well-known, andconsistent integral approximations, where the summand converges to the inte-grand, and the differences Ξπ and Ξπ go to zero. Thus the perimeter approxima-tion in (4.5) is consistent with the continuous formulation in Theorem 3.8.
Note that as we will work with digital images with fixed resolutions, we do notreally have the chance to refine our discretization. We do however have to takethese things into account when creating our neighborhood stencil, to make surethat we get a reasonable approximation of the perimeter lengths.
4.2 Graph cut approachThe discretization we arrived at in (4.15) can be minimized using graph cuts. Foreach level π, a minimum graph cut is found to produce the corresponding level set{π’ > π}. These are then combined to form the final restored image π’.
In this section we will look at how these graphs are constructed such that theirminimum cuts correspond to the minimizers of the functional πΉ π. The descriptionis taken with some small adjustments from my project work [1], and is includedhere for completeness. An implementation of the described approach can be foundin Appendix A.
4.2.1 GraphsUsing the notation of [18] we will denote a directed graph as πΊ = (π , πΈ) whereπ is a finite set of vertices, and πΈ is a binary relation on π . If (π’, π£) β πΈ we saythat there is an edge from π’ to π£ in the graph πΊ.
We introduce the non-negative capacity function π βΆ π Γ π β [0, β). Onlyedges (π’, π£) β πΈ can have a positive capacity π(π’, π£) = π > 0 and it means that itis possible to send a flow of maximum π units from π’ to π£. For convenience we willlet π(π’, π£) = 0 for any pair (π’, π£) β πΈ, and we do not allow self-loops in our graph.When a directed graph πΊ is equipped with capacity function π, one might call ita capacitated graph or a flow network, but as all our graphs will be capacitatedfrom this point, we will just call them graphs and we write πΊ = (π , πΈ, π).
There are two special vertices in the graph, the source π and the sink π‘. Con-trary to other vertices, which can neither produce nor receive excess flow, thesource can produce and the sink can receive an unlimited amount of flow. Themost basic problem in graph flow theory is