v9.1.1
Menu

Full Pinhole Camera Projection

mediumFREECamera modelGeometry, Linear AlgebraComputer Vision 1

Project a 3D world point onto 2D image coordinates using the full pinhole camera model with both intrinsic and extrinsic parameters.

The full projection is:

x=K[R∣t]Xwx = K [R | t] X_w

Where:

  • KK is the 3×33 \times 3 intrinsic matrix
  • RR is the 3×33 \times 3 rotation matrix (world to camera)
  • tt is the 3×13 \times 1 translation vector
  • XwX_w is the 3D world point in homogeneous coordinates [X,Y,Z,1]T[X, Y, Z, 1]^T

Steps:

  1. Form the 3×43 \times 4 extrinsic matrix [R∣t][R | t]
  2. Compute the 3×43 \times 4 projection matrix P=K[R∣t]P = K [R | t]
  3. Project: x′=P⋅Xwx' = P \cdot X_w
  4. Normalize: [u,v]=[x′/w′,y′/w′][u, v] = [x'/w', y'/w']

Return [u,v][u, v] with each coordinate rounded to 4 decimal places.

Example

Input
world_point = [10.0, 5.0, 20.0]
intrinsic_lambda = [[1000, 0, 500], [0, 1000, 400], [0, 0, 1]]
rotation_omega = [[1, 0, 0], [0, 1, 0], [0, 0, 1]]  # Identity
translation_tau = [0, 0, 5]
Output
[900.0, 600.0]
Reasoning
  • Inputs: world_point is a 3D point Xw=(10,5,20)X_w = (10, 5, 20); intrinsic_lambda holds focal lengths fx=fy=1000f_x = f_y = 1000 pixels and principal point (cx,cy)=(500,400)(c_x, c_y) = (500, 400); rotation_omega is the identity (camera axes match world axes); translation_tau =(0,0,5)= (0, 0, 5) shifts points 5 units along the optical axis.
  • World → camera: Xc=RXw+t=(10,5,20)+(0,0,5)=(10,5,25)X_c = R X_w + t = (10, 5, 20) + (0, 0, 5) = (10, 5, 25). The translation pushes the point farther from the camera, from depth 20 to depth 25.
  • Camera → image: applying KK gives x′=(1000⋅10+500⋅25, 1000⋅5+400⋅25, 25)=(22500,15000,25)x' = (1000 \cdot 10 + 500 \cdot 25,\ 1000 \cdot 5 + 400 \cdot 25,\ 25) = (22500, 15000, 25), so w′=25w' = 25 is the depth.
  • Perspective divide: u=22500/25=900u = 22500 / 25 = 900, v=15000/25=600v = 15000 / 25 = 600, giving [900.0, 600.0].
  • Notice: this equals c+f⋅(X/Z, Y/Z)=(500+400, 400+200)c + f \cdot (X/Z,\ Y/Z) = (500 + 400,\ 400 + 200). A larger tzt_z would shrink the offsets from the principal point, because the point sits deeper.

Constraints

  • The world point w will always result in a non-zero lambda after projection
  • Lambda is a valid 3x3 intrinsic matrix
  • Omega is a 3x3 rotation matrix
  • Tau is a 3x1 translation vector
  • All inputs are floating-point numbers
  • Output must be rounded to 4 decimal places

Learn this in

More from Computer Vision 1

solution.py

Test results

Sign in to run your code against the test cases.