[IEEE 2008 5th International Conference on Electrical Engineering, Computing Science and Automatic...

4
2008 5th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE 2008) Smooth Three-dimensional Reconstruction from Contour Maps Luis Gerardo de la Fraga Cinvestav, Computer Science Department Av. Instituto Politecnico Nacional 2508. 07360 Mexico City, Mexico. E-mail: [email protected] Abstract- In this paper a method to perform a smooth three-dimensional reconstruction from a con- tour map of a terrain is presented. The input data to the proposed method is 3D points of polygonal lines that represent contour maps with the elevation information included; such data is available at INEGI in the case of Mexico. The obtained 3D reconstruction is represented by a triangle mesh. The main idea of the proposed method is to include intermediate points among con- tour lines to avoid the problem of flat triangles, thus a good reconstruction with smooth changes in its surface can be achieved. The intermediate points are selected from the skeleton of the contour lines, and their heights are calculated automatically. The method is tested with simulated data to shown its effectiveness. Keywords: Visualization, computational geometry, ter- rain reconstruction, crust and skeleton. I. INTRODUCTION Even today most of the world's databases of terrain elevation from traditional mapping agencies (Le., INEGI [1]) are stored in the form of contour overlays. These maps have the advantage that they were developed using human understanding of the observed landforms, using photogrammetry techniques. But their disadvantage con- sist in the fact that they can not be easily converted to a useful three-dimensional format. Due to the high cost of direct terrain elevation capture methods, cartographic maps are preferred [2]. Therefore, methods that obtain a 3D reconstruction of a terrain from cartographic contour maps have to be developed. The problem of terrain reconstruction can be seen as a special case of the general problem of three-dimensional reconstruction from cross bi-dimensional sections. Recon- struction in this field means an interpolation problem of n contours each one with a specific elevation. The characteristic feature of these contours is they are not intersected and they are nested. In [3] was proposed a method to perform 3D recon- structions of terrains. Their method uses an image of the contour map as the input, and apply several image pro- cessing techniques to calculate the skeleton. Their method also uses all the skeleton points. The disadvantages of that method are that it does not use vectorial data as the input, and it uses all skeleton points that increase the number of points in the final reconstruction. In this work I propose a new efficient method to obtain a terrain reconstruction from vectorial data that are offered by INEGI, and it is used only the necessary points of the skeleton to avoid the flat triangles. Flat triangles, triangles with the same height in its three vertices, pose a problem because they do not represent the trend of the terrain surface and therefore they produce a rough visualization. In the next section, the proposed method together with some results to illustrate it will be presented. Finally, in section III conclusions of this work are drawn. II. SMOOTH RECONSTRUCTION To obtain a smooth reconstruction, the following tasks should be performed: 1) Resample the contour lines, 2) Calculate the geometrical forms of the skeleton and crust, 3) Select the necessary skeleton points to eliminate the plane triangles, 4) Organize points obtained in step (3) in graphs, 5) Classify the obtained graphs, 6) Assign heights to every point in graphs, 7) Calculate the Delaunay triangulation with points obtained in (1) and (5), and finally 8) Visualize the obtained reconstruction A. Sampling the contour lines The skeleton is an approximation of the Medial Axis 'Transform [4]. It can be calculated from vectorial data, in this case the contour lines, if the curves of the contour lines are sampled with a sampling distance less than 0.42 of the half of the shortest distance among all curves. This condition was discovered by Amenta [5]. Therefore, first it is necessary to calculate the shortest distance among all curves. This is an O(n 4 ) algorithm using a brute force solution: to find the closest pair of points between two polygonal curves takes an O(n 2 ) effort, and all the pairs of curves must be checked which it is also an O(n 2 ) effort. It is possible to avoid all comparisons using a square window around each point and using only the points inside this window to perform the comparisons. The Cohen-Sutherland algorithm [6] for clipping lines can be easily modified to test weather a point is inside the window. IEEE Catalog Number: CFP08827-CDR ISBN: 978-1-4244-2499-3 Library of Congress: 2008903800 978-1-4244-2499-3/08/$25.00 ©2008 IEEE 364

Transcript of [IEEE 2008 5th International Conference on Electrical Engineering, Computing Science and Automatic...

Page 1: [IEEE 2008 5th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE) - Mexico City, Mexico (2008.11.12-2008.11.14)] 2008 5th International

2008 5th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE 2008)

Smooth Three-dimensional Reconstruction fromContour Maps

Luis Gerardo de la FragaCinvestav, Computer Science Department

