Warning
This page is located in archive. Go to the latest version of this course pages. Go the latest version of this page.

Homework 02 - Projection Matrix of a Perspective Camera

Input Data

The input data can be downloaded from submission system: the image daliborka_01.jpg, coordinates of 3D points x and their projections u (in the file daliborka_01-ux.mat), and point index vector ix.

Task

  1. Load the points u, x and the image into your matlab workspace.
  2. Examine the image points u by displaying them over the image.
  3. Examine the 3D points x by displaying them in a new figure. The 3D plot can be e.g. rotated.
  4. Implement the estimation of a scaled image projection matrix Q from given image points u and 3D points x given your selection index ix as a function
    Q, points_sel, err_max, err_points, Q_all = estimate_Q( u, x, ix )
    where Q is the best scaled image projection matrix, points_sel are indices of the 6 points (w.r.t to all 109 points). The other output arguments are optional (not tested by A.E.), for your convenience: err_max should be vector of all maximal errors for all tested matrices, err_points should be vector of point errors for the best camera and Q_all should be cell matrix containing all tested camera matrices (will be used in HW-03). Note: use native indexing, i.e. ix and point_sel must be 0-based in python implementation and 1-based in matlab implementation.
    1. Perform all possible selections of 5 1/2 points from your 10 points (using ix)
    2. For each selection compute a scaled image projection matrix Q projecting the selected 5 1/2 points exactly.
    3. Compute the reprojection errors – Euclidean distances between measured image points u and the projections of 3D points x using the particular matrix Q (for all 109 points). Find the maximum error over all the correspondences.
    4. From all computed projection matrices select the one that has the maximum reprojection error minimal.
  5. Plot the decadic logarithm (log10()) of the maximum reprojection error of all the computed projection matrices as the function of their selection index and export the plot as a pdf file 02_Q_maxerr.pdf.
  6. Display the image and plot u as blue dots (plot specifier 'b.'), highlight the points used for computing the best Q by plotting them as yellow dots ('y.'), and plot the projections of x using the best Q as red circles ('ro'). Export the plot as 02_Q_projections.pdf.
  7. Display the image and plot u as blue dots, highlight the points used for computing the best Q by plotting them as yellow dots, and plot the displacements of projected points x multiplied 100 times as red lines. Export the plot as 02_Q_projections_errors.pdf.
  8. Plot the reprojection error of the best Q on all 109 points as the function of point index and export as 02_Q_pointerr.pdf.

(Note: do not forget to create figure titles and describe axes where appropriate.)

Example results

Upload

Upload an archive containing the following files:

matlab python
02_Q_projections.pdf, 02_Q_projections_errors.pdf
02_Q_maxerr.pdf, 02_Q_pointerr.pdf
estimate_Q.m
hw02.m hw02.py containing also the estimate_Q function
any other files used by your solution

The input entry point script hw02 should make all the required figures, output files and prints without manual intervention.

Note: The required files must be in the root directory of the archive.

courses/gvg/labs/hw-02.txt · Last modified: 2023/03/05 20:09 by korotvik