Converting a video to georeferenced 3D model tutorial (Agisoft PhotoScan, Sputnik GIS)

Блог
Converting a video to georeferenced 3D model tutorial (Agisoft PhotoScan, Sputnik GIS)
Converting a video to georeferenced 3D model tutorial (Agisoft PhotoScan, Sputnik GIS)

Introduction

Nowadays, amateur Unmanned Aerial Vehicles (UAV, drones) have an amazing range of applications. You may wonder: “Can I use my drone for photogrammetry?” and the answer is “Yes”. In this tutorial, you will create a georeferenced and measurable 3D model, using YouTube video captured by DJI Inspire 1.

First, a few words about the software required to complete the tutorial:

Sputnik GIS allows to measure distances and heights, calculate cut and fill volumes of piles and quarries and volume differences between digital elevation models obtained at different time, generate cross-sections (profiles) of DEMs and export them to DXF. Sputnik GIS is also used for virtual reconstruction of heritage objects. With its’ ability to simultaneously display different types of data: 3D models, spherical panoramas, video and audio files, raster and vector maps, terrain data, texts and images, Sputnik GIS allows to keep various information on heritage objects and places and display it in highly effective form.

Sputnik Web is an advanced online viewer of georeferenced 3D models, created with Agisoft PhotoScan.

Agisoft PhotoScan is a stand-alone software product that performs photogrammetric processing of digital images and generates 3D spatial data to be used in GIS applications, cultural heritage documentation, and visual effects production as well as for indirect measurements of objects of various scales.

The model cannot be used for any kind of important measurements, because the distance measurement errors might reach 1 m or more, due to objective limitations of the method. In case you need a model with an accuracy about 5 cm, consider using GeoScan 401 drone.

Source video (4k / 2160p):

3D Model created using Agisoft PhotoScan:

Video to 3D Model Sputnik Web

Step 1: Getting a suitable video

First, you need a video, captured by UAV (drone), preferably DJI with Point of Interest function and 4k video support.

Minimum requirement is a 1080p video with proper lighting and camera track, for instance:

However, you can get way better results using 4k (2160p) video and Point of Interest function, such as:

If you do not have a drone, you can download a video from YouTube for test purposes or use a readymade dataset. You should always remember about the copyright and get in touch with the authors to let them know of the ways you might use their videos.

You can find a tutorial about downloading YouTube videos in the PC Magazine article

Step 2: Converting a video to frames

There are different ways of extracting frames from video; you can find a wide range of tools in the Raymond's blog post.

An option, used in the tutorial is Free Video to JPG Converter, which is a free software extremely easy to use:

Free Video to JPG Converter

In most cases, you need to extract one frame per second. After you have extracted frames, check the results for duplicates or almost similar looking frames and delete them. That will boost the process of 3D model generation later.

Step 3: Making a 3D model step-by-step using Agisoft PhotoScan Professional

Start by downloading Agisoft PhotoScan Professional. Georeferencing is only supported by Professional edition of PhotoScan, not by Standard edition.

If you do not have license key, you will need to request a 30-day trial key.

Open Agisoft PhotoScan Professional and run Workflow - Add photos…

Converting video to georeferenced 3D model - step 3

Choose the frames you have extracted and add them. Next, run Workflow - Align photos…

Converting video to georeferenced 3D model - step 3

Next, you need to make a choice between processing time and a quality of results expected. If you need to get results as fast as possible, you should select Medium or even Low accuracy option, otherwise select High or Highest value. You may select Generic pair preselection, in case you use video captured with Point of Interest function, otherwise just leave it Disabled.

Converting video to georeferenced 3D model - step 3

After aligning images, you will see a Sparse Cloud, next you can build Dense Cloud, based on alignment results. Run Workflow - Build Dense Cloud…

Converting video to georeferenced 3D model - step 3

Again, if you need to get results as fast as possible, you should select Medium or even Low quality option; otherwise select High or Ultra High value. You may select Moderate depth filtering, in case there are no reflective surfaces in the video, which could lead to incorrect point positioning, otherwise just leave it Aggressive.

Converting video to georeferenced 3D model - step 3

When Dense Cloud creation finished, you need to remove unnecessary points around your object. Press Dense Cloud toolbar button to switch to Dense Cloud mode. Using Trackball tool, located in the center of the window, rotate the object until you see if from a top position. Press Rectangle Selection toolbar button and select the area, you want. Then press Crop Selection toolbar button to remove all unnecessary points around selected area.

Converting video to georeferenced 3D model - step 3

Now, everything is ready for Tiled Model generation, which can be viewed and measured using Sputnik GIS. Run Workflow - Build Tiled Model…

Converting video to georeferenced 3D model - step 3

You may leave all the parameters here as they are.

Converting video to georeferenced 3D model - step 3

Step 4: Georeferencing your model

