Venice2020 Building Heights Detection: Difference between revisions

From FDHwiki
Jump to navigation Jump to search
Line 170: Line 170:
=== Coordinate Based Height Calculation and City Elevation Map Construction ===
=== Coordinate Based Height Calculation and City Elevation Map Construction ===


To show the building heights more quantitatively, we decided to construct a City Elevation Map, which could be achieved by plotting the height information of points in a 2D map. However, there is a prerequisite: we should get the actual height information of every point. After implementing 'Plane Redressing', we assume that z-coordinate can be approximated as the height. But before directly using it, we still need to scale the model so that the height of buildings in the model matches the actual height of buildings. For instance, we know the actual height of a reference point in real world, and we could also obtain the height of this reference point in the PointCloud model, therefore, we could obtain the scale factor in this PointCloud model. For all the other buildings in the model, the actual height equals the height in the PointCloud model multiplying the scale factor.
To show the building heights more quantitatively, we decided to construct a City Elevation Map, which could be achieved by plotting the height information of points in a 2D map. However, there is a prerequisite: we should get the actual height information of every point. After implementing "Plane Redressing", we assume that z-coordinate can be approximated as the height. But before directly using it, we still need to scale the model so that the height of buildings in the model matches the actual height of buildings. For instance, we know the actual height of a reference point in real world, and we could also obtain the height of this reference point in the PointCloud model, therefore, we could obtain the scale factor in this PointCloud model. For all the other buildings in the model, the actual height equals the height in the PointCloud model multiplying the scale factor.


To put it into practice, we need to set a reference point in the model, 'Campanile di San Marco’ is the best choice. The height of the highest building in Venice, 'Campanile di San Marco’, is 98.6 meters. In this step, the built-in function 'Scale' from the Open3D is adopted, and we finally obtained a 1:1 Venice PointCloud model where the z-coordinate of a point equals the actual height of this point in real world.
To put it into practice, we need to set a reference point in the model, "Campanile di San Marco" is the best choice. The height of the highest building in Venice, "Campanile di San Marco", is 98.6 meters. In this step, the built-in function "Scale" from the Open3D is adopted, and we finally obtained a 1:1 Venice PointCloud model where the z-coordinate of a point equals the actual height of this point in real world.


To get the HD version of the City Elevation Map, please check xxx.
To get the HD version of the City Elevation Map, please check xxx.

Revision as of 22:40, 19 December 2021

Introduction

Venice, one of the most extraordinary cities in the world, was built on 118 islands in the middle of the Venetian Lagoon at the head of the Adriatic Sea in Northern Italy. The planning of the city, to be floating in a lagoon of water, reeds, and marshland always amazes travelers and architects. The beginning of the long and rich history of Venice was on March 25th 421 AD (At high noon). Initially, the city was made using mud and woods. The revolution of the city plan has changed over time since it was built. Today, "the floating city of Italy" is called "the sinking city". Over the past 100 years, the city has sunk 9 inches. According to environmentalists, because of global warming, the sea level will rise, which will eventually cover this beautiful city in upcoming years. To us as technologists and engineers, it is important to keep track of the building height changes of Venice in order to take relevant actions on time to save the beautiful city. Since changes in natural disasters are sometimes unpredictable and out of control, to save the present beauty of Venice, we can recreate the Venice visiting experience virtually as a part of Venice Time Machine. This in the future will be relevant for travelers, historians, city planners, and other enthusiasts in the world.

