Camera Calibration and Lambertian Rendering
Implementing camera matrix estimation via homogeneous least squares and performing realistic Lambertian sphere rendering.
Overview
A. Finding the Camera Matrix
Using homogeneous least squares, a 3×4 camera matrix M was estimated. The matrix was derived by:
- Constructing matrix P,
- Computing U = PᵗP,
- Extracting the smallest eigenvector,
- Reshaping it into matrix M.
The accuracy of M was evaluated by comparing projected image points to ground truth.
Results:
- RMSE of M: 3.68
- RMSE of HW04 matrices:
- Camera 1: 23.9
- Camera 2: 40.7
This confirms that our matrix M gives the most accurate projection among all.
Note: The calibration minimizes
Pm = 0
with |m| = 1 constraint and not the direct re-projection error.
B. Rendering a Lambertian Sphere
Using the computed camera matrix M, we rendered a Lambertian surface sphere in 3D space.
Setup:
- Camera position: (9, 14, 11)
- Light position: (33, 29, 44)
- Sphere model: Generated via nested loop mesh
- Shading: Based on surface normals and dot product with light vector
- Blue channel: Encodes luminance, scaled by albedo (set to 4)
Alternate Lighting Scenario
- Light moved to (-30, 0, 0)
- Sphere shading adjusts to reflect new light direction
- Realistic darkening of shadowed regions
Conclusion
This assignment demonstrates a practical approach to camera matrix estimation and realistic rendering using Lambertian reflectance. The computed camera matrix significantly improves projection accuracy, and the rendering logic reflects correct lighting behavior.