Optimal Structure From Motion: Local Ambiguities and Global Estimates