Robust and Accurate Structure from Motion of Rigid and Nonrigid Objects