[go: up one dir, main page]

CN111899335B - DEM-based image generation method - Google Patents

DEM-based image generation method Download PDF

Info

Publication number
CN111899335B
CN111899335B CN202010743799.9A CN202010743799A CN111899335B CN 111899335 B CN111899335 B CN 111899335B CN 202010743799 A CN202010743799 A CN 202010743799A CN 111899335 B CN111899335 B CN 111899335B
Authority
CN
China
Prior art keywords
data file
elevation
image
triangle
discrete
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN202010743799.9A
Other languages
Chinese (zh)
Other versions
CN111899335A (en
Inventor
成飞飞
付志涛
黄亮
梁国英
牛宝胜
季欣然
马少华
李小祥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Kunming University of Science and Technology
Original Assignee
Kunming University of Science and Technology
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Kunming University of Science and Technology filed Critical Kunming University of Science and Technology
Priority to CN202010743799.9A priority Critical patent/CN111899335B/en
Publication of CN111899335A publication Critical patent/CN111899335A/en
Application granted granted Critical
Publication of CN111899335B publication Critical patent/CN111899335B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T17/00Three dimensional [3D] modelling, e.g. data description of 3D objects
    • G06T17/05Geographic models

Landscapes

  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Geometry (AREA)
  • Software Systems (AREA)
  • Remote Sensing (AREA)
  • Computer Graphics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Processing Or Creating Images (AREA)
  • Stored Programmes (AREA)

Abstract

The application relates to an image generation method based on DEM, which comprises the steps of obtaining a target data file; obtaining an elevation data file or an error data file according to the format of the target data file; respectively constructing a regular grid model for displaying the first image and an irregular triangular grid model for displaying the second image according to the elevation data file; the method solves the problem that the traditional manual numerical value input is easy to make mistakes by reading the target data file, improves the working efficiency, and is convenient for a user to select different models to generate images according to the conditions by constructing a plurality of models to generate the image information of the target data file.

Description

基于DEM的图像生成方法Image generation method based on DEM

技术领域technical field

本申请涉及图像处理技术领域,具体为基于DEM的图像生成方法。The present application relates to the technical field of image processing, specifically a DEM-based image generation method.

背景技术Background technique

数字地形模型(DTM),是定义于二维区域上的一个有限项的向量序列,它以离散分布的平面来模拟连续分布的地形。而DEM,即数字高程模型,是DTM的一个分支,是通过有限的已知地面高程数据点对地形表面进行数字化模拟的数字模型,即通过地表上的不同的分散的数据点建立连续函数来模拟地表的模型,利用构造的函数能够得到地面上任何一个未知点的高程,本质是插值逼近或曲面拟合。DEM可以用数字形式描述和模拟地表形态使它成为空间数据基础设施,现代测绘工程生产、质量控制、精度评定和分析应用等各个方面应用不可分割的一部分,因此,DEM的研究与应用具有重大的现实意义。而DEM的高程内插是生成DEM关键步骤,对DEM的构建生成起着至关重要的作用。The digital terrain model (DTM) is a vector sequence of finite items defined on a two-dimensional area, which uses discretely distributed planes to simulate continuously distributed terrain. And DEM, that is, digital elevation model, is a branch of DTM. It is a digital model that digitally simulates the terrain surface through limited known ground elevation data points, that is, it simulates by establishing a continuous function through different scattered data points on the surface. For the surface model, the elevation of any unknown point on the ground can be obtained by using the constructed function, which is essentially interpolation approximation or surface fitting. DEM can describe and simulate surface morphology in digital form, making it an integral part of spatial data infrastructure, modern surveying and mapping engineering production, quality control, accuracy assessment, and analysis applications. Therefore, the research and application of DEM has great significance. Practical significance. The elevation interpolation of DEM is a key step in generating DEM and plays a vital role in the construction and generation of DEM.

有关地表区域的高程插值的计算若是利用人工手动计算,将是一个枯燥而繁琐的,工作量异常庞大的体力与智力劳动。If the calculation of the elevation interpolation of the surface area is performed manually, it will be a boring and cumbersome, physical and intellectual labor with an extremely large workload.

发明内容Contents of the invention

(一)解决的技术问题(1) Solved technical problems

为解决以上问题,本申请提供了基于DEM的图像生成方法。In order to solve the above problems, this application provides an image generation method based on DEM.

(二)技术方案(2) Technical solutions

为实现上述目的,本申请提供如下技术方案:一种基于DEM的图像生成方法包括:获取目标数据文件;根据所述目标数据文件的格式,判断得出高程数据文件或错误数据文件;当根据所述目标数据文件的格式判断得出为高程数据文件时:根据高程数据文件分别构建用于显示第一图像的规则格网模型和构建用于显示第二图像的不规则三角网模型;存储规则格网模型或不规则三角网模型。In order to achieve the above object, the present application provides the following technical solutions: a DEM-based image generation method comprising: obtaining a target data file; according to the format of the target data file, judging to obtain an elevation data file or an error data file; When the format of the target data file is judged to be an elevation data file: construct a regular grid model for displaying the first image and an irregular triangular mesh model for displaying the second image respectively according to the elevation data file; store the regular grid network model or irregular triangular network model.

优选地,当根据所述目标数据文件的格式判断得出为错误数据文件时,进行提示警告。Preferably, when it is judged according to the format of the target data file that it is an error data file, a warning is given.

优选地,所述高程数据文件包括多个离散点,每个离散点具有平面坐标(Xi,Yi)和高程坐标(Zi)。Preferably, the elevation data file includes a plurality of discrete points, and each discrete point has plane coordinates (X i , Y i ) and elevation coordinates (Z i ).

优选地,根据所述高程数据文件构建用于显示第一图像的规则格网模型包括:根据导入的高程数据文件定义格网宽度和格网间距;根据多个离散点的坐标和格网宽度确定所述规则格网模型的格网区域,所述格网区域包括多个格网点;根据多个离散点坐标和格网间距确定所述格网区域的各个格网点的平面坐标(Xi,Yi);根据各个格网点的平面坐标(Xi,Yi)生成对应格网点的高程坐标(Zi);生成所述高程数据文件的第一图像。Preferably, constructing a regular grid model for displaying the first image according to the elevation data file includes: defining grid width and grid spacing according to the imported elevation data file; determining according to the coordinates of a plurality of discrete points and the grid width The grid area of the regular grid model, the grid area includes a plurality of grid points; determine the plane coordinates (X i , Y i ); generating the elevation coordinates (Z i ) of the corresponding grid points according to the plane coordinates (X i , Y i ) of each grid point; generating the first image of the elevation data file.

优选地,比较多个离散点的平面坐标(Xi,Yi),获取最小离散点的平面坐标(Xmin,Ymin)和最大离散点的平面坐标(Xmax,Ymax);根据格网间距、最小离散点的平面坐标(Xmin,Ymin)和最大离散点的平面坐标(Xmax,Ymax)获取所述格网区域的行数和列数;以最小离散点的平面坐标(Xmin,Ymin)为基点,依次增加行数和列数,生成各个格网点的平面坐标(Xi,Yi)。Preferably, compare the plane coordinates (X i , Y i ) of multiple discrete points, and obtain the plane coordinates (X min , Y min ) of the smallest discrete point and the plane coordinates (X max , Y max ) of the largest discrete point; according to the grid The grid spacing, the plane coordinates (X min , Y min ) of the minimum discrete point and the plane coordinates (X max , Y max ) of the maximum discrete point obtain the number of rows and columns of the grid area; the plane coordinates of the minimum discrete point (X min , Y min ) as the base point, increase the number of rows and columns in turn to generate the plane coordinates (X i , Y i ) of each grid point.

优选地,根据任一离散点的平面坐标(Xi,Yi)的数值进行内插计算得出该离散点的高程坐标(Zi);依次根据各个离散点的平面坐标(Xi,Yi)的数值内插计算得出各个离散点的高程坐标(Zi)。Preferably, the elevation coordinate (Z i ) of the discrete point is obtained by interpolation calculation according to the value of the plane coordinate (X i , Y i ) of any discrete point; in turn, according to the plane coordinate (X i , Y The elevation coordinates (Z i ) of each discrete point are calculated by numerical interpolation of i ).

优选地,根据所述高程数据文件构建用于显示第二图像的不规则三角网模型的步骤如下:Preferably, the steps of constructing an irregular triangulation model for displaying the second image according to the elevation data file are as follows:

T01,构建覆盖所有离散点的多边形,在多边形内划分出多个初始三角形;T01, construct a polygon covering all discrete points, and divide multiple initial triangles within the polygon;

T02,在多边形中取一离散点Q;T02, take a discrete point Q in the polygon;

T03,从T01中取一初始三角形;T03, take an initial triangle from T01;

T04,判断T02的离散点Q是否在该初始三角形的外接圆内,若T02的离散点Q不在该初始三角形的外接圆内,重复步骤T03~T04;T04, judging whether the discrete point Q of T02 is within the circumcircle of the initial triangle, if the discrete point Q of T02 is not within the circumcircle of the initial triangle, repeat steps T03-T04;

T05,若T02的离散点Q在该初始三角形的外接圆内,将该初始三角形加入待拆分三角形队列;T05, if the discrete point Q of T02 is within the circumcircle of the initial triangle, add the initial triangle to the queue of triangles to be split;

T06,判断T01中的多个初始三角形是否都计算完毕,若未计算完毕则重复步骤T03~T06;T06, judging whether the multiple initial triangles in T01 have been calculated, if not, repeat steps T03-T06;

T07,若计算完毕,将所有待拆分三角形拆为三条边,并去除重复的边;T07, if the calculation is completed, split all triangles to be split into three sides, and remove duplicate sides;

T08,将未去除的拆分边与离散点Q构建最终三角形;T08, construct the final triangle with the unremoved split edges and the discrete points Q;

T09,判断所有离散点是否都计算完毕,未计算完毕则重复步骤T02~T09;T09, judge whether all the discrete points have been calculated, if not, repeat steps T02~T09;

T10,计算完毕后,所有最终三角形共同构成所述高程数据文件的第二图像。T10. After the calculation is completed, all the final triangles together constitute the second image of the elevation data file.

优选地,根据所述高程数据文件构建用于显示第二图像的不规则三角网模型的步骤如下:Preferably, the steps of constructing an irregular triangulation model for displaying the second image according to the elevation data file are as follows:

S01,连接间距最小的两离散点作为基边Ei(P1P2);S01, connect the two discrete points with the smallest distance as the base edge E i (P 1 P 2 );

S02,将多个离散点分为在基边Ei(P1P2)左方的左队列L和在基边Ei(P1P2)右方的右队列R;S02, divide a plurality of discrete points into the left queue L on the left side of the base edge E i (P 1 P 2 ) and the right queue R on the right side of the base edge E i (P 1 P 2 );

S03,判断基边Ei(P1P2)左方是否可以构建三角形,若可以,则生成基边Ei(P1P2)左方的三角形;S03, judging whether a triangle can be constructed to the left of the base edge E i (P 1 P 2 ), if possible, generate a triangle to the left of the base edge E i (P 1 P 2 );

S04,若不可以构建三角形,则在左队列L内取一离散点Pn,并计算离散点Pn与基边Ei的两端点P1P2的距离和D;S04, if the triangle cannot be constructed, then take a discrete point P n in the left queue L, and calculate the distance sum D between the discrete point P n and the two ends P 1 P 2 of the base edge E i ;

S05,判断距离和D是否小于最小记录值,初始值为无穷大,若不小于最小记录值,则重复步骤S04~S05;S05, judging whether the distance sum D is less than the minimum record value, the initial value is infinity, if not less than the minimum record value, then repeat steps S04-S05;

S06,若小于最小记录值,则记录离散点PnS06, if it is less than the minimum record value, record the discrete point P n ;

S07,判断左队列L的所有离散点是否比较完毕,若没有比较完毕,则重复步骤S04~S07;S07, judging whether all the discrete points of the left queue L have been compared, if not, repeat steps S04-S07;

S08,若比较完毕,则生成基边Ei(P1P2)左方的三角形;S08, if the comparison is completed, then generate a triangle on the left of the base edge E i (P 1 P 2 );

S09,重复步骤S03~S08,以生成基边Ei(P1P2)右方的三角形;S09, repeating steps S03-S08 to generate a triangle on the right side of the base edge E i (P 1 P 2 );

S10,基边Ei(P1P2)左方的三角形和基边Ei(P1P2)右方的三角形共同构成所述高程数据文件的第二图像。S10, the triangle on the left of the base edge E i (P 1 P 2 ) and the triangle on the right of the base edge E i (P 1 P 2 ) together constitute the second image of the elevation data file.

(三)有益效果(3) Beneficial effects

与现有技术相比,本申请的有益效果是:该基于DEM的图像生成方法包括获取目标数据文件;根据所述目标数据文件的格式,得出高程数据文件或错误数据文件;根据高程数据文件分别构建用于显示第一图像的规则格网模型和构建用于显示第二图像的不规则三角网模型;存储规则格网模型或不规则三角网模型,该方法通过读取目标数据文件,解决传统手动输入数值易出错的问题,提高工作效率,且通过构建多个模型生成目标数据文件的图像信息,便于用户根据情况选择不同的模型来生成图像。Compared with the prior art, the beneficial effects of the present application are: the DEM-based image generation method includes obtaining the target data file; according to the format of the target data file, the elevation data file or the error data file is obtained; according to the elevation data file Constructing a regular grid model for displaying the first image and an irregular triangular network model for displaying the second image respectively; storing the regular grid model or the irregular triangular network model, the method solves the problem by reading the target data file The problem of error-prone traditional manual input values improves work efficiency, and the image information of the target data file is generated by building multiple models, which is convenient for users to choose different models to generate images according to the situation.

附图说明Description of drawings

附图用来提供对本申请的进一步理解,并且构成说明书的一部分,与本申请的实施例一起用于解释本申请,并不构成对本申请的限制,在附图中:The accompanying drawings are used to provide a further understanding of the application, and constitute a part of the description, and are used to explain the application together with the embodiments of the application, and do not constitute a limitation to the application. In the accompanying drawings:

图1示出了本申请的实施例基于DEM的图像生成方法的流程图;Fig. 1 shows the flow chart of the image generation method based on DEM of the embodiment of the present application;

图2示出了本申请的实施例构成格网区域的流程图;Fig. 2 shows the flowchart of forming the grid area according to the embodiment of the present application;

图3示出了本申请的实施例构成格网点的流程图;Fig. 3 shows the flowchart of forming grid points according to the embodiment of the present application;

图4示出了本申请的实施例生成格网点高程值的流程图;Fig. 4 shows the flow chart that the embodiment of the present application generates grid point elevation value;

图5示出了本申请的实施例泰森多边形法生成第二图像的流程图;Fig. 5 shows the flowchart of generating the second image by the Thiessen polygon method in an embodiment of the present application;

图6示出了本申请的实施例最短边长算法生成第二图像的流程图;Fig. 6 shows the flow chart of generating the second image by the shortest side length algorithm of the embodiment of the present application;

图7示出了本申请的实施例计算机程序提取文件界面图;Fig. 7 shows the computer program of the embodiment of the application to extract the file interface diagram;

图8示出了本申请的实施例计算机程序生成规则格网的界面图;FIG. 8 shows an interface diagram of a computer program generating a regular grid according to an embodiment of the present application;

图9示出了本申请的实施例计算机程序生成TIN的界面图;Fig. 9 shows the interface diagram of the TIN generated by the computer program of the embodiment of the present application;

图10示出了本申请的实施例计算机程序保存文件的界面图;Fig. 10 shows the interface diagram of the computer program preservation file of the embodiment of the present application;

图11示出了本申请的实施例离散点的向量叉乘简易图;Fig. 11 shows the vector cross product simple figure of the discrete point of the embodiment of the present application;

图12示出了本申请的实施例高程数据文件的数值排列。Fig. 12 shows the numerical arrangement of the elevation data file of the embodiment of the present application.

图中:第一图像100、第二图像200、DEM高程内插界面10、提示界面10a、格网宽度界面10b、警告界面10c、文件按钮11、打开文件按钮11a、保存内插文件按钮11b、保存grid按钮11b-1、保存TIN按钮11b-2、生成DEM按钮12、生成规则格网按钮12a、生成TIN按钮12b、泰森多边形法按钮12b-1、最近距离算法按钮12b-2、最短边长算法12b-3、放大按钮13、缩小按钮14、显示模式按钮15、显示形状按钮15a、显示高程显示按钮15c、显示高程与形状按钮15b。In the figure: first image 100, second image 200, DEM elevation interpolation interface 10, prompt interface 10a, grid width interface 10b, warning interface 10c, file button 11, open file button 11a, save interpolation file button 11b, Save grid button 11b-1, Save TIN button 11b-2, Generate DEM button 12, Generate Regular Grid button 12a, Generate TIN button 12b, Thiessen polygon method button 12b-1, Shortest distance algorithm button 12b-2, Shortest edge Long Algorithm 12b-3, Zoom In Button 13, Zoom Out Button 14, Display Mode Button 15, Display Shape Button 15a, Display Elevation Display Button 15c, Display Elevation & Shape Button 15b.

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.

参阅附图1-附图12,本申请实施例公开一种基于DEM的图像生成方法,该基于DEM的图像生成方法包括:Referring to accompanying drawing 1-accompanying drawing 12, the embodiment of the present application discloses a kind of image generation method based on DEM, this image generation method based on DEM comprises:

获取目标数据文件;根据目标数据文件的格式,判断得出高程数据文件或错误数据文件;Obtain the target data file; according to the format of the target data file, determine the elevation data file or the wrong data file;

如附图12所示,该方法识别目标数据文件的内部文本是采用N行四列的数值排列方式,且首列为序号,其余三列为坐标值(X,Y,Z)的数据组合,判定为高程数据文件,反之则判定为错误数据文件,当根据目标数据文件的格式判断得出为错误数据文件时,可以为用户做出相关提示进行警告,以便用户进行修改或替换目标数据文件,有利于图像的快速生成;其中,高程数据文件为真实地表点的观测数据,数据量比较多,使得观测数据都以文件形式进行保存,本方法通过读取文件的方式,无需用户手工输入,避免手工输入错误,导致生成的图像与预期不符。As shown in Figure 12, this method recognizes the internal text of the target data file using a numerical arrangement of N rows and four columns, and the first column is a serial number, and the remaining three columns are data combinations of coordinate values (X, Y, Z). It is judged as an elevation data file, otherwise it is judged as an error data file. When it is judged as an error data file according to the format of the target data file, relevant prompts and warnings can be given to the user so that the user can modify or replace the target data file. It is conducive to the rapid generation of images; among them, the elevation data file is the observation data of real surface points, and the amount of data is relatively large, so that the observation data are all saved in the form of files. This method does not require manual input by the user by reading the file, avoiding A manual input error resulted in the resulting image not being as expected.

当根据目标数据文件的格式判断得出为高程数据文件时,根据高程数据文件分别构建用于显示第一图像的规则格网模型和构建用于显示第二图像的不规则三角网模型;When judged to be the elevation data file according to the format of the target data file, a regular grid model for displaying the first image and an irregular triangular network model for displaying the second image are respectively constructed according to the elevation data file;

具体的,规则格网模型的英文简称为grid,是在高斯投影平面上一系列在X,Y方向上等间隔排列的地形点的平面坐标(X,Y)及其高程(Z)的数据集。其任意一点的平面坐标可根据该点在DEM中的行列号i,j及存放在该DEM文件头部或DEM辅助文件的基本信息推算出来。这些基本信息应包含DEM起始点(一般为左上角)坐标X0,Y0。DEM在X方向与Y方向的间隔X0,Y0及DEM行列数M,N等,其中,规则格网的X,Y值通过通用算法实现,而高程值Z通过加权平均法、移动曲面拟合法等高程值内插算法实现,规则格网具有便于使用,可以通过计算机、手机等载体快速地进行数据处理的优点,且能广泛应用到等高线计算、坡度坡向计算、山坡阴影计算和自动提取流域地形等方面;Specifically, the English abbreviation of the regular grid model is grid, which is a data set of plane coordinates (X, Y) and elevation (Z) of a series of terrain points arranged at equal intervals in the X and Y directions on the Gaussian projection plane . The plane coordinates of any point can be calculated according to the row and column number i, j of the point in the DEM and the basic information stored in the head of the DEM file or the DEM auxiliary file. These basic information should include the coordinates X0, Y0 of the DEM starting point (usually the upper left corner). The interval X0 and Y0 of DEM in the X direction and the Y direction and the number of DEM rows and columns M, N, etc., among which, the X and Y values of the regular grid are realized by a general algorithm, and the elevation value Z is realized by weighted average method, moving surface fitting method, etc. Elevation value interpolation algorithm is realized, the regular grid has the advantages of being easy to use, and can quickly process data through computers, mobile phones and other carriers, and can be widely used in contour calculation, slope aspect calculation, hillside shadow calculation and automatic extraction watershed topography, etc.;

不规则三角网模型的英文简称为TIN,是一种表示数字高程模型的方法,不规则三角网模型的算法实现方式可以选用泰森多边形算法、最短边长算法、最近距离算法等,不规则三角网模型与规则格网模型的不同之处是随地形起伏变化的复杂性而改变采样点的密度和决定采样点的位置,因而它能够避免地形平坦时的数据冗余,又能按地形特征点如山脊、山谷线、地形变化线等表示数字高程特征;用户可以根据自身需求选择构建规则格网模型或不规则三角网模型,当不需要展现地形的结构和细节,且读取的高程数据文件的数据量较小时,用户可选择采用构建规则格网模型;当遇到高程数据文件的数据量较大、地形较为复杂时,用户可选用构建不规则三角网模型。The English abbreviation of the irregular triangular network model is TIN, which is a method to represent the digital elevation model. The algorithm implementation method of the irregular triangular network model can choose the Thiessen polygon algorithm, the shortest side length algorithm, the closest distance algorithm, etc. The difference between the network model and the regular grid model is that the density of sampling points and the location of sampling points are changed according to the complexity of terrain fluctuations, so it can avoid data redundancy when the terrain is flat, and can Such as ridges, valley lines, terrain change lines, etc. represent digital elevation features; users can choose to build regular grid models or irregular triangular mesh models according to their own needs. When the amount of data is small, the user can choose to build a regular grid model; when the data volume of the elevation data file is large and the terrain is more complex, the user can choose to build an irregular triangulation model.

存储规则格网模型或不规则三角网模型。在规则格网或不规则三角网模型构建完成并显示第一图像100或第二图像200后,可以将该第一图像100或第二图像200信息以文件格式进行存储,以便于后续查看和研究。Store regular grid models or irregular triangular mesh models. After the regular grid or irregular triangulation model is constructed and the first image 100 or the second image 200 is displayed, the information of the first image 100 or the second image 200 can be stored in a file format for subsequent viewing and research .

还需要注意的是,第一图像100和第二图像200是由同一个高程数据文件生成的,由于第一图像100和第二图像200采用了不同的方式生成,在结构和细节部位存在一定差异。It should also be noted that the first image 100 and the second image 200 are generated from the same elevation data file. Since the first image 100 and the second image 200 are generated in different ways, there are certain differences in structure and details .

参阅附图7-附图10,为了执行上述方法,本实施例还提供了一种计算机程序,该计算机程序通过计算机语言和算法编程实现上述方法,以便于用户更好的对高程数据文件进行处理,进而展现对应的图像信息;用户如需使用该计算机程序生成图像,则首先点击“DEM高程内插”界面10中的“文件”按钮11,在“DEM高程内插”界面10中显示出“打开文件”按钮11a和“保存内插文件”按钮11b,用户如需导入新的目标数据文件,则点击“打开文件”按钮10a,进而导入目标数据文件到程序中,在“DEM高程内插”界面10中会出现“提示”界面10a,以提示文件提取成功;然后点击“DEM高程内插”界面10中的“生成DEM”按钮12,接着在“DEM高程内插”界面10中显示出“生成规则格网”按钮12a和“生成TIN”按钮12b;Referring to accompanying drawing 7-accompanying drawing 10, in order to carry out above-mentioned method, present embodiment also provides a kind of computer program, this computer program realizes above-mentioned method through programming of computer language and algorithm, so that user can better process elevation data file , and then display the corresponding image information; if the user needs to use the computer program to generate an image, first click the "file" button 11 in the "DEM elevation interpolation" interface 10, and the "DEM elevation interpolation" interface 10 displays " Open File" button 11a and "Save Interpolation File" button 11b, if the user needs to import a new target data file, then click the "Open File" button 10a, and then import the target data file into the program, in the "DEM Height Interpolation" A "prompt" interface 10a will appear in the interface 10, to prompt the file to extract successfully; then click the "generate DEM" button 12 in the "DEM elevation interpolation" interface 10, and then in the "DEM elevation interpolation" interface 10, " Generate Regular Grid" button 12a and "Generate TIN" button 12b;

若用户需要构建规则格网模型显示第一图像,则可点击“生成规则格网”按钮12a,如果该目标数据文件为正确的高程数据文件,在“DEM高程内插”界面10中出现“格网宽度”界面10b,用户根据情况设定该规则格网的宽度,接着在“DEM高程内插”界面10中将显示第一图像100,此时,在“DEM高程内插”界面10中显示有“放大”按钮13、“缩小”按钮14和“显示模式”按钮15,用户可通过点击“放大”按钮13或“缩小”按钮14对第一图像100进行缩放,另外,点击“显示模式”按钮15会在“DEM高程内插”界面10中出现“显示形状”按钮15a、“显示高程与形状”按钮15b和“显示高程显示”按钮15c,如果点击“显示形状”按钮15a,在“DEM高程内插”界面10中显示第一图像100的形状状态,如果点击“显示高程显示”按钮15c,会在“DEM高程内插”界面10中显示第一图像100的高程状态,如果点击“显示高程与形状”按钮15b,会在“DEM高程内插”界面10中显示第一图像100的高程与形状状态;如果该目标数据文件为错误数据文件,在“DEM高程内插”界面10出现“警告”界面10c,以提示用户检查或替换该目标数据文件。If the user needs to build a regular grid model to display the first image, he can click the "generate regular grid" button 12a, and if the target data file is a correct elevation data file, a "grid grid" will appear in the "DEM elevation interpolation" interface 10 Grid Width" interface 10b, the user sets the width of the regular grid according to the situation, and then the first image 100 will be displayed in the "DEM Height Interpolation" interface 10, at this time, the "DEM Height Interpolation" interface 10 will display There are "Zoom In" button 13, "Zoom Out" button 14 and "Display Mode" button 15, the user can zoom in on the first image 100 by clicking "Zoom In" button 13 or "Zoom Out" button 14, in addition, click "Display Mode" Button 15 can appear " display shape " button 15a, " display height and shape " button 15b and " display height display " button 15c in " DEM elevation interpolation " interface 10 , if click " display shape " button 15a, in " DEM The shape state of the first image 100 is displayed in the "elevation interpolation" interface 10. If the "display elevation display" button 15c is clicked, the elevation state of the first image 100 will be displayed in the "DEM elevation interpolation" interface 10. Elevation and shape" button 15b will display the elevation and shape state of the first image 100 in the "DEM elevation interpolation" interface 10; if the target data file is an error data file, "DEM elevation interpolation" interface 10 will appear " "Warning" interface 10c to prompt the user to check or replace the target data file.

若用户需要构建不规则三角网模型显示第二图像200,则点击“生成TIN”按钮12b,接着在“DEM高程内插”界面10中出现“泰森多边形法”按钮12b-1、“最近距离算法”按钮12b-2和“最短边长算法”按钮12b-3,用户可根据情况选择点击对应的按钮,由于该程序生成第二图像200的操作方式相同的,本实施例中仅以点击“泰森多边形法”按钮12b-1进行说明,在点击“泰森多边形法”按钮12b-1后,如果该目标数据文件为正确的高程数据文件,在“DEM高程内插”界面10中将显示第二图像200,此时,在“DEM高程内插”界面10中显示有“放大”按钮13、“缩小”按钮14和“显示模式”按钮15,用户可通过点击“放大”按钮13或“缩小”按钮14对第二图像200进行缩放,另外,点击“显示模式”按钮15会在“DEM高程内插”界面100中出现“显示形状”按钮15a、“显示高程与形状”按钮15b和“显示高程显示”按钮15c,如果点击“显示形状”按钮15a,在“DEM高程内插”界面10中显示第二图像200的形状状态,如果点击“显示高程显示”按钮15c,会在“DEM高程内插”界面10中显示第二图像200的高程状态,如果点击“显示高程与形状”按钮15b,会在“DEM高程内插”界面10中显示第二图像200的高程与形状状态;如果该目标数据文件为错误数据文件,在“DEM高程内插”界面10出现“警告”界面10c,以提示用户检查或替换该目标数据文件。If the user needs to build an irregular triangulation model to display the second image 200, then click the "generate TIN" button 12b, and then the "Tyson polygon method" button 12b-1, "the closest distance Algorithm" button 12b-2 and "Shortest Side Length Algorithm" button 12b-3, the user can choose to click the corresponding button according to the situation, because the operation mode of the second image 200 generated by this program is the same, only click " Thiessen polygon method "button 12b-1 for illustration, after clicking " Thiessen polygon method " button 12b-1, if the target data file is a correct elevation data file, it will be displayed in the "DEM elevation interpolation" interface 10 The second image 200, at this time, in the "DEM elevation interpolation" interface 10, a "zoom in" button 13, a "zoom out" button 14 and a "display mode" button 15 are displayed, and the user can click on the "zoom in" button 13 or " Zoom out" button 14 zooms the second image 200. In addition, clicking the "display mode" button 15 will appear a "display shape" button 15a, a "display elevation and shape" button 15b and a "DEM elevation interpolation" interface 100. Show elevation display" button 15c, if click " display shape " button 15a, in " DEM elevation interpolation " interface 10, show the shape state of the second image 200, if click " display elevation display " button 15c, will be in " DEM height interpolation " The elevation state of the second image 200 is displayed in the interpolation" interface 10, if the "display elevation and shape" button 15b is clicked, the elevation and shape state of the second image 200 will be displayed in the "DEM elevation interpolation" interface 10; if the The target data file is an error data file, and a "warning" interface 10c appears on the "DEM elevation interpolation" interface 10 to prompt the user to check or replace the target data file.

需要注意的是,在“DEM高程内插”界面10中显示第一图像100或第二图像200后,可以点击“文件”按钮11,接着点击“保存内插文件”按钮11b,用户根据需求可分别点击“保存grid”按钮11b-1或“保存TIN”按钮11b-2,实现对该目标数据文件的第一图像100或第二图像200的存储,以便于后续的查看和研究。It should be noted that after the first image 100 or the second image 200 is displayed in the "DEM elevation interpolation" interface 10, the "file" button 11 can be clicked, and then the "save interpolation file" button 11b can be clicked. Click the "Save grid" button 11b-1 or the "Save TIN" button 11b-2 respectively to realize the storage of the first image 100 or the second image 200 of the target data file for subsequent viewing and research.

高程数据文件包括多个离散点,每个离散点对应一个序列号,且每个离散点都具有平面坐标(Xi,Yi)和高程坐标(Zi);The elevation data file includes multiple discrete points, each discrete point corresponds to a serial number, and each discrete point has plane coordinates (X i , Y i ) and elevation coordinates (Z i );

根据高程数据文件构建用于显示第一图像100的规则格网模型包括:Constructing a regular grid model for displaying the first image 100 according to the elevation data file includes:

根据导入的高程数据文件定义格网宽度和格网间距,用户可以导入的高程数据文件的各个离散点的数值自行定义格网宽度,进而根据格网宽度确定格网间距;根据多个离散点的坐标和格网宽度确定规则格网模型的格网区域,格网区域包括多个格网点;Define the grid width and grid spacing according to the imported elevation data file, the user can define the grid width by the value of each discrete point in the imported elevation data file, and then determine the grid spacing according to the grid width; according to the value of multiple discrete points Coordinates and grid width determine the grid area of the regular grid model, and the grid area includes multiple grid points;

具体的,每个离散点的高程值又称为高程点,通过在一个平面位置上找出所有高程点中最靠左下点,依次寻找合适点并连接,最终生成一个包括所有离散点的多边形格网区域,进而确保矩形规则格网在进行高程值内插时运算的正确性,同时也避免了在距离高程点距离较远的点处计算导致该处计算值与真实值偏差过大,导致数据失真。本实施例中,格网区域的生成流程如附图2所示:Specifically, the elevation value of each discrete point is also called the elevation point. By finding the lower left point of all elevation points on a plane position, finding suitable points in turn and connecting them, a polygonal grid including all discrete points is finally generated. grid area, thereby ensuring the correctness of the calculation of the rectangular regular grid when interpolating the elevation value, and at the same time avoiding the calculation at a point far from the elevation point, which will cause the calculation value at this place to deviate too much from the real value, resulting in data distortion. In this embodiment, the generation process of the grid area is shown in Figure 2:

G01,遍历离散高程点,寻找平面位置最右下角点作为基线点;G01, traversing the discrete elevation points, looking for the bottom right corner point of the plane position as the baseline point;

G02,按照与基线点排序取第一点与基线点放入边界点序列;G02, according to the sorting with the baseline point, take the first point and the baseline point and put them into the boundary point sequence;

G03,从排序离散点序列中取出一点;G03, take out a point from the sequence of sorted discrete points;

G04,判断该点与上两个边界点的位置关系,判断结果分为“是”与“否”;G04, judge the positional relationship between this point and the upper two boundary points, and the judgment result is divided into "yes" and "no";

G05,判断结果为“是”,则将该点加入边界点序列;G05, if the judgment result is "Yes", then add this point to the sequence of boundary points;

G06,判断结果为“否”,则将上一边界点从边界点序列中删除,并重复步骤G04~G06;G06, if the judgment result is "No", delete the previous boundary point from the sequence of boundary points, and repeat steps G04-G06;

具体的,该点与上两个边界点的位置关系采用向量叉乘的方式来判断,在本实施例中,边界点是根据当前最新两边界点(基线点p与第一点a)的矢量与待定点b连线矢量(基线点p与该点a的连线矢量)的转向来判断,如附图11所示,向量pa到向量pb是左转,则判断结果为“否”,将上一边界点(第一点a)从边界点序列中删除,即将向量pa移除,并将该待定点b与下一待定点进行判断,向量pa到向量pb’是右转,则判断结果为“是”,将该待定点b’加入到边界点序列中。Specifically, the positional relationship between this point and the upper two boundary points is judged by means of vector cross product. In this embodiment, the boundary point is based on the vector of the current latest two boundary points (baseline point p and first point a). It is judged by the steering of the line vector between the point b to be determined (the line vector between the baseline point p and the point a), as shown in Figure 11, if the vector pa to the vector pb is a left turn, then the judgment result is "no", and the The previous boundary point (the first point a) is deleted from the boundary point sequence, that is, the vector pa is removed, and the pending point b and the next pending point are judged. If the vector pa to the vector pb' turn right, the judgment result If it is "Yes", the pending point b' is added to the sequence of boundary points.

G07,是否所有点完成比较,未完成比较则重复步骤G04~G07;G07, whether all points are compared, if not, repeat steps G04~G07;

G08,所有点完成比较,则输出边界点序列,G08, when all points are compared, the sequence of boundary points is output,

G09,输出的边界点序列构成该规则格网模型的格网区域。G09, the output sequence of boundary points constitutes the grid area of the regular grid model.

在确定格网区域后,即可按照离散点平面坐标及格网间距生成格网顶点的平面坐标,如附图3所示,根据多个离散点坐标和格网间距确定格网区域的各个格网点的平面坐标(Xi,Yi);比较多个离散点的平面坐标,获取最小离散点的平面坐标(Xmin,Ymin)和最大离散点的平面坐标(Xmax,Ymax);根据格网间距、最小离散点的平面坐标(Xmin,Ymin)和最大离散点的平面坐标(Xmax,Ymax)获取格网区域的行数和列数;以最小离散点的平面坐标(Xmin,Ymin)为基点,依次增加行数和列数,生成各个格网点的平面坐标(Xi,Yi)。After the grid area is determined, the plane coordinates of the grid vertices can be generated according to the plane coordinates of the discrete points and the grid spacing. As shown in Figure 3, each grid point of the grid area is determined according to the coordinates of multiple discrete points and the grid spacing The plane coordinates (X i , Y i ); compare the plane coordinates of multiple discrete points, and obtain the plane coordinates (X min , Y min ) of the smallest discrete point and the plane coordinates (X max , Y max ) of the largest discrete point; according to The grid spacing, the plane coordinates of the minimum discrete point (X min , Y min ) and the plane coordinates of the maximum discrete point (X max , Y max ) obtain the number of rows and columns of the grid area; the plane coordinates of the minimum discrete point ( X min , Y min ) as the base point, increase the number of rows and columns in turn to generate the plane coordinates (X i , Y i ) of each grid point.

在规则格网顶点的平面坐标(Xi,Yi)生成后,即可将生成的顶点作为未知点,利用反距离加权法,利用离散高程点生成格网顶点高程(Zi);取待插点一定范围内的离散点,计算其权重与高程乘积,所有乘积之和即为所求点高程值,由此可循环将格网区域内所有待插点计算完毕,如附图4所示,根据各个格网点的平面坐标(Xi,Yi)生成对应格网点的高程坐标(Zi);生成高程数据文件的第一图像,根据任一离散点的平面坐标(Xi,Yi)的数值进行内插计算得出该离散点的高程坐标(Zi);依次根据各个离散点的平面坐标(Xi,Yi)的数值内插计算得出各个离散点的高程坐标(Zi)。After the plane coordinates (X i , Y i ) of the vertices of the regular grid are generated, the generated vertices can be regarded as unknown points, and the inverse distance weighting method is used to generate the grid vertex elevation (Z i ) using discrete elevation points; Insert discrete points within a certain range, calculate the product of their weight and elevation, and the sum of all products is the elevation value of the desired point, so that all the points to be inserted in the grid area can be calculated in a loop, as shown in Figure 4 , according to the plane coordinates (X i , Y i ) of each grid point, the elevation coordinates (Z i ) of the corresponding grid points are generated; the first image of the elevation data file is generated, and according to the plane coordinates (X i , Y i ) of any discrete point ) values are interpolated to obtain the elevation coordinates (Z i ) of the discrete points; in turn , the elevation coordinates (Z i ).

