georeferencing oblique terrestrial...

17
Georeferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier G. Corripio Institute of Environmental Engineering Swiss Federal Institute of Technology - ETH Wolfgang Pauli Strasse 15 IfU - ETH - H¨ onggerberg HIL G 28.1 CH - 8093 Zrich Switzerland email: [email protected] url: http://www.arolla.ethz.ch/georef/georeferencing.html License: The georeferencing software is distributed under the Creative Commons license. Some rights reserved.

Upload: others

Post on 12-Jun-2020

11 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

Georeferencing oblique terrestrial photography

geophotoref V. 1.0 User’s Manual

Javier G. CorripioInstitute of Environmental EngineeringSwiss Federal Institute of Technology - ETHWolfgang Pauli Strasse 15IfU - ETH - Honggerberg HIL G 28.1CH - 8093 ZrichSwitzerlandemail: [email protected]: http://www.arolla.ethz.ch/georef/georeferencing.html

License:The georeferencing software is distributed under the Creative Commons license.Some rights reserved.

Page 2: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

2. Speedway

1 Introduction

Conventional photography is a powerful media for collecting and storing information. Ifthis information can be located precisely in space, then photography becomes a powerfultool for quantitative analysis. Such a use is well developed and well documented inphotogrammetry, though not so much in conventional photography. Here we present atool for georeferencing oblique photography using a single image and a digital elevationmodel (DEM). The accuracy of the technique will depend on the accuracy of the DEMand on the quality of the photographic image, especially the degree of distortion andaberration produced by the lens. This technique does not produce elevation data. Itactually requires an existing DEM. What the tool does is locating the geographicalposition of every pixel in a photographic image. It is therefore useful to map land coverand to assess surface cover change. It has applications in snow hydrology, glaciology,forestry and other disciplines.

This manual describes a software for georeferencing oblique photography. It aims atusing conventional photography for land surface monitoring and surface change assess-ment. The results are better for a near perpendicular view of the field, and thereforethe areas of applications are mainly mountain ground or small parcels of ground viewedfrom elevated viewpoints.

An example for an Alpine glacier is provided. This example is self explanatory andin many cases suffices to get a grasp of the software functioning. Detailed descriptionsof every input an processes follow.

The code in IDL and compiled IDL .sav files plus the necessary files to run theexamples are packaged in the compressed files geophotoref.zip or geophotoref.tar.gz

2 Speedway

Follow this route for an immediate use of the software without more preambles. Uncom-press all files provided in the same directory (or in directories IDL can access accordingto the path specifications). Compile and run the program photogeoreferencing.pro,Click on load settings and select the hautglac.set file provided, then click on loaddata, preview GCP and run. If satisfactory, click on accept, otherwise click onstart again and change some of the parameters, such as focal lens, film, camera ortarget position, and rerun starting from load data. Feel free to experiment with anysettings change, the preview GCP will show quickly which are the effects.

georeferencing terrestrial photography 1

Page 3: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

3. Scenic way

3 Scenic way

The photogeoreferencing.pro routine runs a window interface that allows inter-active input/output and the specification of necessary parameters for the georeferencingprocess. The specified settings can be saved to and loaded from a file. Typing IDL>photogeoref at the command line starts the application. Additional help is pro-vided by clicking the help button on the upper right hand corner, the different fieldsand processes are described next.

Figure 1 shows the initial screen. The GUI was originally designed for a computermonitor with a resolution of 1280 x 1024, for lower resolution scrollbars can be addedby commenting out lines 1072 and 1073. The scroll bars can be suppressed by togglingthe comments after line 1074 of the code source. The visual display is divided into theInput Parameters Window (upper left), the Display Window (bottom left) andthe Runtime Text Output Window (right column), which displays the status of theprocess and diverse data during the execution. This last may be useful for debuggingpurposes. The minimum data requirements are:

• DEM: a digital elevation model of the area

• Viewshed mask

• Photograph: an image of the area taken from a known location

• Focal length and film/digital sensor specifications

• GCP Ground Control Points file, with at least one point within the DEM domain

3.1 Input fields

