# Matrix Linear System

1 Preliminary step For all checks that are needed for the following questions, you should use the assert() function. All intermediate and final results should be plotted using the matplotlib package. In order for your results to be reproducible use the following seed np.random.seed(123).2 Fundamental Matrix Linear System (20 points) For this question you are asked to implement the following function:def fundamental_matrix_linear_system(pts1, pts2): “””Create linear equations for estimating the fundamental matrix in matrix form :param pts1: numpy.array(float), an array Nx2 that holds the source image points :param pts2: numpy.array(float), an array Nx2 that holds the destination image points :return:A: numpy.array(float), an array Nx8 that holds the left side coefficients of the linear equations b: numpy.array(float), an array Nx1 that holds the right side coefficients of the linear equations”””Using a number of corresponding points from the source (pts1) and destination (pts2) images as input, this function will return the array AAA 2 RN?8 and vector bbb 2 RN?1 of the linear system AAAxxx = bbb, where xxx 2 R8?1 is a vector that holds the parameters of the fundamental matrix (remember that f33 can be set to 1). You should check that N is at least 8 and that both pts1 and pts2 are two dimensional arrays and that their first dimension is equal to N and the second is equal to 2.3 Compute Epipolar Lines (10 points) In this part of the assignment you need to implement a function that calculates the epipolar lines that correspondto a set of points, under the epipolar constraint. This function should follow the function signature below:def compute_correspond_epilines(points, which_image, F): “””For points in an image of a stereo pair, computes the corresponding epilines in the other image :param points: numpy.array(float), an array Nx2 that holds the image points :param which_image: int, index of the image (1 or 2) that contains the points :param F: numpy.array(float), fundamental matrix between the stereo pair :return:epilines: numpy.array(float): an array Nx3 that holds the coefficients of the corresponding epipolar lines”””According to which image the points belong to, it should calculate the corresponding epilines under the epipolar constraint expressed by the fundamental matrix. You should check that points is a two dimensional array where the second dimension is equal to 2. Also, the which_image parameter should take only one value from the set {1,2} and the fundamental matrix should be a 3 ? 3 array. The epilines should be returned in the format (a,b,c), which are the coefficients of the line l(i) : ax + by + c = 0 that corresponds to the point p(i). Note that the coefficients should be normalized so thatp a2 + b2 = 1.4 Estimate Fundamental Matrix (50 points) For this part, you need to calculate the fundamental matrix for a stereo pair of images. First you need to load thetwo images left.jpg and right.jpg that are found under the data/ directory. Then you will need to extract SIFT features from their grayscale counterparts and find some good correspondences between the left and right image,