还需要注意的是,该计算机程序在实现规则格网模型时主要采用C#语言来编程,由于矩形规则格网生成与高程内插一般为同时构建,故本程序编程时也采取了在同一算法中同时构建矩形规则格网并进行高程内插。It should also be noted that the computer program is mainly programmed in C# language when implementing the regular grid model. Since the generation of the rectangular regular grid and the elevation interpolation are generally constructed at the same time, the same algorithm is also adopted in the programming of this program. At the same time, a rectangular regular grid is constructed and elevation interpolation is performed.

算法运行主程序,方法名称:GenerateThe algorithm runs the main program, method name: Generate

Figure GDA0003849984180000111
Figure GDA0003849984180000111

按照高程点平面坐标划分格网范围,生成边界多边形,方法名:MakeShellDivide the grid range according to the plane coordinates of the elevation points to generate a boundary polygon. Method name: MakeShell

Figure GDA0003849984180000112
Figure GDA0003849984180000112

Figure GDA0003849984180000121
Figure GDA0003849984180000121

将区域内平面划分为格网,并进行高程值内插,方法名:DivideDivide the plane in the area into grids, and interpolate the elevation value, method name: Divide

Figure GDA0003849984180000122
Figure GDA0003849984180000122

Figure GDA0003849984180000131
Figure GDA0003849984180000131

