~~NOTOC~~ ====== Homework 08 - Epipolar geometry ====== ==== Implementation ==== FF = u2F( u1, u2 ) Create function ''u2F'' which computes the fundamental matrix using the seven-point algorithm from 7 euclidean correspondences ''u1'', ''u2'', measured in two images. For constructing the third order polynomial from null space matrices ''G1'' and ''G2'', there is the ''u2F_polynom'' function in the tools repository, that can be used in your code. There can be multiple solutions; return all solutions as a list of matrices (''np.array'') in python (''FF = [ F1, F2, ... ]'') or a cell array of matrices in matlab (''FF = { F1, F2, ...};''). ==== Input Data ==== The images and the point correspondences can be downloaded from the InputData. ^ daliborka_01 ^ daliborka_23 ^ | {{https://cw.felk.cvut.cz/brute/data/ae/release/2020l_gvg/gvg_ae/data/daliborka/daliborka_01.jpg?direct&200|}} | {{https://cw.felk.cvut.cz/brute/data/ae/release/2020l_gvg/gvg_ae/data/daliborka/daliborka_23.jpg?direct&200|}} | There is a set of point matches between the images above. Additionaly, there is list of ''edges'' - indices of points, that form an edge (**1-based**). There is also list of 12 indices of points ''ix'', (**1-based**) that should be used for estimating epipolar geometry. {{courses:gvg:labs:09_mesh.jpg?direct&400|}} ==== Steps ==== - Find the fundamental matrix ''F'' relating the images above: generate all 7-tuples from the selected set of 12 correspondences, estimate ''F'' for each of them and chose the one, that minimizes maximal epipolar error over all matches. - Draw the 12 corresponding points in different colour in the two images. Using the best ''F'', compute the corresponding epipolar lines and draw them into the images in corresponding colours (a line segment given by the intersection of the image area and a line must be computed). Export as ''08_eg.pdf''. - Draw graphs of epipolar errors ''d1_i'' and ''d2_i'' for all points (point index on horizontal axis, the error on vertical axis). Draw both graphs into single figure (different colours) and export as ''08_errors.pdf''. - Save all the data into ''08_data.mat'': the input data ''u1'', ''u2'', ''ix'', the indices of the 7 points used for computing the optimal ''F'' as ''point_sel'' and the matrix ''F''. Epipolar error: for a particular fundamental matrix ''F'', compute epipolar lines in the second image for all points in the first image, and vice versa. Then evaluate the Euclidean distances between a point and corresponding epipolar line for all points in both images, i.e. ''d1_i'' and ''d2_i''. The epipolar error for the i-th match is defined as ''d1_i + d2_i''. ^ Example: the epipolar lines ^ Example: the epipolar error for all points ^ | {{courses:gvg:labs:09_eg.jpg?direct&400|}} | {{courses:gvg:labs:09_errors.jpg?direct&400|}} | ==== Upload ==== Upload an archive consisting of: ^ matlab ^ python ^ | ''08_eg.pdf'' || | ''08_errors.pdf'' || | ''08_data.mat'' || | ''u2F.m'' | | | ''hw08.m'' | ''hw08.py'' containing the ''u2F'' function | any other files required by your solution (including data and files from the repository).