Download MATLAB script from ext_test.zip
The calculation is performed by the MATLAB calibrator routine
[R, t] = extrinsics(imagePoints, worldPoints, cameraParams);
The rotation matrix together with the translation vector allows you to transform points from the world coordinate to the camera coordinate system.
Reference: Extrinsics Calculation
Maintained by John Loomis, last updated 26 Februayr 2017