不规则三角网模型在本实施例中主要通过泰森多边形法、最近距离法和最短边长法来实现,以使得运用该方法的计算机程序可以结合不同算法的效率与实现成本,进而使得该计算机程序在生成第二图像时更具对比和参考价值。In this embodiment, the irregular triangular network model is mainly realized by the Thiessen polygon method, the nearest distance method and the shortest side length method, so that the computer program using this method can combine the efficiency and implementation cost of different algorithms, and then make the computer The program has more contrast and reference value when generating the second image.

首先对泰森多边形法来进行说明,运用泰森多边形法构建不规则三角网模型,首先首先依据离散点平面坐标,生成两个包含所有离散点的大三角形该大三角形一般不包含离散点,再逐个选取离散点,根据迪洛尼三角形的几何性质,将离散点所影响的大三角形拆分为多个新三角形,如此反复,直至所有点计算完毕。最后将与离散点无关的三角形剔除,即为生所求TIN。Firstly, the Thiessen polygon method will be explained. Using the Thiessen polygon method to build an irregular triangulation model, firstly, according to the plane coordinates of the discrete points, two large triangles containing all discrete points are generated. The large triangle generally does not contain discrete points, and then Select discrete points one by one, and split the large triangle affected by the discrete points into multiple new triangles according to the geometric properties of the Dilony triangle, and so on until all points are calculated. Finally, the triangles irrelevant to the discrete points are eliminated, which is the TIN obtained for survival.

