This repository presents a rigorous Python-based simulation for camera forward projection and parameter estimation utilizing the Direct Linear Transform (DLT) algorithm. The simulation systematically examines the process of projecting three-dimensional world points onto a two-dimensional image plane, estimating the camera projection matrix, and decomposing this matrix to recover intrinsic and extrinsic camera parameters. Furthermore, it incorporates stochastic noise to emulate real-world measurement inaccuracies.
- Camera Parameter Definition: Derivation of intrinsic and extrinsic camera parameters using Euler angles and translation vectors.
- 3D-to-2D Projection: Projection of non-coplanar 3D points onto a 2D image plane via the projection matrix.
- DLT-Based Estimation: Computation of the camera projection matrix using a DLT framework from noisy 3D–2D correspondences.
- Projection Matrix Decomposition: Extraction of intrinsic parameters, rotation matrix, translation vector, and camera center from the estimated projection matrix.
- Empirical Simulation of Real-World Scenarios: Simulation of a structured room corner with markers across three perpendicular planes, incorporating synthetic measurement noise.
- Graphical Representation: Interactive visualization of 3D world points and corresponding 2D image projections, supplemented by error analysis.
Generates a 3×3 rotation matrix derived from specified Euler angles (yaw, pitch, roll).
createGTCameraParameters(focal_length_x, focal_length_y, principal_point_x, principal_point_y, R, camera_translation_vector_from_world_origin)
Computes the ground truth intrinsic matrix K, extrinsic matrix [R | t], and projection matrix P.
Projects 3D world coordinates to a 2D image plane using projection matrix P. Outputs normalized 2D image coordinates and a boolean mask indicating boundary constraints.
Employs the DLT algorithm to estimate the projection matrix from 3D–2D correspondences using singular value decomposition (SVD), with subsequent scaling and sign adjustments.
Decomposes a 3×4 projection matrix into intrinsic parameters, a rotation matrix R, translation vector t, and camera center C using RQ decomposition.
Visualizes 3D world points alongside the camera coordinate system.
Plots 2D image points while adjusting for the image coordinate system’s origin (top-left).
To compute and visualize the projection of predefined 3D points onto a 2D image plane using a known projection matrix.
- Define 3D world points and camera parameters.
- Construct the ground truth projection matrix P.
- Compute the 2D image coordinates of projected 3D points.
- Visualize the spatial configuration and projected image points.
To derive the camera projection matrix from 3D–2D correspondences using the DLT algorithm.
- Utilize the observed 2D projections and corresponding 3D world points.
- Construct the DLT-based system of equations and solve via SVD.
- Normalize and refine the computed projection matrix.
- Compare the estimated P with the reference P.
To extract intrinsic and extrinsic parameters from the estimated projection matrix and assess reprojection accuracy.
- Decompose the estimated P via RQ factorization.
- Utilize the estimated projection matrix to reconstruct 2D image points.
- Compute the Euclidean reprojection error between observed and reconstructed 2D points.
- Visualize comparative discrepancies in reprojections.
To simulate a real-world camera calibration scenario using structured 3D markers in a controlled environment.
- Define 3D spatial coordinates corresponding to markers positioned on three orthogonal planes.
- Synthesize 2D projections via the ground truth camera parameters.
- Introduce Gaussian noise to simulate sensor inaccuracies.
- Employ the DLT algorithm to recover the camera projection matrix.
- Decompose the estimated P and analyze the recovered camera center.
- Visualize discrepancies between noisy captured points and reprojected points, and compute the mean projection error.
- Figure 1: 3D world points and camera reference frame.
- Figure 2: Estimated vs Actual Parameters.
- Figure 3: Ground truth vs. estimated 2D projections.
- Figure 4: Error analysis and comparative camera parameter evaluation.
This repository provides an extensive computational framework for simulating camera projection and parameter estimation through the DLT methodology. By integrating forward projection, matrix decomposition, and real-world perturbation modeling, it serves as a robust investigative tool for understanding camera calibration principles and projection geometry within a controlled simulation paradigm.