## Zisserman Toolbox July 31

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:

CHAPTER 04

• 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.

CHAPTER 07

• 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.

CHAPTER 11

• 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.

1. ### Herman Kloosterman Aug 31

Thanks! Very handy.

2. ### Puff Oct 22

Hi, it is very excellent work you have done.
I am intrested in CV too and have downloaded your “Zisserman Toolbox”. But where is the m files of CHAPTER 04?

3. ### yanzhou zhou Oct 27

I am very appreciate you and your friend’s kindness. It is very helpful, becasue I am searching the web all the morning for stitch images.

Thank you very much

6. ### Xu Dec 12

Nice job! which sift code did you use? I can’t find it

7. ### Paulo Drews Dec 17

I think there is a wrong command in the script getCorrectCameraMatrix.m, the normalization :
A1n = sqrt(sum(A(1,:).*A(1,:)));
A2n = sqrt(sum(A(2,:).*A(2,:)));
A3n = sqrt(sum(A(1,:).*A(1,:)));
A4n = sqrt(sum(A(1,:).*A(1,:)));
i think it will be
A1n = sqrt(sum(A(1,:).*A(1,:)));
A2n = sqrt(sum(A(2,:).*A(2,:)));
A3n = sqrt(sum(A(3,:).*A(3,:)));
A4n = sqrt(sum(A(4,:).*A(4,:)));

is it correct?

8. ### isaac Dec 17

Paulo, you might be correct. I will look at the Horn’s paper and at the latest version of the toolbox and will report back.

9. ### Jenny Jan 14

Do you have the matlab code for 15-point algorithm? We need that these days for the assignment, please post the code ASAP or send the mail to me,thank you very much!