First, it is necessary to explain, why such a complicated procedure needed. If you have just a video, captured by drone without any GPS logging, then you have no options. If you have a drone, which supports GPS logging for images made during a flight, then you might be able to make georeferenced model, using EXIF data, but that is a topic for another tutorial.

That is the trickiest step, because of some technical difficulties you are about to face. The most important detail here is to calculate WGS84 altitude. It is necessary to make a proper match between object and SRTM digital elevation model, used by both Sputnik and Google Earth. In case you use altitude values, captured from Google Earth or Google Maps (altitude above sea surface), your model would either be located underground or fly above the surface.

If you use the sample dataset, you can find the object here.

To georeference your model you need at least 3 points with WGS84 coordinates and height, corrected with EGM96 geoid values. First, switch to the Reference tab and press Settings button:

Converting video to georeferenced 3D model - step 4

If you have not georeferenced any models, using this method, you should select More… option in the Coordinate System combo box:

Converting video to georeferenced 3D model - step 4

Next, type WGS 84 into the Filter textbox and select WGS 84 (EPSG::4326) option:

Converting video to georeferenced 3D model - step 4

Now you need to create three or more markers. Press Tiled Model toolbar button to switch to Tiled Model mode. Using Trackball tool, located in the center of the window, rotate the object until you see it from a top position. Select locations at the ground around your object to place markers, the locations must be clearly visible. By clicking right mouse button at a selected location, call context menu and select Create Marker option:

Converting video to georeferenced 3D model - step 4

After you have created markers, you need to get their latitudes, longitudes and altitudes. There are two options: use Sputnik GIS (easy way) or get it from Google Earth or Google Maps based services, such as Elevation Finder.

Converting video to georeferenced 3D model - step 4

First method: Install Sputnik GIS, an advanced 3D model viewer, compatible with Agisoft PhotoScan data formats. You can download it here. Start Sputnik GIS, switch to Bing imagery layer and find your object either manually or by entering its address. Then just point a cursor to a location, similar to the marker location and write down the coordinates and the second altitude, which is a WGS84 altitude, located at the bottom of Sputnik GIS window. Then just transfer these values to PhotoScan markers fields (Reference tab):

Converting video to georeferenced 3D model - step 4

Another way is to open the Elevation Finder site, switch to Satellite layer and find your object either manually or by entering its address. Place point to a location, similar to your marker’s location. Copy Latitude (first coordinate value) to a marker’s Latitude field (Reference tab) and then repeat the action with Longitude.

Converting video to georeferenced 3D model - step 4

Copy the Location string value and store altitude value somewhere. Now it is time to correct altitude to match SRTM surface for both Sputnik GIS and Google Earth. Go to GeoidEval and paste the copied location string. Press Submit button. You will get an EGM96 geoid altitude correction for your altitude. You should compute corrected altitude value using the formula: Altitude above sea level + Geoid height = WGS84 Altitude. For instance, Point 1 marker WGS84 altitude calculation looks like: 810.137 m + (-44 m) = 766.137 m

Converting video to georeferenced 3D model - step 4

Type WGS84 altitude into Altitude field (Reference tab):

Converting video to georeferenced 3D model - step 4

Repeat the procedure for all the markers created.

After you have entered all the coordinates received either using first or second method, press Update button to finish georeferencing:

Converting video to georeferenced 3D model - step 4

Finally, you can export Tiled model. Run File - Export Tiled Model…

Converting video to georeferenced 3D model - step 5

Select file path and a proper format - Agisoft Tiled Model (.tls).

Step 5: Viewing your model using Sputnik GIS

After export is finished, install Sputnik GIS if you haven't done it previously. Start Sputnik GIS, run File – Open – File... and select your tiled model file:

Converting video to georeferenced 3D model - step 4

As soon as model loaded, you can measure heights and distances, using Ruler and Corner Ruler tools:

Converting video to georeferenced 3D model - step 4

In addition, after selecting your model in Layer and Objects window, you can hide elevation model under your object by selecting an option at Properties tab.

Another option is to use Sputnik Web to view the model. Start a registration by pressing Register button and filling all the information necessary. The service is now in beta-test stage, so after registration you need to confirm your participation by sending an e-mail with "Sputnik Web Registration" subject and some information about your interests in UAV and 3D models design to sputnik@geoscan.aero. After receiving your registration confirmation you can upload a model by pressing Upload button and filling all the information necessary:

Converting video to georeferenced 3D model - step 5

Next, you can add a Description and setup Access rights, by selecting who can view your model:

Converting video to georeferenced 3D model - step 5

Finally, you can view a model.

Here you can view another example of a model, created using the frames of the video shown at the beginning of the tutorial. This image is the link to the model uploaded to Sputnik Web:

In the next article we will discuss, whether you need an amateur UAV, such as DJI Inspire or professional one, such as GeoScan 401 for your tasks and what makes the differen?e between them.

  • 5 February 2016
  • /
  • News