1. A computer implemented method for generating an environment map of an input video sequence, the method comprising: receiving the input video sequence from a camera system, the video sequence having a plurality of video frames; extracting one or more video features from a plurality of video frames of the video sequence; tracking the video features in two or more video frames of the video sequence; identifying a plurality of keyframes and adding the identified keyframes into an initial environment map, wherein the keyframes are identified based on the video features of the video frames, and the initial environment map is represented by a keyframe pose graph; enforcing local metric properties of a group of selected keyframes of the initial environment map; optimizing the initial environment map based on global metric properties of the keyframes; and generating an output environment map based on the optimization.