Transform Point World to Camera
Transform a 3D point from world coordinates to camera coordinates.
The transformation from world to camera frame uses a rotation matrix R and translation vector t:
where:
- is the point in world coordinates
- is the 3×3 rotation matrix (camera orientation)
- is the translation vector (camera position)
- is the point in camera coordinates
This is a rigid transformation - it preserves distances and angles. The camera "looks down" its Z-axis, with X pointing right and Y pointing down (typical convention).
Example
transform_point([[1,0,0],[0,1,0],[0,0,1]], [1, 2, 3], [0, 0, 0])
[1, 2, 3]
- Inputs:
Ris the identity matrix (ones on the diagonal, zeros elsewhere), so the camera axes line up exactly with the world axes.tis , andpointis the world origin . - Rotate: each camera coordinate is one row of dotted with the point, e.g. the first is . Every row gives , so . Rotating the origin never moves it, whatever is.
- Translate: add component by component: .
- Output:
[1, 2, 3], a list of three numbers . Since the inputs are integers, the entries stay integers. - Notice: is exactly where the world origin lands in the camera frame. Swap the roles (point , ) and the identity rotation hands the point back unchanged, also giving .
Constraints
- R: 3x3 rotation matrix
- t: translation vector [tx, ty, tz]
- point: [X, Y, Z] in world coordinates
- Return transformed point [X', Y', Z'] in camera coordinates