Since the grant floating city is continuously sinking, it is important to keep track of the height changes of every building. In this project, our main goal is to obtain the height information of buildings in Venice. In order to achieve this goal, we construct a point cloud model of Venice from Google Earth with the help of a photogrammetry tool developed at DHLAB. Initially, we have experimented with drone videos from youtube for our reference data. Since we aim to detect the height of all the buildings of Venice, it was important for us to get image data of all the buildings in the city. However, in Youtube Videos, we found only the famous building data whose heights and detail are already available over the internet. Hence, we changed our source of information to Google Earth from Youtube`s drone-captured videos. With our current data, we have successfully calculated the heights of Venice buildings including general buildings and famous ones. Detail of our method we have described in the following sections.

Motivation

Building height is one of the most important information to consider for urban planning, economic analysis, digital twin implementation, and so on. 3D models and height information are also useful to create a realistic virtual space of an area, such as creating a realistic experience of visiting Venice in Virtual Reality.

Drones and Google Maps provide 3D views of buildings and surroundings in detail which are useful resources to keep track of changes in a target place. This information can be used to understand current details of the city and also will be useful in the future as historical data to compare with.

In this project, we aim to detect the building heights of Venice. Many geographical areas, which are either not famous or not accessible easily are accessible by Google Earth 3D views. We aim to make a 3D model of Venice with every detail of the city and calculate point clouds to detect the heights of the city.

These models and building height information can be used to create an experience of visiting Venice virtually. Besides, this virtual experience can also be used in the future as a part of Time Machine in order to revisit the space in virtual reality as if going back to time. Besides, we can also use these data for urban planning and security purposes in the future. In another word, the height information of every building in a famous busy city Venice has an impact in different realms.

Milestones

Milestone 1

  • Collect high resolution venice drone videos on youtube and record Google Earth birdview videos as supplementary materials

Milestone 2

  • Align photos of the same location in Venice, derive sparse point clouds made up of only high-quality tie points and repeated optimize the camara model by reconstruction uncertainty filtering, projection accuracy filtering and reprojection error filtering.
  • Build dense point clouds using the estimated camera positions generated during sparse point cloud based matching and the depth map for each camera
  • Evaluate point clouds objective quality and select high quality models by point-based approaches which can assess both geometry and color distortions

Milestone 3

  • Align and compose dense point clouds of different spots to generate an integrated Venice dense cloud model (implement registration with partially overlapping terrestrial point clouds)
  • Build Venice 3D model (mesh) and tiled model according to dense point cloud data
  • Generate plane of the surface ground

Milestone 4

  • Build the digital elevation model of Venice and align the model with open street map cadaster in the 16th century to obtain building heights
  • Assess the accuracy of the building heights detection

Planning

Week Tasks Completion
week 5
  • Brainstorm and present initial ideas for the project
week 6-7
  • Configure the environment and master the related softwares and libraries
  • Find suitable drone videos on YouTube and obtain photos for further photogrammetry work
week 8-9
  • Align photos, generate and denoise dense point clouds
  • Assess the quality of point clouds both subjectively and objectively
week 10
  • Implement ground segmentation
  • Collect screenshots of buildings from Venice on Google Earth
  • Prepare for the midterm presentation
week 11
  • Calculate the height of buildings and generate map layers with building height information
  • Evaluate the models based on the overlapped parts in the map layer with building height information
week 12
  • Build 3D model, tiled model of Venice
  • Align the height information layers with OpenStreetMap
week 13
  • Write final report, refine the map layers with building height information and the final models
week 14
  • Refine the final report and code
  • Prepare for final presentation

Methodology

Images Aquisition

Figure 1: YouTube Video

Point cloud denotes a 3D content representation which is commonly preferred due to its high efficiency and relatively low complexity in the acquisition, storage, and rendering of 3D models. In order to generate Venice dense point cloud models, sequential images from different angles in different locations need to be collected first based on the following two sources.

Figure 2: Google Earth

Youtube Video Method

Our initial plan was to download drone videos of Venice on the Youtube platform, used FFmpeg to extract images from the video one frame per second, and generate dense point cloud models based on the images that we acquired. However, the videos we could get from drone videos are very limited: only a few of the videos are of high quality. Among those qualified videos, most videos only focused on monumental architecture such as St Mark's Square, St. Mark's Basilica, and Doge's Palace, where other buildings have a different extent of deficiencies from various angles in the point clouds. Therefore, a large proportion of Venice could not be 3D reconstructed if we only adopt Youtube Video Method.

Google Earth Method

In order to access the comprehensive area of Venice, we decided to use Google Earth as a complementary tool: we could attain images of every building we want at each angle. With Google Earth, we are able to have much more access to aerial images of Venice, not only will these images serve as images set to generate dense point cloud models in order to calculate building heights, but we can also use the overlapping part in different point cloud models to evaluate point cloud models in a cross-comparison way.

In a nutshell, we apply a photogrammetric reconstruction tool to generate point cloud models. Photogrammetry is the art and science of extracting 3D information from photographs. As for the Youtube-based method, we will only target famous buildings which appear in different drone videos and select suitable images to form the specific building's image set. With regard to the Google Earth method, we will obtain images of the whole of Venice manually in a scientific trajectory of the photogrammetry route.

Point Cloud Optimization

Outlier Removal

Apart from selecting points in Agisoft Metashape manually, we also use Open3D to deal with the noises and artefacts. In Open3D, there are two ways to address the outliers: statistical outlier removal and radius outlier removal. We set the number of the neighbors to be 50, radius to be 0.01, but the effect of the automatic removal is not as good as the manually gradual selection.

Error Reduction

The first phase of error reduction is to remove points that are the consequence of poor camera geometry. Reconstruction uncertainty is a numerical representation of the uncertainty in the position of a tie point based on the geometric relationship of the cameras from which that point was projected or triangulated, considering geometry and redundancy. Reconstruction uncertainty can also be thought of as the ratio between the largest and smallest semiaxis of the error ellipse created when triangulating 3D point coordinates between two images. Points constructed from image locations that are too close to each other have a low base-to-height ratio and high uncertainty. Removing these points does not affect the accuracy of optimization but reduces the noise in the point cloud and prevents points with large uncertainty in the z-axis from influencing other points with good geometry or being incorrectly removed in the reprojection error step. A reconstruction uncertainty of 10, which can be selected with the gradual selection filter and set to this value or level, is roughly equivalent to a good base-to-height ratio of 1:2.3 , whereas 15 is roughly equivalent to a marginally acceptable base-to-height ratio of 1:5.5. The reconstruction uncertainty selection procedure are repeated two times to reduce the reconstruction uncertainty toward 10 without having to delete more than 50 percent of the tie points each time. If a reconstruction uncertainty of 10 is reached in the first selection attempt and less than 50% of the tie points are selected, a single optimization after deleting points is sufficient.

The second phase of error reduction phase removes points based on projection accuracy. Projection accuracy is essentially a representation of the precision with which the tie point can be known given the size of the key points that intersect to create it. The key point size is the standard deviation value of the Gaussian blur at the scale at which the key point was found. The smaller the mean key point value, the smaller the standard deviation and the more precisely located the key point is in the image. The highest accuracy points are assigned to level 1 and are weighted based on the relative size of the pixels. A tie point assigned to level 2 has twice as much projection inaccuracy as level 1. The projection accuracy selection procedure is repeated without having to delete more than 50% of the points each time until level 2 is reached and there are few points selected.

The final phase of error reduction phase is removing points based on reprojection error. This is a measure of the error between a 3D point's original location on the image and the location of the point when it is projected back to each image used to estimate its position. Error-values are normalized based on key point size. High reprojection error usually indicates poor localization accuracy of the corresponding point projections at the point matching step. Reprojection error can be reduced by iteratively selecting and deleting points, then optimizing until the unweighted RMS reprojection error is between 0.13 and 0.18 which means that there is 95% confidence that the remaining points meet the estimated error.[1]

Plane Generation

Figure 3: Plane Generation

To calculate the height of the building, we have to find the ground of the Venice PointCloud model, which could be retrieved by a tool provided by the Open3D. Open3D supports segmentation of geometric primitives from point clouds using "Random Sample Consensus", which is an iterative method to estimate parameters of a mathematical model from a set of observed data that contains outliers when outliers are to be accorded no influence on the values of the estimates. To find the ground plane with the largest support in the point cloud, we use segment_plane by specifying "distance_threshold". The support of a hypothesised plane is the set of all 3D points whose distance from that plane is at most some threshold (e.g. 10 cm). After each run of the RANSAC algorithm, the plane that had the largest support is chosen. All the points supporting that plane may be used to refine the plane equation, which is more robust than just using the neighbouring points by performing PCA or linear regression on the support set.

Plane Redressing

After selecting the most convenient plane and its supporting points, we define the plane equation in the 3D space. We want to build a PointCloud model where the Z coordinate of a point equals the height of this point in real world, so the next step is to redress the plane by projecting it on an X-O-Y space. For the projection calculation, we used the projection matrix mentioned below.

Here, the plane equation is ax + by + cz + d = 0 The redressing was performed in two steps, first translation and then rotation.

For translation, the plane intersects Z-axis at (0, 0, -d/c). So the translation is

C.png

which passes through the origin and vector v = (a, b, c)T

For the rotation, the angle between v and k = (0, 0, 1)T' is given by:

D.png


The axis of rotation has to be orthogonal to v and k. so its versor is:

E.png

The rotation is represented by the matrix:

Planeredress.png


Please note that:

U1u2.png

Height Visualisation

Point-to-Plane Based Height Calculation and City Elevation Model Construction

Once the plane equation is obtained in the previous step, we could start calculating the height of buildings. In the first step, we calculate the relative height of the buildings based on the formula of point-to-plane distance. The coordinate information of each point could be accessed by the 'points' attribute of the ‘PointCloud’ object with the help of 'Open3D'. Since we already have the plane equation, using this formula, we could obtain the distances between each point and the plane and save them in a (n, 1) array.

To visualise the height of the building, the first method is to change the colors of the points in the PointCloud model. For each point in the ‘PointCloud’, it has a ‘Colors' attribute. By calling this attribute, an (n, 3) array of value range [0, 1], containing RGB colors information of the points will be returned. Therefore, by normalising the ‘distances array’ values to the range of [0,1] and expanding the 'distances array' to three dimensions by replication, we get a (n, 3) ‘height array' in the form of (n, 3) 'colors array’.

Basically, we transform the height information of each point to its 'colors' information, expressing the height by its color, higher points have lighter colors and vice versa. This model provides us with an intuitive sense of the building heights, which is more qualitative than quantitative.

Figure : City Elevation Model

Coordinate Based Height Calculation and City Elevation Map Construction

To show the building heights more quantitatively, we decided to construct a City Elevation Map, which could be achieved by plotting the height information of points in a 2D map. However, there is a prerequisite: we should get the actual height information of every point. After implementing "Plane Redressing", we assume that z-coordinate can be approximated as the height. But before directly using it, we still need to scale the model so that the height of buildings in the model matches the actual height of buildings. For instance, we know the actual height of a reference point in real world, and we could also obtain the height of this reference point in the PointCloud model, therefore, we could obtain the scale factor in this PointCloud model. For all the other buildings in the model, the actual height equals the height in the PointCloud model multiplying the scale factor.

To put it into practice, we need to set a reference point in the model, "Campanile di San Marco" is the best choice. The height of the highest building in Venice, "Campanile di San Marco", is 98.6 meters. In this step, the built-in function "Scale" from the Open3D is adopted, and we finally obtained a 1:1 Venice PointCloud model where the z-coordinate of a point equals the actual height of this point in real world.

To get the HD version of the City Elevation Map, please check xxx.

Whole Venice
San Marco
San Giorgio Maggiore
Santa Maria della Salute

Cadaster Alignment

In order to align our city elevation map to the cadaster, we use QGIS to georeferencing the Venice height map by manually marking ground control points in both maps. As for the transformation setting, Venice zone EPSG 3004 should be chosen as the coordinate reference system. The blue layer is the cadaster while the red layer is our elevation map. The georeferencing result is acceptable, where our height map matches the cadaster mostly accurate without distortion.

Alignment

Description of the Venice Models

Tied Point Model
Dense Cloud Model
Tiled Model
Mesh Model

Tied Points Model

Dense Cloud Model

Mesh Model

Tiled Model

Model Assessment

To assess the precision of our model, we compared the

What is left to be done: 1. Write description of assessment method 2. Calculate the error 3. add pictures

Objective Assessment

Assessment of Famous Buildings

Name of Buildings Average Measured Height Reference Height Error Picture
Basilica di San Marco 44m 43m
Campanile di San Marco 99m 98.6m
Chiesa di San Giorgio Maggiore 42m NA
Campanile di San Giorgio Maggiore 72m 63m
Basilica di Santa Maria della Salute 64m NA
Campanile di Santa Maria della Salute 49m NA
Basilica dei Santi Giovanni e Paolo 54m 55.4m
Campanile di Chiesa di San Geremia 50m 50m
Campanile dei Gesuiti 43m 40m
Campanile San Francesco della Vigna 76m 69m
Chiesa del Santissimo Redentore 47m 45m
Hilton Molino Stucky Venice 45m NA

Assessment of other buildings

Selecting the buildings in PointCloud
Selecting the buildings in cadastre


Index Average Measure Height Reference Height Error
1 28.25m 28.1m
2 19.5m 19.44m
3 18.5m 18.77m
4 23m 22.59m
5 17m 16.95m
6 31m 30.83m
7 20.5m 21.02m
8 17m 17.24m
9 27.5m 26.31m
10 19.5m 19.41m

Subjective Assessment

Limitations and Further Work

Limitations

  • Challenges in model implementation from Google Earth Image

Using Google Earth images is a solution to the problems mentioned above. But it is not a perfect method either. It seemed that we were in a dilemma when we tried to collect images from Google Earth: When we took screenshots from a long distance from the ground, the resolution of images was very low, the details of the buildings were not well rendered, thus causing the low quality of the PointCloud model. When we took screenshots from a short distance from the ground, we obtained a much better result, the details were much clearer. But to get this result, the number of images we needed to build the PointCloud model increase exponentially, and the calculation was almost impossible for a Personal Computer to afford.

One possible solution is dividing Venice into smaller parts, building a PointCloud for every part, and merging the PointClouds models together in the end. However, this solution requires registration, which is not only quite imprecise, but also hard to implement.

  • Inaccurate Plane Generation and Redressing

One of the inherent defects in the methodology is 'Plane Generation' and 'Plane Redressing' are imperfect. When we implement 'Plane Redressing', the ideal scenario is that after a single transformation, the plane equation would become 0x + 0y + z = 0. However, when we implement the transformation, it is not the case: the coefficients before x and y are not exactly 0. The error caused by this inherent defect could be neutralised by implementing the transformation for 1000 times: When the number of iterations increases, the coefficients before x and y approaches zero infinitely.

Further Work

  • More Precise Georeferencing and Pixel Matching

We only choose ten ground control points for QGIS to georeference the raster height map. Generally, The more points you select, the more accurate the image is registered to the target coordinates of the cadaster. In the future, after choosing enough ground control points, we will compare our Venice elevation map with the cadaster pixel by pixel in the same resolution. Both maps use the same color and gray scales.

  • Building Contour Sharpening

In our Venice elevation map, the building footprint is blurred and not well detected. In the future, we will use Shapely in Python to find the polygons and OpenCV to implement contour approximation.

References

[1] https://pubs.er.usgs.gov/publication/ofr20211039

Deliverables