Input data and filenames are provided through a graphic user interface (figure 1). Theinput fields, on the Input Parameters Window starting from the upper left handcorner are as follows:

DEM: String of alphanumeric characters naming the file containing the digitalelevation model of the area. The file must be in GeoTiff format (see section 4 forinformation and references on GeoTiffs). It is assumed that grid cells are regularsquared cells, with distance units in metres. The DEM consists of a 2-dimensionalarray of elevation values. Two accessory functions to convert from ASCII ArcInfoformat to GeoTiff and viceversa are provided.

Image: String of alphanumeric characters naming the file containing the pho-tographic image of the area. The image file must be in Tif format and contains

georeferencing terrestrial photography 2

Page 4: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

3. Scenic way

3 channels with pixel interleaved, so the resulting IDL variable will have dimen-sions [ Channels(3), Columns(m), Rows(n)]. The code could be easily modifiedto read jpegs if most photographs are provided in this format. However, to avoidcompression and decompression of images it is recommended that the images aretaken in raw camera format and converted to uncompressed Tifs.

Visibility: String of alphanumeric characters naming the file containing theregions of the DEM that are visible from the camera point of view. This file is inGeoTiff format, has the same dimensions as the DEM and values are 1 for visibleareas or 0 for non visible areas. See calculating the visibility on section 4.3.

GCPs: String of alphanumeric characters naming the file containing the list ofGround Control Points (GCP). These are provided as ascii, comma separated text.This file contains four comma separated fields and as many rows as necessary.Fields are: X-coordinate, Y-coordinate, Z-coordinate, description. An example isprovided below:

605805,93626,2827,Fix Camera C du Plan607088,91045,2972,Refuge des Bouquetins607099,91184,3045,Shoulder over Bouquetins607150,91225,3086,Cross over Ridge

Figure 1: Screen shot of the georeferencing GUI, start window.

georeferencing terrestrial photography 3

Page 5: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

3. Scenic way

Observer Coordinates: Three numeric (Long Integer) fields to input the X,Y and Z coordinates of the camera position. The coordinate system must be thesame system which is coded into the GeoTiffs files. The camera position must belocated inside the area covered by the DEM. Z values are given in metres.

Target Coordinates: Three numeric (Long Integer) fields to input the X, Yand Z coordinates of the target position. Target is defined as the point towardthe camera is aiming, that is the location of the central pixel of the photographicimage. The coordinate system must be the same system which is coded into theGeoTiffs files and must be located inside the area covered by the DEM. Z valuesare given in metres. The target and camera position should be measured, ideally,with a differential GPS. If no measurements are available the position could beestimated by trial and error

Focal length: Floating point field. The real focal length of the lens used to takethe picture. It should be the actual focal length, which can vary from the nominalfocal length up to a 10% in good quality lenses and up to an undetermined amountin bad quality lenses. Values are in metres, thus for a 24 mm lens, 0.024 (± 10%)should be the input value.

Resolution: Floating point field. Resolution of the image in dots per cm.

Film width Floating point field. Film or optical sensor width in metres. Thetotal number of horizontal pixels in the photographic image should be equal toResolution x film width x 100

Film height Floating point field. Film or optical sensor height in metres. Thetotal number of vertical pixels in the photographic image should be equal toResolution x film height x 100

X offset: Integer positive field, values are integer pixels. Allows correcting forthe horizontal displacement of the image while scanning or due to adjustmentsinside the slide frame. It compensates for the black borders that appears aroundscanned images. A positive value will displace the image to the left.

Y offset: Integer positive field, values are integer pixels. Allows correcting forthe vertical displacement of the image while scanning or due to adjustments theslide frame. It compensates for the black borders that appears around scannedimages. A positive value will displace the image down.

Offsets do not accept negative values. If an image has been cropped or displacedin the opposite directions than those indicated above, the IDL routine adjustim-age.pro (available on request) will correct it.

Camera rotation: Floating point field. Input directly or by displacing theslider. Allows correcting the position of the camera for small rotations, which arevery common, especially on hand held photographs.

georeferencing terrestrial photography 4

