A method of forming a composite image from a plurality of image frames of a scene acquired using a portable electronic device associated with a graphical user interface, the method comprising: sequentially processing image frames of the plurality of image frames by, for a processed image frame, incorporating the processed image frame into a representation of the composite image, wherein sequentially processing the image frames comprises tracking a spatial position of each image frame using a three-dimensional point cloud; detecting a stop condition comprising a detected output of an inertial sensor of the portable electronic device, the stop condition corresponding to tracking being broken; stopping the sequential processing of the plurality of image frames in response to the stop condition being detected; receiving user input via the graphical user interface selecting a region of the composite image, the user input including a command to position a selection box on a screen displaying the composite image; and replacing a portion of the representation of the composite image in the selected region based on at least one additional image frame of the plurality of image frames, wherein replacing the portion of the representation of the composite image based on the at least one additional image frame of the plurality of image frames comprises: determining, after the tracking is broken, a new spatial correlation between the at least one additional image frame and the composite image, the at least one additional image frame being captured subsequent to the tracking being broken, wherein the new spatial correlation between the at least one additional image frame and the composite image is found using a relocalization technique, wherein the relocalization technique is based on the positional information of the portable electronic device determined using sensors in the portable electronic device and used to determine a rough spatial correlation, and based on image matching used to adjust the rough spatial correlation, the image matching using the three dimensional point cloud; aligning the at least one additional image frame with the composite image based on the new spatial correlation between the at least one additional image frame and the composite image; and replacing the portion of the representation of the composite image with the at least one aligned additional image frame. sequentially processing image frames of the plurality of image frames by, for a processed image frame, incorporating the processed image frame into a representation of the composite image, wherein sequentially processing the image frames comprises tracking a spatial position of each image frame using a three-dimensional point cloud; detecting a stop condition comprising a detected output of an inertial sensor of the portable electronic device, the stop condition corresponding to tracking being broken; stopping the sequential processing of the plurality of image frames in response to the stop condition being detected; receiving user input via the graphical user interface selecting a region of the composite image, the user input including a command to position a selection box on a screen displaying the composite image; and replacing a portion of the representation of the composite image in the selected region based on at least one additional image frame of the plurality of image frames, wherein replacing the portion of the representation of the composite image based on the at least one additional image frame of the plurality of image frames comprises: determining, after the tracking is broken, a new spatial correlation between the at least one additional image frame and the composite image, the at least one additional image frame being captured subsequent to the tracking being broken, wherein the new spatial correlation between the at least one additional image frame and the composite image is found using a relocalization technique, wherein the relocalization technique is based on the positional information of the portable electronic device determined using sensors in the portable electronic device and used to determine a rough spatial correlation, and based on image matching used to adjust the rough spatial correlation, the image matching using the three dimensional point cloud; aligning the at least one additional image frame with the composite image based on the new spatial correlation between the at least one additional image frame and the composite image; and replacing the portion of the representation of the composite image with the at least one aligned additional image frame. determining, after the tracking is broken, a new spatial correlation between the at least one additional image frame and the composite image, the at least one additional image frame being captured subsequent to the tracking being broken, wherein the new spatial correlation between the at least one additional image frame and the composite image is found using a relocalization technique, wherein the relocalization technique is based on the positional information of the portable electronic device determined using sensors in the portable electronic device and used to determine a rough spatial correlation, and based on image matching used to adjust the rough spatial correlation, the image matching using the three dimensional point cloud; aligning the at least one additional image frame with the composite image based on the new spatial correlation between the at least one additional image frame and the composite image; and replacing the portion of the representation of the composite image with the at least one aligned additional image frame.