如附图5所示,该不规则三角网模型的具体构建步骤如下:As shown in accompanying drawing 5, the specific construction steps of this irregular triangular network model are as follows:

T01,构建覆盖所有离散点的多边形,在多边形内划分出多个初始三角形;T01, construct a polygon covering all discrete points, and divide multiple initial triangles within the polygon;

T02,在多边形中取一离散点Q;T02, take a discrete point Q in the polygon;

T03,从T01中取一初始三角形;T03, take an initial triangle from T01;

T04,判断T02的离散点Q是否在该初始三角形的外接圆内,若T02的离散点Q不在该初始三角形的外接圆内,重复步骤T03~T04;T04, judging whether the discrete point Q of T02 is within the circumcircle of the initial triangle, if the discrete point Q of T02 is not within the circumcircle of the initial triangle, repeat steps T03-T04;

T05,若T02的离散点Q在该初始三角形的外接圆内,将该初始三角形加入待拆分三角形队列;T05, if the discrete point Q of T02 is within the circumcircle of the initial triangle, add the initial triangle to the queue of triangles to be split;

T06,判断T01中的多个初始三角形是否都计算完毕,若未计算完毕则重复步骤T03~T06;T06, judging whether the multiple initial triangles in T01 have been calculated, if not, repeat steps T03-T06;