Page 6: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

3. Scenic way

3.2 Run procedure

help button. This button display this manual. Adobe acrobat or Adobe readermust be installed.

load settings: Load stored settings with all input data and filenames. Thesettings file (.set) is an ascii, comma separated text file containing all the necessaryinputs. It contains seven rows with three fields each. An example is providedbelow, though the safest way of producing this file is by clicking on save settings.

Example of setting file (Windows OS):

C:\georeferencing\hautglac.tif, 20010529.tif, NaNC:\georeferencing\hautglacvis.tif, arollagcp.dat, NaN605805, 93626, 2827606478, 92333, 26560.0350000, 300.000, NaN0.0360000, 0.0240000, NaN7, 0, -1.25000

save settings: Save the current settings to a specified file.

load data: Load the data and files indicated on the input fields and display agreyscale image of the DEM with GCP and target and camera positions super-imposed (figure 2).

preview GCP: Display the original photograph with the ground control pointsas green crosses. This allows a rapid verification of the camera orientation. Ifground control points do not coincide with the image, orientation parameters canbe corrected and redisplayed quickly. Together with the zooming option (figure 4)allows measuring displacements between GCPs and the corresponding pixel inthe image. These displacements may be due to incorrect values in the camera ortarget coordinates, focal length, resolution, or rotation fields. The output textwindow on the right side will indicate whether the GCP are processed or ignored.If ignored, it normally means that GCPs are outside the field of view. An exampleis shown in figure 3 and enhanced in figure 12. This button is inactive until theprevious one (Load Data) has been pressed.

run: Does the actual georeferencing of the image to the DEM. The graphic outputwindow will show in successive stages (figures 5):

– The whole DEM in camera coordinate system

– The visible part of the DEM superimposed on a greyscale representation ofthe whole DEM

– The visible part of the DEM in camera coordinate system

georeferencing terrestrial photography 5

Page 7: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

3. Scenic way

Figure 2: Greyscale representation of the DEM with camera, target and GCPs positionssuperimposed. Clicking on the load data button will produce this screen.

– A perspective projection of the visible DEM with a superimposed rectangleindicating the view-frame of the camera

– And finally the visible part of the DEM superimposed on the original pho-tographic image.

accept: The final step after clicking the run button shows the visible part of theDEM superimposed on the original photographic image. Every red dot representa grid cell in the original DEM (figure 12). Now it is recommended to use thezoom to assess the fit of the DEM to the image. If the fit is satisfactory, clickon the accept button and a Geotiff file containing the georeferenced map ofreflectance values will be generated (figure 6). If it is not satisfactory the processcan be repeated with corrected parameters by clicking on the start again button

quit: button terminates the process.

georeferencing terrestrial photography 6

Page 8: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

3. Scenic way

Figure 3: Screenshot of the Ground Control Points preview. Zoom in to see the greencrosses indicating GCPs.

Figure 4: Zoom over the Ground Control Points preview. The small window on theright displays a GCP on the top of Mont Brule.

georeferencing terrestrial photography 7

Page 9: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

3. Scenic way

Figure 5: Screenshots of the graphic output. Clockwise from top left: whole DEMin camera coordinate system, visible part of the DEM superimposed on a greyscalerepresentation of the whole DEM, visible part of the DEM in camera coordinate systema perspective projection of the visible DEM with a superimposed rectangle indicatingthe view-frame of the camera.

georeferencing terrestrial photography 8

Page 10: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

3. Scenic way

Figure 6: The final product: a georeferenced map of reflectance values.

georeferencing terrestrial photography 9

Page 11: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

4. Accessory functions

4 Accessory functions

Two accessory procedures are provided to convert from ascii DEM in ArcInfo formatto Geotiff and viceversa.

4.1 Convert to GeoTif

Procedure name: dem tiffw.pro. Convert to Geotiff will display a new GUI toinput all the necessary georeferencing parameters: figure 7. All of the parameters areoptional except the file names. However providing that information may facilitate theuse of the output files in other GIS or remote sensing software. An example is providedin the settings file geotiffch1903.gset. This correspond to the Swiss topo projection forthe provided file hautglac.tif. A detailed explanation of the GeoTIFF specifications isprovided at http://www.remotesensing.org/geotiff/spec/geotiffhome.html.

