Camera Calibration for Better Cylindrical Panorama
Kenneth Chu
Calibration
Here are the 20 checker board images
I down scale those checker board images to 1144 x 856 because that is the resolution used for the cylindrical panorama as well.
Jean-Yves Bouguet's calibration toolbox gives the following intrinsic camera parameters
Aspect ratio optimized (est_aspect_ratio = 1) -> both components of fc are estimated (DEFAULT).
Principal point optimized (center_optim=1) - (DEFAULT). To reject principal point, set center_optim=0
Skew not optimized (est_alpha=0) - (DEFAULT)
Distortion not fully estimated (defined by the variable est_dist):
Sixth order distortion not estimated (est_dist(5)=0) - (DEFAULT) .
Initialization of the principal point at the center of the image.
Initialization of the intrinsic parameters using the vanishing points of planar patterns.
Initialization of the intrinsic parameters - Number of images: 20
Calibration parameters after initialization:
Focal Length: fc = [ 1271.84210 1271.84210 ]
Principal point: cc = [ 571.50000 427.50000 ]
Skew: alpha_c = [ 0.00000 ] => angle of pixel = 90.00000 degrees
Distortion: kc = [ 0.00000 0.00000 0.00000 0.00000 0.00000 ]
Main calibration optimization procedure - Number of images: 20
Gradient descent iterations: 1...2...3...4...5...6...7...8...9...done
Estimation of uncertainties...done
Calibration results after optimization (with uncertainties):
Focal Length: fc = [ 1284.73829 1282.57137 ] +- [ 1.32763 1.40526 ]
Principal point: cc = [ 584.26628 424.71665 ] +- [ 3.14358 2.05553 ]
Skew: alpha_c = [ 0.00000 ] +- [ 0.00000 ] => angle of pixel axes = 90.00000 ¡H0.00000 degrees
Distortion: kc = [ -0.19845 0.15981 -0.00075 0.00140 0.00000 ] +- [ 0.00934 0.07221 0.00037 0.00044 0.00000 ]
Pixel error: err = [ 0.27073 0.24286 ]
Note: The numerical errors are approximately three times the standard deviations (for reference).
One interesting thing to notice is that the focal length is closer to the theoretical value found in assignment 2 (1208). In assignment 2, there was no calibration. The only parameter to be determined is the focal length. In some sense, that is using the wrong cure for the problem. And the empirical result (1530) deviates somewhat from the true value.
To undistort images, I use the "rect" function provided in Bouguet's toolbox. Here are some before and after images.
| |
Before | After |
| |
Before | After |
| |
Before | After |
| |
Cylindrical Panorama
I said that I would not allow vertical offset this time. But after some experiments, I decided to put it back. Somehow the vertical shift is beyond the neglactable level (bad tripod?). To demonstrate the improvement, I use the SSD/pixel (on the unfiltered image) to measure error, and the SSD/pixel on the edge-filtered image. Because of the time constraint, I only stitched 3 images (P9290054.JPG, P9290055.JPG, P929005.JPG) for this demonstration.
| SSD | edge SSD |
Old f=1208 | 0.010862 | 0.00065943 |
Old f=1530 | 0.0070007 | 0.00053348 |
w/ calibration | 0.006881 | 0.00042339 |
Focal length = 1208 pixels
Focal length = 1530 pixels
With Calibration
Complete Panorama
Because I want to put this image into the java panorama viewer, I must counter the vertical offset. In the original panorama output, there are overlaping regions on the far left and far right (overlaps in the sense that wrap the 2D image in the 3D space). And then I found a correspondance point in that region. Draw a line between them and rotate so that the line is perfectly horizontal by using some comercial imaging software. I acknowledge this is a hack.