T07,若计算完毕,将所有待拆分三角形拆为三条边,并去除重复的边;T07, if the calculation is completed, split all triangles to be split into three sides, and remove duplicate sides;

T08,将未去除的拆分边与离散点Q构建最终三角形;T08, construct the final triangle with the unremoved split edges and the discrete points Q;

T09,判断所有离散点是否都计算完毕,未计算完毕则重复步骤T02~T09;T09, judge whether all the discrete points have been calculated, if not, repeat steps T02~T09;

T10,计算完毕后,所有最终三角形共同构成高程数据文件的第二图像。T10, after the calculation is completed, all the final triangles together constitute the second image of the elevation data file.

在本实施例的计算机程序中,运用泰森多边形法构建不规则三角网模型的编程如下:In the computer program of the present embodiment, the programming of using the Thiessen polygon method to construct the irregular triangular network model is as follows:

算法运行主程序,方法名称:VoronoiTINThe algorithm runs the main program, method name: VoronoiTIN

Figure GDA0003849984180000141
Figure GDA0003849984180000141

按照迪洛尼三角形几何性质创建TIN,方法名:CreatTriangleCreate TIN according to the geometric properties of Dilony triangle, method name: CreateTriangle

Figure GDA0003849984180000142
Figure GDA0003849984180000142