Figure 7: GUI for the conversion from ascii to Geotiff procedure.

georeferencing terrestrial photography 10

Page 12: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

5. Geometrical transformations

4.2 Convert to ASCII

Procedure name: tiff demw.pro. Convert to ascii will display a new GUI to inputfile names of the original Geotiff and the output ascii file: figure 8.

Figure 8: GUI for the conversion from Geotiff to ascii procedure.

4.3 Viewshed calculation

The viewshed mask must be computed from the point of view of the camera with avision field slightly larger than that of the camera lens, to allow for fine adjustments inthe orientation of the camera. In the future a routine for the calculation of viewshedmask will be provided, at present the user need to calculate it using external GISsoftware. ArcGIS or the open source GRASS (http://grass.itc.it/) among others aresuitable for this task. The reader is directed to the paper by Wang et al. (2000) for anefficient viewshed algorithm.

Tip: To estimate the field of view prior to the viewshed calculation, run the photo-georef.pro with any existing filename in the visibility field, click on load data and theoutput text window on the right side will display the viewing azimuth, viewing elevationand camera field of view (figure 9)

5 Geometrical transformations

In order to georeference terrestrial photographs we need to find a function relatingtwo-dimensional pixels in the photograph to three-dimensional points in the digitalelevation model. A DEM is a discrete mathematical representation of the terrain. Wecan, a priori, replicate the geometry of the image formation inside the camera on theDEM by applying the necessary viewing transformations and perspective projections.In this way we produce a “virtual” photograph of the digital elevation model, that is, atwo-dimensional representation of the relief information contained in the DEM, as seen

georeferencing terrestrial photography 11

Page 13: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

5. Geometrical transformations

Figure 9: Text output window showing the calculated field of view horizontal andvertical angles.

from the point of view of the camera. By scaling this representation according to theresolution of the photograph, we can establish the necessary correspondence betweenpixels in the image, screen coordinates of the perspective projection of the DEM andtheir geographic location.

The first viewing transformation redefines the original coordinates of the DEM,taking as origin of coordinates the position of the camera. This is equivalent to asimple translation. The second viewing transformation rotates the original orthogonalAxis of the DEM, aligned Eastwards, Northwards, and Upwards to make them coincidewith the orientation of the camera as shown in Figure 10.

A detailed description of the geometric transformation is given by Corripio (2004)and a summary of the equations are below. Additional useful information on rotationalmatrices and geometrical transformations can be found in Fiume (1989), Foley et al.(1990), Watt and Watt (1992) or in Goldstein (1980).

The georeferencing process consists of a viewing transformation applied to the DEMin which the coordinates of every grid cell are firstly translated to refer them to acoordinate system with origin at the camera position. Then a transformation is appliedaccording to the viewing direction and focal length of the camera (Equation 1). Thisresults in a three dimensional set of points corresponding to the cells in the DEM asseen from the point of view of the camera (Figure 12). Finally, the resulting viewing

georeferencing terrestrial photography 12

Page 14: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

5. Geometrical transformations

Figure 10: Schematic representation of the world (or DEM) and the camera referencesystems.

transformation is projected into a two dimensional viewing “window”, corresponding tothe area of the film and scaled proportionally as indicated in Figure 11 and Equation 6.The process allows a direct comparison of the image and the perspective projection ofthe DEM. If the result is satisfactory, the pixels in the image are allocated the x,y,zvalues of the corresponding grid cells in the DEM. The result is a georeferenced mapof reflectance values shown in Figure 6.

The viewing transformation, which rotates the translated coordinates according tothe viewing reference system is:

Pcx

Pcy

Pcz

w

=

Ux Uy Uz 0Vx Vy Vz 0Nx Ny Nz 00 0 1/f 1

Ptx

Pty

Ptz

1

, (1)

where f is the focal length of the lens, Pt is the translated point to a reference systemwith origin at C, the camera position (simply by adding the inverse of the cameracoordinates to the original world coordinates), N,U, V are vectors defining the viewinggeometry and Pc is the resulting coordinates of a point in camera coordinate system.

The calculation of the unit vectors defining the viewing geometry is as follows. Theviewing direction or vector ~N is :

~N0 = T − C, (2)

georeferencing terrestrial photography 13

Page 15: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

5. Geometrical transformations

Figure 11: Georeferencing process. The coordinates of the original 3D landscape aretransformed to the camera referenced system and then projected onto a viewing windowcorresponding to the flat 2D camera film or electronic sensor.

~N =~N0

| ~N0|, (3)

where T is the coordinates of the the target (aim of the camera) and C the coordinatesof the camera with respect to the DEM origin of coordinates.

From this vector, and applying a procedure slightly modified from that used byFiume (1989) or Watt and Policarpo (1998), ~U and ~V are calculated using simplevector calculus, by finding the cross products:

~U =

~N ×

~Nxy

| ~Nxy |ifNz > 0

~Nxy

| ~Nxy |× ~N ifNz < 0

(4)

~V = ~N × ~U, (5)

where ~Nxy is the projection of ~N onto the horizontal plane, or (Nx, Ny, 0), and Nz thez coordinate of vector ~N .

The resulting x, y coordinates of the final perspective projection, following Wattand Watt (1992), are calculated as:

Ppx =fPcx12wPcz

and Ppy =fPcy12wPcz

, (6)

georeferencing terrestrial photography 14

Page 16: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

6. Additional comments on the equipment

Figure 12: Grid cells from a DEM represented as red dots are transformed into aperspective projection and superimposed on the photograph of the glaciers. Greencrosses are ground control points taken with a differential GPS and used for fast photoorientation

where Pp(x,y) are the new x, y coordinates of the perspective projection of the pointPc(x,y,z) onto the projection plane, which in this case is the film. The factor 1/2 isintroduced in the denominator to set the origin of coordinates in the projection planeto the centre of the film.

6 Additional comments on the equipment

Conventional cameras are far less accurate than photogrammetric cameras, nonethe-less, conventional photography can provide accurate enough images to detect preciselychanges within the resolution of commonly used DEMs, that is 10 to 50m. However,some attention should be paid to the quality of the lenses. A fixed focal lens for areflex camera usually does a good job. It should be noticed that many manufacturersfollow a secrecy policy regarding the specifications of their products. A 24mm lens forexample usually never has a focal length of 24mm, but can be as much as 15% higher(25 or 26mm). Some manufacturers, though, are transparent about their product spec-ifications, which makes the application of this technique simpler. Otherwise, some labtests to find out the real focal length are recommendable.

georeferencing terrestrial photography 15

Page 17: Georeferencing oblique terrestrial photographywebarchiv.ethz.ch/arolla/IDL/georefusermanual.pdfGeoreferencing oblique terrestrial photography geophotoref V. 1.0 User’s Manual Javier

REFERENCES

References

Corripio, J. G.: 2004, Snow surface albedo estimation using terrestrial photography,International Journal of Remote Sensing 25(24), 5705–5729. http://www.ihw.ethz.ch/staff/jcorripi/corripio04.pdf.

Fiume, E. L.: 1989, The mathematical structure of raster graphics, Academic Press,Boston.

Foley, J. D., van Dam, A., Feiner, S. K. and Hughes, J. F.: 1990, Computer graphics,principles and practice, Adison-Wesley, Reading, Massachusetts.

Goldstein, H.: 1980, Classical mechanics, 2nd edn, Addison-Wesley, Reading, Mass.672 p.

Wang, J., Robinson, G. J. and White, K.: 2000, Generating viewsheds without usingsightlines, Photogrammetric Engineering and Remote Sensing 66(1), 87–90.

Watt, A. H. and Policarpo, F.: 1998, The computer image, Addison-Wesley, Harlow.

Watt, A. H. and Watt, M.: 1992, Advanced animation and rendering techniques: theoryand practice, ACM Press: Addison-Wesley, New York.

georeferencing terrestrial photography 16