Av. Instituto Politecnico Nacional 2508. 07360 Mexico City, Mexico.E-mail: [email protected]

Abstract- In this paper a method to perform asmooth three-dimensional reconstruction from a con­tour map of a terrain is presented. The input data to theproposed method is 3D points of polygonal lines thatrepresent contour maps with the elevation informationincluded; such data is available at INEGI in the case ofMexico. The obtained 3D reconstruction is representedby a triangle mesh. The main idea of the proposedmethod is to include intermediate points among con­tour lines to avoid the problem of flat triangles, thus agood reconstruction with smooth changes in its surfacecan be achieved. The intermediate points are selectedfrom the skeleton of the contour lines, and their heightsare calculated automatically. The method is tested withsimulated data to shown its effectiveness.Keywords: Visualization, computational geometry, ter­rain reconstruction, crust and skeleton.

I. INTRODUCTION

Even today most of the world's databases of terrainelevation from traditional mapping agencies (Le., INEGI[1]) are stored in the form of contour overlays. Thesemaps have the advantage that they were developed usinghuman understanding of the observed landforms, usingphotogrammetry techniques. But their disadvantage con­sist in the fact that they can not be easily converted toa useful three-dimensional format. Due to the high costof direct terrain elevation capture methods, cartographicmaps are preferred [2]. Therefore, methods that obtain a3D reconstruction of a terrain from cartographic contourmaps have to be developed.

The problem of terrain reconstruction can be seen as aspecial case of the general problem of three-dimensionalreconstruction from cross bi-dimensional sections. Recon­struction in this field means an interpolation problemof n contours each one with a specific elevation. Thecharacteristic feature of these contours is they are notintersected and they are nested.

In [3] was proposed a method to perform 3D recon­structions of terrains. Their method uses an image of thecontour map as the input, and apply several image pro­cessing techniques to calculate the skeleton. Their methodalso uses all the skeleton points. The disadvantages of thatmethod are that it does not use vectorial data as the input,and it uses all skeleton points that increase the number ofpoints in the final reconstruction.

In this work I propose a new efficient method to obtain aterrain reconstruction from vectorial data that are offeredby INEGI, and it is used only the necessary points of theskeleton to avoid the flat triangles. Flat triangles, triangleswith the same height in its three vertices, pose a problembecause they do not represent the trend of the terrainsurface and therefore they produce a rough visualization.

In the next section, the proposed method together withsome results to illustrate it will be presented. Finally, insection III conclusions of this work are drawn.

II. SMOOTH RECONSTRUCTION

To obtain a smooth reconstruction, the following tasksshould be performed:

1) Resample the contour lines,2) Calculate the geometrical forms of the skeleton and

crust,3) Select the necessary skeleton points to eliminate the

plane triangles,4) Organize points obtained in step (3) in graphs,5) Classify the obtained graphs,6) Assign heights to every point in graphs,7) Calculate the Delaunay triangulation with points

obtained in (1) and (5), and finally8) Visualize the obtained reconstruction

A. Sampling the contour lines

The skeleton is an approximation of the Medial Axis'Transform [4]. It can be calculated from vectorial data,in this case the contour lines, if the curves of the contourlines are sampled with a sampling distance less than 0.42of the half of the shortest distance among all curves. Thiscondition was discovered by Amenta [5].

Therefore, first it is necessary to calculate the shortestdistance among all curves. This is an O(n4 ) algorithmusing a brute force solution: to find the closest pair ofpoints between two polygonal curves takes an O(n2 ) effort,and all the pairs of curves must be checked which it isalso an O(n2 ) effort. It is possible to avoid all comparisonsusing a square window around each point and using onlythe points inside this window to perform the comparisons.The Cohen-Sutherland algorithm [6] for clipping lines canbe easily modified to test weather a point is inside thewindow.

IEEE Catalog Number: CFP08827-CDRISBN: 978-1-4244-2499-3Library ofCongress: 2008903800978-1-4244-2499-3/08/$25.00 ©2008 IEEE

364

Page 2: [IEEE 2008 5th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE) - Mexico City, Mexico (2008.11.12-2008.11.14)] 2008 5th International

2008 5th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE 2008)

To resample the contour lines, it is necessary to inter­polate their points with cubic splines. The samples will bein smaller distances than actual points are, therefore theapproximation of Euclidean distance among the sampledpoints can be used to sampling the cubic splines. Onlyas an example, to sample a closed curve the followingprocedure can be used:

Require: Po, PI, P2, ... , Pn, n + 1 input points, D thedistance among sampled points.