Figure GDA0003849984180000151
Figure GDA0003849984180000151

从已经生成的三角形中,按照迪洛尼三角形的几何性质(外接圆)找出被现离散点所影响的不稳定三角形,方法名:ToTmpListFrom the triangles that have been generated, find out the unstable triangles affected by the discrete points according to the geometric properties (circumscribed circle) of the Dilony triangle. Method name: ToTmpList

Figure GDA0003849984180000152
Figure GDA0003849984180000152

将不稳定三角形队列中的三角形拆分并,并与当前的影响离散高程点重新生成三角形,方法名:ReBuildSplit and merge the triangles in the unstable triangle queue, and regenerate the triangles with the current affected discrete elevation points, method name: ReBuild

Figure GDA0003849984180000153
Figure GDA0003849984180000153

Figure GDA0003849984180000161
Figure GDA0003849984180000161

由于最短边长法和最近距离法的逻辑相近,在本实施例中仅对最短边长法进行说明,如附图6所示,运用最短边长法构建不规则三角网模型的步骤如下:Because the logic of the shortest side length method and the shortest distance method are similar, only the shortest side length method is described in this embodiment, as shown in Figure 6, the steps of using the shortest side length method to construct an irregular triangular network model are as follows:

S01,连接间距最小的两离散点作为基边Ei(P1P2);S01, connect the two discrete points with the smallest distance as the base edge E i (P 1 P 2 );

S02,将多个离散点分为在基边Ei(P1P2)左方的左队列L和在基边Ei(P1P2)右方的右队列R;S02, divide a plurality of discrete points into the left queue L on the left side of the base edge E i (P 1 P 2 ) and the right queue R on the right side of the base edge E i (P 1 P 2 );

S03,判断基边Ei(P1P2)左方是否可以构建三角形,若可以,则生成基边Ei(P1P2)左方的三角形;S03, judging whether a triangle can be constructed to the left of the base edge E i (P 1 P 2 ), if possible, generate a triangle to the left of the base edge E i (P 1 P 2 );

S04,若不可以构建三角形,则在左队列L内取一离散点Pn,并计算离散点Pn与基边Ei的两端点P1P2的距离和D;S04, if the triangle cannot be constructed, then take a discrete point P n in the left queue L, and calculate the distance sum D between the discrete point P n and the two ends P 1 P 2 of the base edge E i ;

S05,判断距离和D是否小于最小记录值,初始值为无穷大,若不小于最小记录值,则重复步骤S04~S05;S05, judging whether the distance sum D is less than the minimum record value, the initial value is infinity, if not less than the minimum record value, then repeat steps S04-S05;

S06,若小于最小记录值,则记录离散点PnS06, if it is less than the minimum record value, record the discrete point P n ;

S07,判断左队列L的所有离散点是否比较完毕,若没有比较完毕,则重复S04~S07;S07, judge whether all the discrete points of the left queue L have been compared, if not, repeat S04-S07;

S08,若比较完毕,则生成基边Ei(P1P2)左方的三角形;S08, if the comparison is completed, then generate a triangle on the left of the base edge E i (P 1 P 2 );

S09,重复步骤S03~S08,以生成基边Ei(P1P2)右方的三角形;S09, repeating steps S03-S08 to generate a triangle on the right side of the base edge E i (P 1 P 2 );

S10,基边Ei(P1P2)左方的三角形和基边Ei(P1P2)右方的三角形共同构成高程数据文件的第二图像。S10, the triangle on the left of the base edge E i (P 1 P 2 ) and the triangle on the right of the base edge E i (P 1 P 2 ) together constitute the second image of the elevation data file.

在本实施例的计算机程序中,运用最短边长法法构建不规则三角网模型的编程如下:In the computer program of the present embodiment, the programming of using the shortest side length method to construct the irregular triangular network model is as follows:

算法运行主程序,方法名称:ShortestDistanceThe algorithm runs the main program, method name: ShortestDistance

Figure GDA0003849984180000171
Figure GDA0003849984180000171

寻找距离最短的两点作为生长基边,方法名:FindPrimeEdgeFind the two points with the shortest distance as the growth base edge, method name: FindPrimeEdge

Figure GDA0003849984180000172
Figure GDA0003849984180000172

Figure GDA0003849984180000181
Figure GDA0003849984180000181

从初始边开始,依次与剩下高程点生成三角形,方法名:MakeTriangleStarting from the initial side, generate a triangle with the remaining elevation points in turn, method name: MakeTriangle

Figure GDA0003849984180000182
Figure GDA0003849984180000182

Figure GDA0003849984180000191
Figure GDA0003849984180000191

区分一点在一条线段的左方还是右方,方法名:JudgeRorLDistinguish whether a point is on the left or right of a line segment, method name: JudgeRorL

Figure GDA0003849984180000192
Figure GDA0003849984180000192

最近距离算法同最短边长算法逻辑大致相同,只在生成三角形时判断点的条件为点与直线距离最短。故实现代码也大致相同。其不同处代码可表现为:The logic of the shortest distance algorithm is roughly the same as that of the shortest side length algorithm. The only condition for judging a point when generating a triangle is that the distance between the point and the straight line is the shortest. Therefore, the implementation code is roughly the same. The different codes can be expressed as:

Figure GDA0003849984180000193
Figure GDA0003849984180000193

需要注意的是,这里所使用的术语仅是为了描述具体实施方式,而非意图限制根据本申请的示例性实施方式。如在这里所使用的,除非上下文另外明确指出,否则单数形式也意图包括复数形式,此外,还应当理解的是,当在本说明书中使用术语“包含”和/或“包括”时,其指明存在特征、步骤、操作、器件、组件和/或它们的组合。It should be noted that the terminology used here is only for describing specific implementations, and is not intended to limit the exemplary implementations according to the present application. As used herein, unless the context clearly dictates otherwise, the singular is intended to include the plural, and it should also be understood that when the terms "comprising" and/or "comprising" are used in this specification, they mean There are features, steps, operations, means, components and/or combinations thereof.

除非另外具体说明,否则在这些实施例中阐述的部件和步骤的相对布置、数字表达式和数值不限制本申请的范围。同时,应当明白,为了便于描述,附图中所示出的各个部分的尺寸并不是按照实际的比例关系绘制的。对于相关领域普通技术人员已知的技术、方法和设备可能不作详细讨论,但在适当情况下,所述技术、方法和设备应当被视为说明书的一部分。在这里示出和讨论的所有示例中,任何具体值应被解释为仅仅是示例性的,而不是作为限制。因此,示例性实施例的其它示例可以具有不同的值。应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步讨论。The relative arrangements of components and steps, numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present application unless specifically stated otherwise. At the same time, it should be understood that, for the convenience of description, the sizes of the various parts shown in the drawings are not drawn according to the actual proportional relationship. Techniques, methods and devices known to those of ordinary skill in the relevant art may not be discussed in detail, but where appropriate, such techniques, methods and devices should be considered part of the description. In all examples shown and discussed herein, any specific values should be construed as exemplary only, and not as limitations. Therefore, other examples of the exemplary embodiment may have different values. It should be noted that like numerals and letters denote like items in the following figures, therefore, once an item is defined in one figure, it does not require further discussion in subsequent figures.

尽管已经示出和描述了本申请的实施例,对于本领域的普通技术人员而言,可以理解在不脱离本申请的原理和精神的情况下可以对这些实施例进行多种变化、修改、替换和变型,本申请的范围由所附权利要求及其等同物限定。Although the embodiments of the present application have been shown and described, those skilled in the art can understand that various changes, modifications and substitutions can be made to these embodiments without departing from the principle and spirit of the present application. and modifications, the scope of the application is defined by the appended claims and their equivalents.

Claims (2)

1.一种基于DEM的图像生成方法,其特征在于,包括:1. A DEM-based image generation method, characterized in that, comprising: 获取目标数据文件;Get the target data file; 根据所述目标数据文件的格式,判断得出高程数据文件或错误数据文件;所述高程数据文件包括多个离散点,每个离散点都具有平面坐标(Xi,Yi)和高程坐标(Zi);According to the format of the target data file, it is judged that the elevation data file or the error data file is obtained; the elevation data file includes a plurality of discrete points, and each discrete point has plane coordinates (X i , Y i ) and elevation coordinates ( Z i ); 当根据所述目标数据文件的格式判断得出为高程数据文件时:When judging from the format of the target data file that it is an elevation data file: 根据高程数据文件分别构建用于显示第一图像的规则格网模型和构建用于显示第二图像的不规则三角网模型;Constructing a regular grid model for displaying the first image and an irregular triangular network model for displaying the second image respectively according to the elevation data file; 根据多个离散点坐标和格网间距确定格网区域的各个格网点的平面坐标(Xi,Yi);比较多个离散点的平面坐标,获取最小离散点的平面坐标(Xmin,Ymin)和最大离散点的平面坐标(Xmax,Ymax);根据格网间距、最小离散点的平面坐标(Xmin,Ymin)和最大离散点的平面坐标(Xmax,Ymax)获取格网区域的行数和列数;以最小离散点的平面坐标(Xmin,Ymin)为基点,依次增加行数和列数,生成各个格网点的平面坐标(Xi,Yi),根据任一离散点的平面坐标(Xi,Yi)的数值进行内插计算得出该离散点的高程坐标(Zi);依次根据各个离散点的平面坐标(Xi,Yi)的数值内插计算得出各个离散点的高程坐标(Zi),生成所述高程数据文件的第一图像;Determine the plane coordinates (X i , Y i ) of each grid point in the grid area according to the coordinates of multiple discrete points and the grid spacing; compare the plane coordinates of multiple discrete points to obtain the plane coordinates of the smallest discrete point (X min , Y min ) and the plane coordinates of the largest discrete point (X max , Y max ); according to the grid spacing, the plane coordinates of the smallest discrete point (X min , Y min ) and the plane coordinates of the largest discrete point (X max , Y max ) The number of rows and columns of the grid area; take the plane coordinates (X min , Y min ) of the smallest discrete point as the base point, increase the number of rows and columns in turn, and generate the plane coordinates (X i , Y i ) of each grid point, According to the value of the plane coordinates (X i , Y i ) of any discrete point, the elevation coordinate (Z i ) of the discrete point is calculated by interpolation; Numerical interpolation calculates the elevation coordinates (Z i ) of each discrete point, and generates the first image of the elevation data file; 所述不规则三角网模型主要通过泰森多边形法、最近距离法和最短边长法来实现;The irregular triangular network model is mainly realized by the Thiessen polygon method, the nearest distance method and the shortest side length method; 运用泰森多边形法构建不规则三角网模型,根据所述高程数据文件构建用于显示第二图像的不规则三角网模型的步骤如下:Using the Thiessen polygon method to construct an irregular triangular network model, the steps of constructing an irregular triangular network model for displaying the second image according to the elevation data file are as follows: T01,构建覆盖所有离散点的多边形,在多边形内划分出多个初始三角形;T01, construct a polygon covering all discrete points, and divide multiple initial triangles within the polygon; T02,在多边形中取一离散点Q;T02, take a discrete point Q in the polygon; T03,从T01中取一初始三角形;T03, take an initial triangle from T01; T04,判断T02的离散点Q是否在该初始三角形的外接圆内,若T02的离散点Q不在该初始三角形的外接圆内,重复步骤T03~T04;T04, judging whether the discrete point Q of T02 is within the circumcircle of the initial triangle, if the discrete point Q of T02 is not within the circumcircle of the initial triangle, repeat steps T03-T04; T05,若T02的离散点Q在该初始三角形的外接圆内,将该初始三角形加入待拆分三角形队列;T05, if the discrete point Q of T02 is within the circumcircle of the initial triangle, add the initial triangle to the queue of triangles to be split; T06,判断T01中的多个初始三角形是否都计算完毕,若未计算完毕则重复步骤T03~T06;T06, judging whether the multiple initial triangles in T01 have been calculated, if not, repeat steps T03-T06; T07,若计算完毕,将所有待拆分三角形拆为三条边,并去除重复的边;T07, if the calculation is completed, split all triangles to be split into three sides, and remove duplicate sides; T08,将未去除的拆分边与离散点Q构建最终三角形;T08, construct the final triangle with the unremoved split edges and the discrete points Q; T09,判断所有离散点是否都计算完毕,未计算完毕则重复步骤T02~T09;T09, judge whether all the discrete points have been calculated, if not, repeat steps T02~T09; T10,计算完毕后,所有最终三角形共同构成所述高程数据文件的第二图像;T10, after the calculation is completed, all the final triangles together constitute the second image of the elevation data file; 运用最短边长法构建不规则三角网模型,根据所述高程数据文件构建用于显示第二图像的不规则三角网模型的步骤如下:Using the shortest side length method to build an irregular triangular network model, the steps of constructing an irregular triangular network model for displaying the second image according to the elevation data file are as follows: S01,连接间距最小的两离散点作为基边Ei(P1P2);S01, connect the two discrete points with the smallest distance as the base edge E i (P 1 P 2 ); S02,将多个离散点分为在基边Ei(P1P2)左方的左队列L和在基边Ei(P1P2)右方的右队列R;S02, divide a plurality of discrete points into the left queue L on the left side of the base edge E i (P 1 P 2 ) and the right queue R on the right side of the base edge E i (P 1 P 2 ); S03,判断基边Ei(P1P2)左方是否可以构建三角形,若可以,则生成基边Ei(P1P2)左方的三角形;S03, judging whether a triangle can be constructed to the left of the base edge E i (P 1 P 2 ), if possible, generate a triangle to the left of the base edge E i (P 1 P 2 ); S04,若不可以构建三角形,则在左队列L内取一离散点Pn,并计算离散点Pn与基边Ei的两端点P1P2的距离和D;S04, if the triangle cannot be constructed, then take a discrete point P n in the left queue L, and calculate the distance sum D between the discrete point P n and the two ends P 1 P 2 of the base edge E i ; S05,判断距离和D是否小于最小记录值,初始值为无穷大,若不小于最小记录值,则重复步骤S04~S05;S05, judging whether the distance sum D is less than the minimum record value, the initial value is infinity, if not less than the minimum record value, then repeat steps S04-S05; S06,若小于最小记录值,则记录离散点PnS06, if it is less than the minimum record value, record the discrete point P n ; S07,判断左队列L的所有离散点是否比较完毕,若没有比较完毕,则重复步骤S04~S07;S07, judging whether all the discrete points of the left queue L have been compared, if not, repeat steps S04-S07; S08,若比较完毕,则生成基边Ei(P1P2)左方的三角形;S08, if the comparison is completed, then generate a triangle on the left of the base edge E i (P 1 P 2 ); S09,重复步骤S03~S08,以生成基边Ei(P1P2)右方的三角形;S09, repeating steps S03-S08 to generate a triangle on the right side of the base edge E i (P 1 P 2 ); S10,基边Ei(P1P2)左方的三角形和基边Ei(P1P2)右方的三角形共同构成所述高程数据文件的第二图像;S10, the triangle on the left of the base edge E i (P 1 P 2 ) and the triangle on the right of the base edge E i (P 1 P 2 ) together constitute the second image of the elevation data file; 存储规则格网模型或不规则三角网模型。Store regular grid models or irregular triangular mesh models. 2.根据权利要求1所述的一种基于DEM的图像生成方法,其特征在于,当根据所述目标数据文件的格式判断得出为错误数据文件时,进行提示警告。2. A method for generating an image based on DEM according to claim 1, characterized in that, when the format of the target data file is judged to be an error data file, a warning is given.
CN202010743799.9A 2020-07-29 2020-07-29 DEM-based image generation method Expired - Fee Related CN111899335B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010743799.9A CN111899335B (en) 2020-07-29 2020-07-29 DEM-based image generation method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010743799.9A CN111899335B (en) 2020-07-29 2020-07-29 DEM-based image generation method

