1. Introduction
Digital metric documentation with images and laser scans is fundamental in projects requiring accurate metric deliverables. Traditional metric deliverables are plans, sections, orthophotos, digital maps, or different types of 3D models such as BIM, surface or solid models, surface meshes, and finite elements models, among others [
1]. Nowadays, the use of digital photogrammetry and laser scanning is one of the most common digital surveying methods able to generate accurate geometric records in different formats.
Several papers and textbooks describe both theoretical concepts and practical issues in digital documentation projects of three-dimensional objects carried out using images [
2] and laser scans [
3]. The reader is referred to [
4,
5,
6,
7,
8] for some examples related to digital workflows using a combination of instruments and measuring techniques.
This paper aims to show a relatively fast alternative solution that can be used with 360
low-cost cameras available on the commercial market. Low-cost sensors are becoming more popular within the framework of digital photogrammetry because a digital camera can be turned into a measuring tool [
9], obtaining 3D models from blocks and sequences of digital images.
The proposed method is not based on traditional frame (also called central perspectives or pinhole) cameras. Here, 360 images (also called spherical or equirectangular projections) are used, and the considered objects are planar surfaces, i.e., two-dimensional objects.
Metric documentation of 2D objects is typical in several projects, such as the digital documentation of building facades, mosaics, and paintings, among others. Here, rectified photographs are still a popular solution in several practical applications.
The spherical camera model is already available in commercial software for image-based 3D modeling, such as Agisoft Metashape or Pix4Dmapper. However, the reconstruction workflow is mainly developed to deal with three-dimensional geometry objects. In fact, commercial software requires multiple spherical images acquired from different locations, which are then processed to generate 3D textured models or additional outputs (orthophotos, digital elevation models, etc.).
Different authors described the use of spherical photogrammetry for 3D modeling, which is a powerful tool to document small and narrow spaces [
10,
11,
12,
13,
14,
15,
16,
17,
18,
19]. Aspects related to camera calibration are described in [
20]. Accuracy evaluation are reported in [
21,
22,
23,
24,
25,
26]. In [
27], a set of spherical images is used to merge photogrammetric projects carried out with other camera models.
Other examples, including both metric and non-metric projects with spherical images, were discussed by different authors. For instance, heritage documentation is a field in which spherical images allow rapid mapping of buildings and monuments [
28,
29,
30,
31] including sites at risk [
32]. In [
33], spherical images are used as a base for virtual reality applications, whereas an immersive tool is described by [
34]. The use of such images and deep learning is discussed in [
35]. The work illustrated in [
36] uses a low-cost 360
sensor for crime scene documentation. Ref. [
37] uses spherical images for biomass estimation in forestry. Integrated use of drones and spherical images is presented in [
38].
Spherical images are also available on the web. Different sharing services (e.g., 360Cities.net, Mapillary, Facebook, Kuula, Roundme, and Theta360) offer the opportunity to upload this type of image. Some of them allow data sharing and the creation of virtual tours.
The method presented in this manuscript differs from traditional projects based on spherical photogrammetry. As mentioned, only planar objects are considered. Although 2D metric documentation can be carried out with the traditional photogrammetric workflow (planar objects are sub-cases of 3D projects), there is a lack of software for metric rectification of spherical images.
Metric rectification [
39] is a well-known digital recording solution that can be carried out using just a photograph, removing the perspective deformation using external constraints such as control points or information about the geometry (e.g., sets of parallel lines and known aspect ratio). Digital orthophotos created with 3D photogrammetry can compensate for the lack of flat geometry. However, this would require a photogrammetric project with several images featuring good overlap.
This paper tries to avoid the multi-step processing workflow (image matching, bundle adjustment, generation of a dense point cloud, extraction of a mesh or a DSM, and orthophoto production) available in commercial software. The idea is to use a single spherical image and a direct metric rectification approach.
In the case of metric rectification projects carried out with images based on the pinhole camera model, lens distortion is removed beforehand using distortion parameters derived from a specific calibration project. Different commercial packages offer predefined calibration coefficient sets for several camera bodies and lens configurations.
Images acquired with a spherical camera (also called 360 or equirectangular projections) feature a 360× 180 field of view, capturing the entire scene around the camera. Low-cost and professional cameras are available on the commercial market and allow the photographer to capture a spherical image, usually generated from a set of pinhole or fisheye lenses mounted on the 360 camera. Although the acquired data are not 360 images, stitching is automatically carried out to provide the final image in real-time.
This paper extends what was briefly proposed by [
40], in which different procedures for condition mapping in restoration projects were illustrated and discussed. This paper focuses on the concept of metric rectification from 360
images, describing the algorithms with more details and some additional metric evaluation experiments in order to provide information about the achievable metric accuracy.
The paper is structured as follows.
Section 2 illustrates the general workflow of the proposed method for metric rectification of spherical images. The following
Section 3,
Section 4 and
Section 5 describe the different steps of the implemented solution. Experiments were carried out with low-cost cameras available on the commercial market at a cost of about EUR 500.
2. The Proposed Method for Metric Rectification of Spherical Images
The procedure for metric rectification is based on a multi-step workflow in which different products are generated from a single spherical image. The workflow starts with acquiring a spherical image, which can be captured with low-cost or professional 360
cameras, or using a rotating camera and stitching software capable of mosaicking multiple shots [
41,
42]. In the case of a rotating camera, the rotation point must be perspective center to avoid parallax errors during the stitching phase.
Figure 1 illustrates the flowchart of the proposed workflow for the extraction of the metric images.
An example is proposed here to clarify the implemented solution and the different outputs that can be produced.
Figure 2 shows the results achievable with the proposed metric rectification approach using a spherical image retrieved from Google Maps. The image was acquired in a room of the Alcázar of Seville (Spain). Image resolution is 13,312 × 6656 pixels and the covered field of view is 360
× 180
. The following sections will prove that a complete 360
× 180
(i.e., no cropping to limit the field of view) provides all required information to calculate internal orientation parameters, namely the center of the sphere in the camera reference system and the focal length (in pixels)
f.
The spherical image generated six metrically rectified images: four images for the lateral walls, ceiling, and floor. As can be seen in
Figure 3 and
Figure 4, a single spherical image acquired inside a room allows the user to record all the different flat surfaces. It also provides an immersive visualization that allows the user to understand the relative position of the different walls. A recording specialist could avoid taking notes in the case of a more traditional rectification project based on standard frame images.
Recovering metric properties means generating a new (metrically) rectified image that provides angles and ratios of distances. The correct scale can be recovered only if some (metric) information is available, such as a known distance measured with a measuring tape or a set of control points collected with a total station. In other words, if there is no external information about the considered surface, the rectification process is affected by an overall scale ambiguity, which is another advantage of the proposed approach that encapsulates the focal length. A more traditional geometric rectification would require instead a known width–height ratio, i.e., two distances.
A spherical image can be synthetically rotated to change the viewing direction towards specific areas. The user is probably familiar with the traditional ”bubble” visualization, in which the viewing direction can be interactively changed by dragging the point of view (POV). The idea is here replicated considering the planar surface requiring rectification.
We can define the following three angles for a leveled 360 image:
heading, rotation around the vertical direction;
roll, rotation around the line of sight;
pitch, rotation around the transverse axis.
Changing the heading h without altering pitch and roll provides the same effect of a user looking left or right. This is the most common way to point the viewing directions towards the center of the vertical wall to be rectified. A variation of the pitch instead would rotate the camera up or down, allowing the user to also capture the floor and ceiling.
The user must be aware that the order of rotations (in this case ) is fundamental. A positive pitch variation corresponds to point the POV up if . The opposite, i.e., POV pointing down, will be achieved for . Roll variations are helpful in refining the captured area, mainly when the spherical image was not acquired in the center of the room.
The image used to rectify the first vertical wall (top-left in
Figure 3 was extracted by setting the values POV =
. The extraction is carried out using a gnomonic projection, which allows projecting the points of the spherical image onto a plane tangent to the sphere. The projection center is the center of the sphere.
The user has to define the field of view (FOV) of the new image based on the pinhole camera model (also called central perspective or rectilinear projection). The FOV can be interactively enlarged or reduced to capture the entire wall, and it was set to 100× 100.
The second image (top-middle) was set to POV = and FOV = 110× 110 to capture the wall on the right. The third wall (top-right) has parameters POV = and FOV = 120× 120. Finally, the fourth wall (bottom-left) has POV = and FOV = 120× 120. As can be seen, FOV values were changed to cover the entire walls, which have different sizes.
The rectilinear image for the ceiling (bottom-middle) has parameters POV =
and FOV = 120
× 125
. The floor is the flat surface requiring the largest field of view because the camera is relatively closed to the subject. Parameters were set as POV =
and FOV = 135
× 135
. More details about the extraction of the rectilinear images are discussed in
Section 3. The implemention used relies on the Panorama Tool Files, which is the library used to develop Hugin software. Files can be downloaded from
https://sourceforge.net/projects/panotools/files/ (last accessed on 10 March 2022).
The last step is metric rectification, which is carried out on the different rectilinear images. Two different approaches are illustrated and discussed in the manuscript. The first method is the typical solution for accurate metric rectification projects to record flat surfaces. Control points are measured with an extrenal instrument, usually a total station. The same points are measured in the rectilinear images, obtaining pixel coordinates and calculating the parameters of the homographic transformation. The details of such an approach and an accuracy evaluation are discussed in
Section 4.
The solution used to generate the metrically rectified images relies on images with no external information.
Section 5 will show that a homography able to rectify a rectilinear image can be estimated from the vanishing line of the image and the focal length of the camera used.
Flat surfaces with at least two sets of parallel lines allow calculating the vanishing line. In contrast, the focal length of the rectilinear image can be derived from the pixel size of the spherical image.
The six surfaces of the considered room were therefore rectified without taking extra on-site measurements, obtaining six images with an overall scale ambiguity (
Figure 4). As surfaces share common discontinuity lines, they can be scaled to reduce the number of known distances to just 1 for the entire room.
The bottom-left facade in
Figure 4 is a clear example of the possibility to compensate for just deformations on the chosen rectification plane. The wall has an internal niche that cannot be rectified using the proposed approach, which only operates on the chosen object plane.
3. Extraction of Rectilinear Images from a Spherical Projection
This section describes the procedure to extract a rectilinear image from a spherical projection, which can be used during the metric rectification step.
We define a spherical (equirectangular) projection as an
image obtained by mapping latitude and longitude (spherical) coordinates
onto the (image) plane
using the following Equations (
Figure 5):
Equirectangular projections cover 360 horizontally and 180 vertically so that the aspect ratio is 2:1 (). Let us consider a sphere with center and radius . The plane tangent to the sphere at point represents the new rectilinear image. The point has latitude and longitude and lies on the equator. Mapping is based on a gnomonic projection, i.e., from the center of a sphere to a plane tangential to the sphere.
Horizontal
and vertical
angles define the field of view and the size (in pixels)
of the new rectilinear image:
Vertical and horizontal field of views (FOVs) can be estimated as .
An essential property of the rectilinear image is the relationship between its focal length and the sphere is radius. Indeed, the focal length of the rectilinear image is equal to r if the mapping is carried out, preserving the maximum image resolution. Moreover, no barrel or cushion distortion needs to be corrected, and the rectilinear image can be considered a novel distortion-free image.
Figure 6 shows the extracted rectilinear images changing the field of view, the values of the angles were chosen as
15
, progressively increasing resolution: 30
, 50
, 80
, 110
, and 150
. It is recommended to keep the angles under 110
–120
, to reduce deformations at the edges. Very large fields of view result in stretched elements close to image edges, making the resulting rectilinear projection unusable for metric application.
The resolution of the final image is also proportional to the chosen FOV because the original level of detail encapsulated in the spherical projection is preserved in the current implementation. This means that each image can be considered as a part extracted from the next one. It is up to the user to find a specific balance between the FOV and the area to be rectified.
The extraction of multiple rectilinear images is based on selecting alternative tangent planes to the sphere at a generic point . Moving the plane extends the previous case and projection equations must be modified accordingly. However, the alternative solution implemented in this work is the synthetic rotation of the original equirectangular projection using heading, roll, and pitch in sequential order. Changing the point of view allows to orient the sphere so that the tangency point becomes , without requiring a modification of the current implementation.
4. Spherical Image Rectification with Control Points
Metric rectification using control points is the typical solution for the accurate digital documentation of planar surfaces. Control points are usually measured with instruments able to provide object coordinates in a metric system. The typical case is based on control points measured with a reflector-less total station. Then, the user must select the corresponding image points and calculate transformation parameters from image to object space. The next section introduces a possible solution for the estimation problem.
4.1. Homography Estimation Using Image-to-Object Correspondences
Homography is the transformation between a planar object and the corresponding rectilinear image extracted from the spherical projection. Parameter estimation can be carried out using projective geometry.
A point in the Euclidean 2-space has inhomogenous coordinates . Adding an extra coordinate to the pair provides a new triplet . We say that this 3-vector is the same point in homogeneous coordinates (for any non-zero ). A homogeneous vector represents the point in .
A planar homography (also called projective transformation) is represented by a
matrix
with 8 degrees of freedom:
which can be cast in the form:
We may multiply the numerator by the denominator to obtain two linear equations:
The values of parameters can be determined from corresponding points . The last element of can be set to take into consideration scale ambiguity.
A system of equations can be written as:
or with the more compact notation
.
If more than four point correspondences are given (over-determined set of equations), the solution is not exact. The least squares solution is:
4.2. Alternative Solution via Singular Value Decomposition
An alternative solution for the computation of the rectifying homography is based on the use of homogenous coordinates. The equation
can be cast in a more convenient form using the product
. The explicit form is given by:
where
,
, and
are the rows of the matrix
. This yields two equations (the third one is not linearly independent):
and the final system has the form
(linear in the unknown
). The trivial solution
can be avoided using the constraint
. A solution to solve this system is to perform singular value decomposition (SVD) on the matrix
. SVD factors the matrix
into a diagonal matrix
and two diagonal matrices
and
as follows:
The solution is given by the last column of (in ordered SVD).
4.3. Evaluation of Metric Quality
Three reference objects featuring planar geometry were created installing 31 targets on three perpendicular planes: two vertical walls W1 and W2 and the floor F. Reference coordinates were measured with a Leica TS30 total station, obtaining three-dimensional coordinates with a precision of about ±1 mm.
A single 360
image was acquired with an Insta 360 One R, which has two front- and rear-facing fisheye lenses [
43]. The final image (after stitching) has a resolution of 6080 × 3040 pixels. A picture image with the locations of the three planes is shown in
Figure 7.
The extraction of the three rectilinear images was carried out varying the values of heading, pitch, and roll to move the center of the equirectangular projection close to the center of each wall. The chosen angles were , , and . The field of view of the rectilinear images was set to 100× 100.
After creating the rectilinear images, image coordinates were manually measured. The set of object coordinates was instead split into three new groups using a rotation, placing the reference system in the plane of the walls, obtaining a set of ground truth coordinates , in which .
Three different systems of linear equations were written and solved, obtaining metric rectification parameters. After calculating the solution vector h, images can be metrically rectified. Twelve points were used for the two vertical walls W1 and W2, whereas only seven targets were placed on the floor F.
Figure 8 shows the three rectilinear images extracted setting a squared field of view (on top). The metrically rectified images are shown in the bottom part of the figure. As can be seen, the reference system for object coordinates is not directed along the walls. The image of the floor is rotated depending on the horizontal orientation of the total station project.
The residual vector of least squares can be calculated as
, and the posterior variance is
. The formulation based on ordinary least squares (described in
Section 4.1) was used.
A graph with the computed residuals for the different walls is shown in
Figure 9 and
Figure 10. Wall W1 has smaller residuals than W2, notwithstanding that the camera–object distance is similar, leading to a ground sampling distance (GSD) of about 0.0015 m for both walls. The values for
were ±0.002 mm and ±0.011 mm, respectively.
The better results achieved for W1 can be explained considering the chosen rotation angles , indicating that the fisheye sensor was pointing directly at the center of the wall. In the case of W2, the spherical image is the stitching result of part of both front- and rear-facing images. Similar considerations can be extended to the image of the floor, which shows even larger residuals.
5. Geometric Rectification Based on the Focal Length and the Vanishing Line
5.1. Description of the Implemented Method
The focal length of the rectilinear projection coupled with two sets of parallel lines (not necessarily orthogonal) allows retrieval of metric properties up to a scale factor, which can then be recovered with a known distance.
As the focal length of the rectilinear image extracted from the spherical projection corresponds to the radius , geometric rectification based on sets of parallel lines can be carried out without a known aspect ratio, which is the more traditional approach for geometric rectification.
We consider the calibration matrix
of the rectilinear image:
The identification of the rectifying homography requires the vanishing line of the plane. A generic line in the plane is represented by the equation . A line can be identified by a vector . A point lies on the line if and only if .
The vanishing line
can be computed from two sets of parallel lines [
44]. First, a vanishing point
can be estimated from the intersection of the lines
and
using the product
, as illustrated in
Figure 11. Then, the calibration matrix and the vanishing line provide the orientation of the object plane with respect to the camera. The normal
to the plane is
.
The image can be synthetically rotated to generate a new rectified image with a homography , implying that the unary vector must lie along the the camera optical axis .
The matrix is made up of a set of vectors that forms an orthonormal set .
The rectified image have an extra ambiguity due to a rotation because there exist an infinite number of vectors perpendicular to , resulting in an under-determined system of equations. Constraints must be applied to calculate the second vector . Finally, the last unary vector can be estimated with a cross product.
5.2. Evaluation of Metric Accuracy
Evaluation of metric accuracy of the implemented procedure was carried out using the same spherical image used in the previous section. The walls’ vertical and horizontal lines were first inspected with the total station to verify their reciprocal orthogonality. Then, image rectification was carried out measuring the lines in the images and calculating two vanishing points and the vanishing line.
The experiment was performed using only the two vertical walls because the inspection with the total station revealed that the room’s plan has a trapezoidal shape. The two vertical walls are sufficiently rectangular, with discrepancies of about ±2–3 mm.
Two metrically rectified images were generated for the two walls. Evaluation of metric accuracy was performed, estimating a similarity transformation between the pixel coordinates of the rectified image and the corresponding object coordinates measured with a total station after setting the reference system parallel to the considered wall.
The use of an extra similarity transformation applied to the metrically rectified image allows a direct comparison between the set of total station control points. The procedure for metric rectification based on the focal length and vanishing line has a scale ambiguity as well as an extra rotation ambiguity due to the choice made for . An additional similarity transformation can recover the alignment of the two reference systems without altering the shape of the rectified images.
The transformation can be written as:
where
is a rotation angle,
s a scale factor, and
a translation vector. The component
requires the negative sign to change the direction of the axis. Indeed, image coordinates are measured using a system with origin in the top-left corner of the images, and the
axis is pointing downwards. In contrast, reference coordinates
measured with the total station are in a system pointing up.
is therefore made negative to invert its direction.
The previous equations can be cast in a linear form:
with the substitution
and
. Given a set of correspondences
, we may write a linear system of equations that can be solved via least squares:
The residuals are shown in
Figure 12 and confirm that better results were still achieved for W1, like in the previous section. The discrepancy between the two walls is significantly more significant than in the case of using control points.
6. Considerations and Conclusions
The paper described a method for image rectification using spherical images. Recovering metric properties of planar objects is a common requirement in several technical disciplines requiring accurate digital documentation.
The difference between traditional metric rectification and the proposed method is the use of spherical images. Such images can be acquired with low-cost 360 cameras and allow rapid documentation because the camera can be pointed in any direction, capturing the whole scene around the photographer.
Because 360 low-cost cameras with better resolution are becoming more common among users, the use of their images for metric applications opens new opportunities for different specialists requiring metric documentation.
Photogrammetric packages that generate 3D models using sequences of spherical images are already available on the commercial market. However, there is a lack of a solution for 2D metric rectification based on the spherical camera model.
The 360 images used for metric applications feature several pros and cons compared to the traditional photogrammetric workflow with frame-based cameras. As mentioned in the introduction, different authors have already investigated the topic of 3D modeling with such images. Instead, the case of metric rectification with a single 360 image is new and practical applications are not available in the scientific literature.
The proposed method should be integrated in traditional rectification approaches for rapid documentation of flat surfaces in narrow spaces, especially for the interior of buildings with several rooms. The achievable image resolution (i.e., the ground sampling distance of the rectified image) and its metric accuracy cannot be compared to the results with a more traditional rectification approach. Although 360 images feature a high resolution (e.g., superior to 18 or 20 megapixels), the large field of view under an angle of 360× 180 results in a GSD indicatively 5–6 times worse than the same rectification carried out with a frame camera.
However, it is the author’s opinion that the rectification with 360 images can become suitable for those metric applications in which several internal surfaces of buildings have to be rapidly documented with a metric accuracy of ±2–4 cm, limiting the number of images collected, and providing an overall context using the 360 images themselves. As a 360 image provides an immersive (bubble) visualization of the entire space, it is simple for the user to recognize the room in which the image was acquired and the location of the walls in the room.
The implemented workflow relies on the preliminary conversion of the spherical image into a rectilinear image using a gnomonic mapping. The user’s point of view can be oriented towards the planar surface requiring metric rectification. The field of view can also be interactively resized depending on the size of the area.
The rectilinear image can then be metrically rectified using two solutions: (i) the use of control points to estimate homography parameters or (ii) a geometrical approach based on the vanishing line coupled with the focal length of the rectilinear image, which can be derived from the radius of the sphere. This second method allows users to recover metric properties up to an overall scale ambiguity, which can be removed by measuring a single distance. The vanishing line of the plane can be instead calculated using at least two sets of parallel lines.
Metric evaluation experiments demonstrated that control points provide precision up to the ground sampling distance of the rectilinear image extracted from the spherical projection. The use of the geometrical method instead is simple and effective when the objects feature sets of parallel lines. In this second case, the user must know that the achieved metric image is affected by an overall scale ambiguity, which can be removed with a known distance.
Finally, an important consideration deserves to be mentioned. The authors acquired the spherical images used in this paper during metric evaluation with a low-cost Insta One R camera. Differing results were obtained for similar surfaces in similar project configurations, depending on the position of the surface and the front- and rear-facing fisheye lenses. Results for walls captured using the front-facing lens were better than the rear-facing lens, demonstrating that stitching of the two images introduces some deformations in the spherical image.