+ All Categories
Home > Documents > Basic Mathematical Toolscampar.in.tum.de/files/teaching/2013ss/BMT/exercise01...Exercises in Basic...

Basic Mathematical Toolscampar.in.tum.de/files/teaching/2013ss/BMT/exercise01...Exercises in Basic...

Date post: 12-Jun-2020
Category:
Upload: others
View: 9 times
Download: 0 times
Share this document with a friend
6
Technische Universität München SoSe 2013 Fakultät für Informatik Exercise Sheet 1 Dr. Tobias Lasser Jakob Vogel, Matthias Wieczorek, Richard Brosig April 18, 2013 Exercises in Basic Mathematical Tools We are typically using Matlab for programming assignments. Matlab is provided on several work- stations on the campus, in particular: RBG’s computer pool (MI 00.05.011 and MI 00.07.023), also reachable remotely by SSH’ing into ssh://lxhalle.informatik.tu-muenchen.de; open Matlab by issuing the com- mand matlab on the prompt LRZ (see http://www.lrz.de/services/software/compalg/matlab/) If you prefer to work on your own equipment, there are three options: TUM and Mathworks have agreed on a campus license which includes free access to Matlab for students. You can find all relevant information at https://matlab.rbg.tum.de/. In order to log in, you will need your LRZ account id (combination of 2 characters, 3 digits and 3 characters). If you are not aware of your id, log into https://campus.tum.de/, click onto ‘E-mail Addresses’ in the ‘Resources’ column, and copy the id from the ‘E-mail addresses (incoming)’ paragraph in the sub-window (without the ‘@mytum.de’ extension). Mathworks offers a discounted student version (see http://www.mathworks.com/academia/ student_version/). Use GNU’s free alternative Octave (see http://www.gnu.org/software/octave/) which is almost completely compatible to Matlab. However, it may be missing certain extensions used in the solutions. To get you started using Matlab, we provide a short programming guide on our website, and there are many more available on the web. Please also consult Matlab’s extensive help (type doc in Matlab’s command prompt). In particular, you can obtain further information about individual commands using the Matlab commands help <command> and doc <command>.
Transcript
Page 1: Basic Mathematical Toolscampar.in.tum.de/files/teaching/2013ss/BMT/exercise01...Exercises in Basic Mathematical Tools We are typically using Matlab for programming assignments. Matlab

Technische Universität München SoSe 2013Fakultät für Informatik Exercise Sheet 1

Dr. Tobias LasserJakob Vogel,

Matthias Wieczorek,Richard Brosig

April 18, 2013

Exercises in Basic Mathematical Tools

We are typically using Matlab for programming assignments. Matlab is provided on several work-stations on the campus, in particular:

• RBG’s computer pool (MI 00.05.011 and MI 00.07.023), also reachable remotely by SSH’inginto ssh://lxhalle.informatik.tu-muenchen.de; open Matlab by issuing the com-mand matlab on the prompt

• LRZ (see http://www.lrz.de/services/software/compalg/matlab/)

If you prefer to work on your own equipment, there are three options:

• TUM and Mathworks have agreed on a campus license which includes free access to Matlabfor students. You can find all relevant information at https://matlab.rbg.tum.de/.

In order to log in, you will need your LRZ account id (combination of 2 characters, 3 digitsand 3 characters). If you are not aware of your id, log into https://campus.tum.de/,click onto ‘E-mail Addresses’ in the ‘Resources’ column, and copy the id from the ‘E-mailaddresses (incoming)’ paragraph in the sub-window (without the ‘@mytum.de’ extension).

• Mathworks offers a discounted student version (see http://www.mathworks.com/academia/student_version/).

• Use GNU’s free alternative Octave (see http://www.gnu.org/software/octave/) whichis almost completely compatible to Matlab. However, it may be missing certain extensionsused in the solutions.

To get you started using Matlab, we provide a short programming guide on our website, and thereare many more available on the web. Please also consult Matlab’s extensive help (type doc inMatlab’s command prompt). In particular, you can obtain further information about individualcommands using the Matlab commands help <command> and doc <command>.

Page 2: Basic Mathematical Toolscampar.in.tum.de/files/teaching/2013ss/BMT/exercise01...Exercises in Basic Mathematical Tools We are typically using Matlab for programming assignments. Matlab

– 2 –

Assignment 1 Norm – Equality

Consider x,y ∈ R3 and the Euclidean norm as defined in the lecture. Show that

‖x−y‖= 0⇔ x = y . (1)

Hint Use the definition of the Euclidean norm and the properties of the scalar product.

Assignment 2 Cauchy-Schwary Inequality

Prove the Cauchy-Schwarz Inequality

〈x,y〉2 ≤ 〈x,x〉〈y,y〉

using the properties of the scalar product discussed in the lecture.

Hint Check out 〈x+λy,x+λy〉!

Assignment 3 Function Space

Let X = RR denote the function space of all functions f : R→ R.

a) Show that X is a vector space!

b) For each of the following subsets S ⊂ X , decide whether it is a subspace, and justify yourpoint!

(i) S := { f ∈ X | f (0) = 1+ f (1)} ⊂ X

(ii) S := { f ∈ X |2 f (−1) = f (1)} ⊂ X

(iii) S := { f ∈ X | f (−1) = 0} ⊂ X

(iv) S := { f ∈ X | f (x) = f (1− x) ∀x ∈ R} ⊂ X

(v) S := { f ∈ X | f (x3) = f (x)5 ∀x ∈ R} ⊂ X

(vi) S := { f ∈ X | f is continuous} ⊂ X

Assignment 4 Linear Dependence

Let x,y,z ∈ R3. Is it possible to write the vector v = (3,0,2)> ∈ R as linear combination of thethree other vectors, i. e.

v = λx+µy+νz

for some scalars λ,µ,ν ∈ R, given the following values?

a) x = (1,1,0)>, y = (1,0,1)>, z = (0,1,0)>