Publications (2)

Publication Number Publication Date
CN111899335A CN111899335A (en) 2020-11-06
CN111899335B true CN111899335B (en) 2022-11-11

Family

ID=73182514

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010743799.9A Expired - Fee Related CN111899335B (en) 2020-07-29 2020-07-29 DEM-based image generation method

Country Status (1)

Country Link
CN (1) CN111899335B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101950436A (en) * 2010-09-29 2011-01-19 中国科学院国家天文台 Method for manufacturing digital elevation model by using data of laser altimeter
CN102194253A (en) * 2011-06-15 2011-09-21 北京航空航天大学 Method for generating tetrahedron gridding for three-dimensional geological structure
CN106970404A (en) * 2017-03-31 2017-07-21 东南大学 A kind of many redundant network RTK atmosphere errors interpolating methods based on Delaunay triangulation network
CN107705362A (en) * 2017-10-11 2018-02-16 中煤航测遥感集团有限公司 DEM accuracy checking methods and device
CN107798182A (en) * 2017-10-19 2018-03-13 江苏金陵科技集团有限公司 A kind of quick calculating of base station radiation scope and update method
CN110675501A (en) * 2019-09-26 2020-01-10 扆亮海 Efficient conversion method from TIN to Grid model under DEM framework

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7215810B2 (en) * 2003-07-23 2007-05-08 Orametrix, Inc. Method for creating single 3D surface model from a point cloud
CN101344390B (en) * 2008-08-19 2010-11-03 南京师范大学 High-fidelity digital modeling method for landform altitude
US8793107B2 (en) * 2011-12-01 2014-07-29 Harris Corporation Accuracy-based significant point derivation from dense 3D point clouds for terrain modeling
CN110544305B (en) * 2019-08-26 2022-09-27 滁州学院 Information fusion method of terrain steep sill line for regular grid DEM construction

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101950436A (en) * 2010-09-29 2011-01-19 中国科学院国家天文台 Method for manufacturing digital elevation model by using data of laser altimeter
CN102194253A (en) * 2011-06-15 2011-09-21 北京航空航天大学 Method for generating tetrahedron gridding for three-dimensional geological structure
CN106970404A (en) * 2017-03-31 2017-07-21 东南大学 A kind of many redundant network RTK atmosphere errors interpolating methods based on Delaunay triangulation network
CN107705362A (en) * 2017-10-11 2018-02-16 中煤航测遥感集团有限公司 DEM accuracy checking methods and device
CN107798182A (en) * 2017-10-19 2018-03-13 江苏金陵科技集团有限公司 A kind of quick calculating of base station radiation scope and update method
CN110675501A (en) * 2019-09-26 2020-01-10 扆亮海 Efficient conversion method from TIN to Grid model under DEM framework

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
基于DEM内插的工程土方量计算方法研究;马龙;《中国优秀博硕士学位论文全文数据库(硕士)工程科技Ⅱ辑》;20160515(第5期);C038-16 *
数字高程模型的精细化处理与地形要素提取分析 ——以分宜县为例;腾月;《中国优秀硕士学位论文全文数据库 基础科学辑》;20161115(第11期);A008-20 *
鞍山市数字高程模型(DEM)的建立;徐茂林;《中国优秀博硕士学位论文全文数据库(硕士)基础科学辑》;20041215(第4期);A008-141 *

Also Published As

Publication number Publication date
CN111899335A (en) 2020-11-06

Similar Documents

Publication Publication Date Title
CN111382470B (en) Machine Learning for Object Inference in 3D Modeling
US10325035B2 (en) Interactive dimensioning of parametric models
JP7049807B2 (en) Database query based on parametric view functions
CN111612896A (en) A method for reconstructing 3D tree model based on airborne lidar tree point cloud
US10127720B2 (en) Object modeling in multi-dimensional space
CN112700531B (en) Hierarchical household display method for building inclination model fused with vector house type diagram
CN105844711A (en) Engraving a 2D image on a subdivision surface
CN110458946B (en) Construct 3D model feature vector and search 3D model method based on image features
CN113269870A (en) Multi-resolution digital terrain integration method based on three-dimensional subdivision grids
JP2006172471A (en) Two-dimensional linear data real-time three-dimensional conversion method, two-dimensional linear data real-time three-dimensional conversion device, two-dimensional linear data real-time three-dimensional image display method, and two-dimensional linear data real-time three-dimensional image display device
CN108198194A (en) Oblique photography single object extraction method based on lateral multi-plane cutting
CN115087983A (en) Method and system for hybrid modeling using geometric patches
CN115564923A (en) Three-dimensional model processing method, device, electronic equipment and storage medium
CN115311645A (en) Traffic light marking method, device, computer equipment and storage medium
Penninga et al. A tetrahedronized irregular network based DBMS approach for 3D topographic data modeling
CN107330209B (en) Modeling wall intelligent template implementation method based on parametric design
CN111899335B (en) DEM-based image generation method
CN102890830B (en) Method for separating topological face based on triangular patch model
CN114202642A (en) Method and device for filling oversized holes in three-dimensional triangulation network model
CN108920785A (en) A kind of monomeric complex model regularization modeling method and system
CN116843741A (en) Three-dimensional model contour feature extraction method, device and equipment for numerical simulation
US20190088031A1 (en) Computer-Implemented Method Of Displaying A Subset Of A Digitally Modeled Assembly Of Objects
CN116863137A (en) Optimization method, device and computer equipment for three-dimensional model of transmission tower
CN115512004A (en) Method and device for generating dough
CN107767458A (en) TIN surface geometry topological coherence analysis method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20221111