Find your data in the assignment '00data: Your data' in the submission system; the image daliborka_01.jpg, coordinates of 3D points x and their projections u, and point index vector ix. The data can be loaded e.g.
load( 'daliborka_01-ux.mat' ); % loads all variables from the file into the workspace img = imread( 'daliborka_01.jpg' );
u, x and the image into your matlab workspace.
u by displaying them over the imageimage( img ); hold on; % without this, the next drawing command would clear the figure plot( u(1,:), u(2,:), '.' ); hold off axis equal
x by displaying them (into a new figure created by e.g. subfig) (The 3D plot can be e.g. rotated.)plot3( x(1,:), x(2,:), x(3,:) ) axis equal
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 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).
ix)
Q projecting the selected 5 1/2 points exactly.
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.
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. (Use fig2pdf.m utility in Tools repository.)
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.
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.
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.)
Upload an archive containing the following files:
02_Q_projections.pdf, 02_Q_projections_errors.pdf
02_Q_maxerr.pdf, 02_Q_pointerr.pdf
estimate_Q.m - implementation of the P matrix estimation
hw02.m - your Matlab implementation. It makes all required figures, output files and prints.
Note: The required files must be in the root directory of the archive.