Ensure: A list £ of resampled points of the given contourlinet f- 0, k f- 0, Pa f- Pkrepeat

If-k+1Pb f- PI%n

do +- distance(Pa, Pb)j+-lwhile do < D do

Pa +- Pbj++Pb +- Pj%n

d ~ distance (Pa, Pb)do~do+d

if j > 1 thend2 +- dO - dd~D-d2

k~j

if k > n thenbreak

t +- bisection(k, 0,1, d2 )

elset +- bisection(k, t, 1, D)

Pa +- calculate_point(k, t)£ ~ £ +Pa

until k ==== nProcedure bisection(k, 0,1, D, d2 ) uses bisection method

to calculate a point in the spline k, between t == 0 and t == 1such that the distance from the initial point (at t == 0)is equal to d2 . Procedure calculate_point(k, t) calculate apoint in the spline k at the parametric value t.

It is not necessary to resample all curves at the samesampling length. Dividing the map in regions can reducethe final total number of points.

B. Points to avoid flat triangles

I am going to explain how the geometrical forms of theskeleton and crust are calculated and how at the sametime, the skeleton's edges which avoid the fiat trianglesare selected.

The method to calculate the skeleton and crust wereproposed in [5] and a fast algorithm to calculate them[7] will be described here. It is necessary to calculate theVoronoi diagram of the set of resampled points. For thistask, Qhull program [8] was used.

For each edge (A, C) on the contour and its correspond­ing Voronoi edge (B, D), as it is shown in Fig. 1(1), the

A C

~~A C

~~Figure 1: Possible cases on points positions for theInsideCircle(A, B, C, D) test.

test InsideCircle is computed. If the test is positive (itis greater than zero), meaning that D lie outside of thecircle drawn through (A, B, C), then edge (A, C) is partif the crust. And if the test fails, the Voronoi edge (B, D)is included in the skeleton. Therefore, the crust are theedges corresponding to the points in the contour linesand the skeleton is built with the Voronoi edges. TheInsideCircle(A, B, C, D) is calculated as the determinantof 3 x 3 matrix:

[

(XA - XD)2 + (YA - YD)2 (XA - XD) (YA - YD)](XB - XD)2 + (YB - YD)2 (XB - XD) (YB - YD) .(xc - XD)2 + (Yc - YD)2 (xc - XD) (yc - YD)

Besides the situation described by Fig. 1(1), there areother three possibilities that must be checked: in Fig.1(2) points (A, B, C) are clockwise and (D) is inside thecircle, in Fig. 1(3) points (A, D, C) are counterclockwiseand (B) is inside the circle, and in 1(4) points (A, D, C)are clockwise and (B) is inside the circle.

By the definition, a fiat triangle has its three verticeswith the same height. Therefore, if the correspondingheights of the two points over the contour, correspondingto the Voronoi edge that was selected to be part of theskeleton, are equal, then that Voronoi edge is selected. Allthe other skeleton edges are discharged.

In Fig. 2(c) three contour lines and parts of the skeletonthat was selected with this step of the method are shown.

c. Graphs classification

As a result from the previous step, the selection ofskeleton's edges that to eliminate the flat triangles, theseedges form connected graphs. It is possible to distinguishfour cases of graphs:

1) Graphs inside summits, as the two graphs markedwith '1' in Fig. 2(c).

2) Graphs between two level curves with the sameheight, as the one marked with '2' in Fig. 2(c).

3) Re-entrant graphs inside a contour line as the graphmarked with '3' in Fig. 2(c).

4) Re-entrant graphs outside a contour line, it ismarked with '4' in Fig. 2(c).

The problem now is how to recognize every graph andhow to assign automatically the heights to every vertex in

IEEE Catalog Number: CFP08827-CDRISBN: 978-1-4244-2499-3Library ofCongress: 2008903800978-1-4244-2499-3/08/$25.00 ©2008 IEEE

365

Page 3: [IEEE 2008 5th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE) - Mexico City, Mexico (2008.11.12-2008.11.14)] 2008 5th International

2008 5th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE 2008)

Figure 3: Examples of reconstructions of map in Fig. 2(a)without the skeleton points that eliminate the flat trian­gles, and in (b) using points that eliminate flat triangles.

(b)

(a)

the graph. This is an easy task for graphs type '2': theycome from two different contour lines, and their verticesedges must be the height

Figure 2: An example of a terrain with three contour linesin (a). In (b) there are the same contour lines and thewhole skeleton. In figure (c) there are the contour linesand the graphs of the parts of the skeleton that eliminatethe flat triangles.

