Floor plan estimation
The user marks the corners: outward in green and inward in red.
To estimate the floor plan of the room we need to estimate the lengths of the wals and the camera position. The length of each wall is estimated by calculating it’s perspective relative to the camera. The camera's position is estimated to be in the center of the area from which all the corners can be seen.
The panoramic image is the surface of a cylinder so the horizontal distance between two corners, as marked by the user, is proportional to the angle between the camera and the corners.
To refine the estimation, a minimization algorithm is applied on the lengths of the walls to minimize the difference between the angles in the floor plan and the angles in the panoramic image.