📘
Pinhole Camera Intrinsic Projection
MediumGeometry, Linear Algebra
Given a 3D point in camera coordinates and a camera intrinsic matrix K, compute the projected 2D pixel coordinates using the pinhole camera model.
The intrinsic matrix K has the form:
K=fx000fy0cxcy1
Where fx,fy are focal lengths and (cx,cy) is the principal point.
The projection formula is:
uv1=Zc1KXcYcZc
Return the 2D pixel coordinates [u,v] rounded to 2 decimal places.
Example:
Input:
print(pinhole_projection([[800.0, 0.0, 320.0], [0.0, 800.0, 240.0], [0.0, 0.0, 1.0]], [10.0, 20.0, 5.0]))
Output:
[1920.0, 3440.0]
Reasoning:
- Multiply K by the 3D point: K⋅[100,50,10]T
- Divide by Zc=10 to get normalized coordinates
- Result: [u,v]=[610.0,355.0]
Constraints:
- The input point w' = [u', v', w'] has depth w' > 0
- Lambda is a valid 3x3 intrinsic matrix
- All inputs are floating-point numbers
- Output must be rounded to 4 decimal places
Editor
Python 3.13.1
Test Results
0/0Run code to see test results.