where hI is the height of the associated contour lines of thegraph and a is the height between two consecutive contourlines (by definitions a is the same in all the map).

Graphs of type '1' and '3' are similar: the assignedheights to their vertices must be higher than the associatedcontour line (from which they were selected). Thus, theheight of the vertices for these graphs are calculated as:

arih = h I - -- (3)

2rMAX

How to recognize automatically each graph type? Type'2' are different of the others and can be recognized whenit is built. Graphs '1' and '3' are inside the associatedcontour line, and graphs '4' are outside of the associatedcontour line. To distinguish graphs type '1' and '3' fromtype '4' it is used an algorithm to test weather any pointof the graph lies within the polygon represented by thecontour line [10, p. 239-245] .

D. Visualization

In Fig. 3 is shown the final reconstruction of data inFig. 2(c): all graph's vertices have their height calculatedand a Delaunay triangulation was calculated with all thepoints with their 2D (x, y) values.

In Fig. 4 is shown an example of application of the wholemethod to real data.

III. CONCLUSIONS

A method to obtain a smooth reconstruction from acontour map of a terrain was presented. The method

where ri is the distance of vertex i on the graph to theassociated contour line, and rMAX is the maximum ofall these distances. The expression (2) to calculated theheights was proposed in [9]. A good approximation of rdistances can be calculated at the same time when skeletonedges were selected: r is the distance to each vertex to anyof the associated vertices on contour lines.

Finally, the height for vertices of graphs type '4' arelower that the height of the associated contour line, andit is calculated as:

(2)

(1)a

h = hI - ­2

IEEE Catalog Number: CFP08827-CDRISBN: 978-1-4244-2499-3Library of Congress: 2008903800978-1-4244-2499-3/08/$25.00 ©2008 IEEE

366

Page 4: [IEEE 2008 5th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE) - Mexico City, Mexico (2008.11.12-2008.11.14)] 2008 5th International

2008 5th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE 2008)

(b)

(a)

Figure 4: Application of the method to a part taken of the INEGI's topographic map E14B47, in (a) the crust (it isthe set of contour lines) and the skeleton, and in (b) a view of the 3D reconstruction.

automatically compute the heights of vertices obtainedfrom the skeleton of the contour lines in order to eliminatethe flat triangles. Flat triangles is a problem because theydo not represent the trend of the terrain surface andtherefore they produce a rough visualization. Without theflat triangles we obtain a good, srnooth, 3D visualizationof the reconstructed terrain.

The method uses several algorithms of ComputationalGeometry applied to vectorial data of contour lines mapswith elevation information that can be obtained fromtraditional mapping agencies, Le. from INEGI in the caseof Mexico.

REFERENCES

[1] Instituto Nacional de Estadistica, Geograffa e Informatica (IN­EGI). http://www.inegLgob.mx.

[2] D. Thibault and C. M. Gold. Terrain reconstruction fromcontours by skeleton construction. GeoInformatica, 4(4):349­373,2000.

[3] A.M. Rivas and L.G. de la Fraga. Terrain reconstruction fromcontour maps. In Proceedings of the 14th International Congresson Computing, pages 36-39. IEEE Press, 2005.

[4] K.R. Castleman. Digital Image Processing. Prentice-Hall, 1996.[5] N. Amenta, M. Bern, and D. Eppstein. The crust and the {3­

skeleton: combinatorial curve reconstruction. Graphical Modelsand Image Processing, 60(2):125-135, 1998.

[6] J.D. Foley, A. van Dam, S.K. Feiner, and J.F. Hughes. ComputerGraphics, principles and practice. Addison-Wesley, 2nd edition,1996.

[7] C. M. Gold and J. Snoeyink. A one-step crust and skeletonextraction algorithm. Algorithmica, pages 144-163, 2001.

[8] C.B. Barber, D.P. Dobkin, and H. Huhdanpaa. The quickhullalgorithm for convex hull. ACM Transactions on MathematicalSoftware, 22(4):469-483, 1996.

[9] C.M. Gold and M. Dakowicz. Visualizing terrain models fromcontours - plausible ridge, valley and slope estimation. InProceedings of the International Workshop on Visualization andAnimation of Landscape. Kumming, China, 2002.

[10] J. O'Rourke. Computational Geometry in C. CambridgeUniversity Press, 2nd edition, 1998.

IEEE Catalog Number: CFP08827-CDRISBN: 978-1-4244-2499-3Library of Congress: 2008903800978-1-4244-2499-3/08/$25.00 ©2008 IEEE

367