Add the extrinsic parameters computation and fix some bugs.