Assignment 3-Image Processing
Assignment 3-Image Processing
Theme: 3D to 2D projections.
Objective: The goal of this problem is to get familiar with some methods of projection. You will
construct a simple object consisting of some 3D points. You will then write code to project these points
onto an image using two methods, perspective, and weak perspective projection. You will then judge
the accuracy of the weak perspective approximation to true perspective.
Imagine that you have a perspective camera with a focal point at (0,0,0), a focal length of 1, and an
image plane equal to the z=1 plane. Let us consider an object O with four 3D co-ordinates (-1, 0, 2),
(1, 0, 5), (0, 1, 4), (0, -1, 3).
a. Write a function that will take as input a set of 3D points and returns as output a set of 2D points
(𝑝1, 𝑝2, 𝑝3, 𝑝4) that are the projection of the 3D points with the perspective camera.
b. Write the second function to project the points using weak perspective projection (𝑞1, 𝑞2, 𝑞3, 𝑞4).
Note that the scale factor should be based on the average distance to all points.
c. Test these functions. Print out the figures showing the 2D projection of O using weak perspective
and perspective projection. The functions: figure, plot, fill and text may be useful. Try, for example,
plot (5,5,'o','LineWidth', 6), to get an idea of how to display a point in a figure so that it’s easily
visible. The function axis may also be helpful. You should show both object and its 2D projection in
the same 2D plot by using different shapes or colors. Label everything.
d. Write a function to compute the sum of square differences (SSD) between two sets of image points.
That is, for point sets: (𝑝1, 𝑝2, 𝑝3, 𝑝4), (𝑞1, 𝑞2, 𝑞3, 𝑞4), compute: ∑4𝑖=1 |𝑝𝑖 − 𝑞𝑖|2. Test it on the points
generated in parts a and b.
e. Write a function to rotate the object O counter-clockwise by 45 degree around the Z-axis. We call
the object after rotation as R. Repeat part c and d for object R.
Note:
i. Please follow the deadline to submit assignment report which should not exceed 10 pages (at maximum) and may
include basic understanding of above-mentioned techniques, results along with discussion (quantitative / qualitative
if any), and ready to execute MATLAB code written in a modular fashion (with comments and indentations for better
understanding). Student(s) submitting reports ignoring above mentioned guidelines shall get two marks deducted
from the secured assignment grade as penalty.
ii. Reports proved to be falsified and/or copied (even partially) shall get zero marks.