NOTE: we have been working on the release of a new Toolbox for the past months. Given the large dissimilarities with the original Toolbox and the extensions over Zisserman works, the new Toolbox will be available from www.fit3d.info from the begining of July 2010. Please refer to the new Toolbox since it contains tons of new functionality that will allow you to get a full 3D model given a set of radially corrected images and a calibration matrix.
As part of the reading group (Multiple View Geometry in Computer Vision, Hartley and Zisserman) I am following at the UvA every Friday, I have started a small project to implement all the relevant algorithms I encounter along the discussion of every chapter.
The objective is twofold. On one hand I will practice all the concepts that are discussed in every chapter in a “hands on” fashion. On the other hand, I will prepare the set of functions that I will need when I have to estimate egomotion using the LadyBug camera as part of my PhD research.
All the algorithms and functions are implemented following Zisserman’s book and details on each of them are available in the help. This is the list of currently implemented functions:
- Computing the homography
- dlt2D.m - Implementation of the normalized Direct Linear Transform algorithm (Zisserman page 109)
- goldStd2DAffine.m - Implementation of the Gold Standard Algorithm for an affine homography estimation (Zisserman page 130)
- goldStd2D.m - Implementation of the Gold Standard Algorithm for an homography estimation (Zisserman page 114)
- ransac2d.m - Implementation of the RANSAC Algorithm for an homography estimation (Zisserman page 123). After determining the inliers, the homography is computed using the Golden Standard Algorithm (Levenberg-Marquardt)
- Related functions
- normalize2DPoints.m - Normalization of 2D image points based on the centroid and sqrt(2) distance
- normalize2DPointsCentroid.m - Normalization of 2D image points based on the centroid
- matchSIFT.m - Given the set of SIFT descriptors of 2 images, it determines the ones that match according to a distance ratio threshold
- symetricTransferError.m - Computation of the squared (not summed) symetric transfer error (Zisserman page 112) used in the Levenberg-Marquardt algorithm (lqsnonlin function in Matlab)
- stitchImages.m - Given two image files (RGB support added) it stitches them together for form a panoramic image
- normPanoramic.m - As the stitching procedure distorts the image, I included this simple function to normalize the image to a rectangle.
- Camera Calibration
- getDistortionError.m - Given a set of collinear points in image coordinates, the radial distortion parameters (k1-k4) and the center of distortion, computes distance of each point to a line fitted to the points. Its used for estimation of radial distortion by minimization of the squared sum of the distances.
- getRadialDistortion.m - Given a set of collinear points in image coordinates, it computes the parameters of the radial distortion function L(r) up to 4th order by minimizing the previous error measure.
- getRectifiedPoints.m - Given a set of points in image coordinates and the radial distortion parameters (Zisserman page 191), it computes the rectified point coordinates.
- Related functions
- getRectifiedImage.m - Given an image and the radial distortion parameters it computes the rectified image.
- obtainCameraRadialDistortion.m - Given an image, an (optional) initial estimation of the radial distortion parameters and the number of desired points to select in a line (the user can select those points) it computes the radial distortion parameters.
- getDistancePointLine.m - Computes the distance from a point (or set of points) to the given line.
- correct_radial_distortion.m - Given an image and the radial distortion parameters it computes the rectified image. This function is different than the above in that it returns an image of the same size as the original where ALL the pixels contain information (as opposed to the portion in black from the other images). This is useful if rectangular images are needed. This function was kindly contributed by Richard den Hollander.
- Epipolar Geometry Estimation
- ransacF.m - This function performs ransac for the estimation of the fundamental matrix F. The error used is the Sampson distance.
- getCameraMatrixHorn.m - Based on the paper of Horn, and given the essential matrix, the 4 possible solutions for rotation-translation are computed.
- getCameraMatrix.m - The same 4 rotation-translation solutions are computed but based on Zissermans method.
- getCorrectCameraMatrix.m - Given 4 possibvle solutions for a camera matrix (rotation-translation), the correct one is computed based on the fact the distance to the point must be positive.
- eightpoint.m - The eight point algorithm as described by Zisserman.
- getEssentialMatrix.m - A very silly multiplicacion to obtain the essential matrix given the fundamental matrix and the camera calibration matrices.
- Wrap Around functions
- getMultiImageVisualOdometry.m - Given a directory, a camera calibration matrix and a method, the visual odometry is computed.
- getVisualOdometry.m - The same but for just 2 images.
All the functions are available to download in a tar.gz file Ziss-Toolbox-r.0.2.tar.gz
Note that the current calibration code only accounts for radial distortion and not tangential distortion. A more interesting approach will be using more than one set of collinear points to estimate the parameters to better capture the radial distortion.
More functions will be available as the reading group continues.