b) x = (1,1,0)>, y = (−2,−3,1)>, z = (1,0,1)>

c) x = (1,0,0)>, y = (0,0,1)>, z = (1,0,1)>

d) Which of these sets form a basis of R3?

Page 3: Basic Mathematical Toolscampar.in.tum.de/files/teaching/2013ss/BMT/exercise01...Exercises in Basic Mathematical Tools We are typically using Matlab for programming assignments. Matlab

– 3 –

Assignment 5 (O) Polar Coordinates

Motivation Intravascular ultrasound (IVUS) devices are used for generating images within ar-teries, for the diagnosis of stenoses. A catheter (top figure, left) with an ultrasound transducer isinserted into the artery, and the data is acquired by rotating the probe around its axis. This givesraw images in polar coordinates (top figure, center) which are then transformed into a Euclideanrepresentation (top figure, right) for better visualization.

x, ‖x‖ = r

ϕ

e2

e2

er

Let x = (x1,x2) ∈ R2. Further, consider the polar coordinates (r,ϕ) ∈ R2, with r denoting radiusand ϕ angle, such that x1 = r cos(ϕ) and x2 = r sin(ϕ).

a) For a given x ∈ R2 find a formula to compute r,ϕ.

b) For a given pair r,ϕ define the following vectors in R2:

er = (cos(ϕ),sin(ϕ))> eϕ = (−sin(ϕ),cos(ϕ))> (2)

Show that these two vectors represent an orthonormal basis of R2.

c) Finally, consider the following matrix:

R(ϕ) =(

cos(ϕ) −sin(ϕ)sin(ϕ) cos(ϕ)

)(3)

Show that er = R(ϕ)ex1 and eϕ = R(ϕ)ex2.

Hint The following equation might help: sin2(x)+ cos2(x) = 1

Page 4: Basic Mathematical Toolscampar.in.tum.de/files/teaching/2013ss/BMT/exercise01...Exercises in Basic Mathematical Tools We are typically using Matlab for programming assignments. Matlab

– 4 –

Assignment 6 (P) Image Filtering by Convolution

The simplest methods to manipulate images consider the intensities of single pixels (brightness,contrast, etc.), but their possible effects are limited. More versatile image operations require theconsideration of neighbor pixels. One such method is convolution with a filtering kernel, wherepixel intensities get replaced by a weighted sum of their neighbor’s intensities.

Given a discrete gray-scale image Ii1,i2 of size m1×m2, and a discrete filter mask f j1, j2 of sizen1×n2, the convolution I∗i1,i2 is defined to be

I∗i1,i2 =n1

∑j1=1

n2

∑j2=1

f j1, j2 Ii1− j1,i2− j2 ∀i1 ∈ {1, ...,m1}, i2 ∈ {1, ...,m2}

a) Familiarize yourself with Matlab’s image processing routines using the documentation:

• Image reading/writing with imread/imwrite. How are images represented? What isthe difference between a grayscale and a color image?

• RGB to gray conversion with rgb2gray, type casting with single, double (etc.).

• Pictures are shown using image, imagesc or imshow. Lines can be drawn with plot.(A hold on may be required!).

• How would you implement a change of brightness or contrast?

b) Implement a function computing the convolution of a gray-scale image with a given filteringkernel. What happens at the boundaries of the image?

c) What do you observe when testing your implementation with the following filtering kernel?

19

1 1 11 1 11 1 1

d) What is the effect of using the following matrix? What is the difference to the previous

filter?1

16

1 2 12 4 21 2 1

Note Matlab has the functions conv2 and imfilter to compute the convolution. You can usethis function to compare results, but please try to implement the convolution yourself. You cangenerate a variety of filter kernels using fspecial.

Assignment 7 (T) Change of Basis

The most famous painting Parrots in Gray has fallen down in the local art website’s gallery, andbroke into two pieces of 300×300 pixels. Being a splendid example of the naturalistic phase of awell-known artist, you need to restore it.

a) First, the two transformation matrices mapping the two pieces back to the original imageneed to be determined. Load the debris image, display it, and let the user interactively selectthe two bases of the fragments (see the ginput function). Print the two transformationmatrices on the console.

Page 5: Basic Mathematical Toolscampar.in.tum.de/files/teaching/2013ss/BMT/exercise01...Exercises in Basic Mathematical Tools We are typically using Matlab for programming assignments. Matlab

– 5 –

Parrots in Gray (before the catastrophe), pixels on canvas, 600×300 pixels.

Debris, two fragments of 300×300 pixels.

b) Next, the two transformations need to be applied to the image. Write a function acceptingan image and a transformation matrix and returning the transformed (‘warped’) image. Doyou see any strange effects, and – if so – how would you suggest to solve them?

c) Finally, add the pieces together, display your reconstruction and evaluate the quality incomparison to the original by printing meaningful statistical values on the console. Don’tforget to crop the image (see the colon operator, and vector-valued matrix indexing).

Page 6: Basic Mathematical Toolscampar.in.tum.de/files/teaching/2013ss/BMT/exercise01...Exercises in Basic Mathematical Tools We are typically using Matlab for programming assignments. Matlab

– 6 –

Workflow: Identify two local coordinate systems in the debris image (top, red and blue) usingginput, and rearrange the halves side by side (bottom).


Recommended