Assignment 1 CV1 WS16/17: This Assignment Is Due On November 14th, 2016 at 12:00
Assignment 1 CV1 WS16/17: This Assignment Is Due On November 14th, 2016 at 12:00
Assignment 1 CV1 WS16/17: This Assignment Is Due On November 14th, 2016 at 12:00
Programming exercises
For the programming exercises you will be asked to hand in Julia code. Please use version v0.5.0 of Julia as we will use it to
grade your solution. You need to comment your code in sufficient detail so that it will be easily clear to us what each part of
your code does.
Your code should display your results so that we can judge if your code works from the results alone. Of course, we will still
look at the code. You must adhere to the naming scheme for functions and files included with each problem.
Do not rename function files and do not change the given function signatures. If you feel that there is a mistake in the
assignments, ask us on Moodle.
Handing in
Please upload your solutions to Moodle. You only need to submit one solution per group. If, for whatever reason, you cannot
access Moodle get in touch with us as soon as possible.
Upload all your solution files (the writeup, .jl files, and other required files) as a single .zip or .tar.gz file. Please note
that we cannot accept file formats other than the ones specified!
Late handins
We will accept late handins, but we will take 20% of the total reachable points off for every day that you are late. Note that
even 1 minute late will be counted as being one day late! After the exercise has been discussed in class, you can no longer hand
in.
Assignment 1 – CV1 WS16/17 Page 2
Other remarks
Your grade will depend on various factors. Of course it will be determined by the correctness of your answer. But it will also
depend on a clear presentation of your results and good writing style. It is your task to find a way to explain clearly how you
solved the problems. Note that you will get grades for the solution, not for the result. If you get stuck, try to explain why and
describe the problems you encountered – you can get partial credit even if you did not complete the task. So please hand in
enough information for us to understand what you did, what things you tried, and how it worked! We will provide skeleton
code for every assignment. Please use the provided interfaces as it allows us to better understand what you did.
We encourage interaction about class-related topics both within and outside of class. However, you should not share solutions
with other groups, and everything you hand in must be your own work. You are also not allowed to plainly copy material
from the web. You are required to acknowledge any source of information that you used to solve the homework (i.e. books
other than the course books, papers, etc.). Acknowledgements will not affect your grade. Thus, there is no reason why you
would not acknowledge sources properly. Not acknowledging a source that you have used, on the other hand, is a clear violation
of academic ethics. Note that the university as well as the department is very serious about plagiarism. For more details please
see http://www.informatik.tu-darmstadt.de/index.php?id=202 and http://plagiarism.org.
Assignment 1 – CV1 WS16/17 Page 3
(a) color filter array layout. (b) interpolated pixel values; with un-
known values shown as lower case.
Notes: The file problem1.jl includes type annotations for the inputs and outputs of each function. Please stick to these
types. If you get errors from the using statements you will probably have to add the corresponding packages to your Julia
installation. The function imfilter of the Images package might be useful to solve this problem.
Then a central projection onto the xy-plane, with principal point [8; −10], focal length 8 and square pixels, is applied. The 2D
points in the image plane are thus obtained.
Assignment 1 – CV1 WS16/17 Page 4
Tasks:
You will start with the obtained 2D points and some other information to restore the original 3D coordinates of all points.
• Implement the functions cart2hom and hom2cart, which convert an arbitrary matrix of 2D or 3D points to homogeneous
coordinates and back.
• All the operations (transformations plus projection) are equal to one single perspective projection. However, doing the
computation in separate steps makes debugging easier. Compute the rotation matrices around the individual axes and the
translation. Then, compute the camera intrinsics matrix P in getprojection and use the obtained matrix to compute
the camera matrix C in getfull (all matrices in homogeneous coordinates).
• Load all the 2D points from the file obj_2d.jld with the function loadpoints. The point coordinates are given as
column vectors. Show all the points in a 2D plot.
• In the file zs.jld you can find the z-coordinates of all transformed 3D points right before the projection is applied. Load
them with loadz and compute the coordinates (namely, x and y) of these transformed 3D points in invertprojection.
• Perform the inverse transformations to get the original 3D coordinates of all points in inverttransformation. Show
these points in a 3D plot in displaypoints3d. (scatter3D of the PyPlot package may be useful, with which you can
adjust the viewpoint of the 3D plot using the rotation icon of the figure window.)
• Use the obtained 3D points, recompute the projected 2D points using the camera C in projectpoints and show them
in a new figure. Do you get the same 2D points as given?
• Briefly explain with a comment in the code why it is necessary to provide the z-coordintes of the individual points.
• Change the order of the transformations (translation and rotation). Check if they are commutative.
Tasks:
• Create in createfilters a 3×3 x-derivative filter that computes the derivative using central differences (i.e., f (x+h;y)−2h
f (x−h;y)
where h = 1) and at the same time smooths in y-direction with a 3 × 1 Gaussian filter of σ = 1.0. In other terms, you
obtain the full 3 × 3 filter by combining a 1 × 3 with a 3 × 1 filter. Also, create a corresponding y-derivative filter. Make
sure that the filters are correctly normalized.
• Use these filters to compute the x-derivatives ∂ x and y-derivatives ∂ y of the input image from above. Use imfilter to
do the filtering. Your boundary handling should be such that it replicates the pixels on the image edge. Display both
results. Note: Make sure that the sign of the derivatives is correct.
q
• Compute and display the gradient magnitude ∂x2 + ∂y2 . Detect edges by thresholding the gradient magnitude in detectedges,
i.e., check if the gradient magnitude at each pixel exceeds a certain value.
• Use non-maximum suppression to thin the obtained edges. For every edge candidate pixel, consider the grid direction
(out of 4 directions) that is “most orthogonal" to the edge. If one of the two neighbours in this direction has a larger
gradient magnitude, remove the central pixel from the edge map. Experiment with various threshold values from above
step and choose one that shows the “important" image edges. Briefly explain with a comment in the code how you found
this threshold and why you chose it.