Detailed Description
The invention is described in further detail below with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting thereof. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings. It should be further noted that, for convenience of description, only some, but not all of the structures related to the present invention are shown in the drawings.
Example 1
Fig. 1 is a flowchart of a method for generating a digital terrain model according to an embodiment of the present invention, where the method may be applied to extracting a digital terrain model from a digital surface model, and the method may be performed by a digital terrain model generating device, where the digital terrain model generating device may be implemented by using software and/or hardware.
First, a digital surface model and a digital terrain model are described.
Geospatial is three-dimensional in nature, except that people typically describe and analyze the distribution of space over a two-dimensional geospatial area. The digital surface model (Digital Surface Model, DSM) is the sum of all information of the earth's surface stored in digital form, i.e. contains information of the elevation of the terrain, and also contains information of non-earth surfaces other than the ground of earth's surface buildings, bridges, trees, etc. The digital surface model is essentially a digital representation of the ground morphology and attribute information. The digital surface model DSM is a simple statistical representation of a continuous surface with a large selection of known x, y, z coordinate points in an arbitrary coordinate system. Generally, x and y are used for representing spatial positions, and z is used for representing ground attribute data, and because the ground has wide attributes and is also quite rich in extension, z can be any one or a combination of any multiple of information such as gradient, slope direction, soil type, land utilization, precipitation amount and temperature.
Further, when z is altitude information, the digital surface model is changed into a digital altitude model, that is, the digital altitude model is a digital surface model with ground attribute of altitude information.
The digital terrain model (Digital Terrain Model, DTM), also called as digital ground model, is used for the design of various line selection (railway, highway, power line) and the area, volume and gradient calculation of various projects, the visual judgment between any two points and the drawing of any section. The method is used for drawing contour lines, gradient slope maps and perspective views in mapping, and manufacturing orthographic images and repairing maps. Can be used as auxiliary data for classification in remote sensing applications. The system is basic data of a geographic information system, and can be used for analyzing the current situation of land use, reasonably planning, forecasting flood danger and the like. The electronic sand table can be used for navigation, missile guidance, combat electronic sand table and the like in military.
Further, the digital surface model contains a great deal of non-surface information such as surface buildings, bridges, trees and the like. And masking off the non-surface information in the acquired digital surface model to generate a digital terrain model.
As shown in fig. 1, the method for generating a digital terrain model provided in this embodiment mainly includes the following steps:
s110, constructing an image pyramid of the digital surface model image.
In this embodiment, the digital surface model image is understood to be a sum of all the ground information stored in digital form displayed in the form of an image. The image pyramid is an image set with different resolutions from thin to thick, which is generated by an original image according to a certain rule. The bottom of the pyramid is a high resolution representation of the image, i.e., the original image, while the top is an approximation of the low resolution. The resolution of the bottommost layer is highest, the data volume is largest, the resolution is gradually reduced with the increase of the layer number, and the data volume is proportionally reduced.
The mode of constructing the image pyramid of the digital surface model image can be designed according to actual conditions. Furthermore, the bottommost data of the image pyramid is an original digital surface model image, and the image data of other layers can be constructed from the next layer data through acquisition and extraction. Further, the specific method for constructing the image pyramid is to define the original image as the bottommost layer of the image pyramid as 0 layer, and a series of images with different resolutions are built by adopting a resampling method on the original image, namely the 1 st, 2 nd and 3 rd … … th layers of the generated image until the resolution of the finally built image data layer meets the requirement, wherein the 0 th layer is the highest resolution and the clearest resolution of the original image layer. The resolution of the resampled image is reduced sequentially along with the increase of the pyramid layer number, the data volume is also reduced sequentially, and the representation range is unchanged.
In this embodiment, the number of layers of the image pyramid is at least three, and layer 0 is 1:1, original image data; layer 1 is the ratio of the original image data to 1:4, image data; layer 2 is a layer with a ratio to original image data of 1: 16. Namely, layer 0 is the original image data; the image data of the 1 st layer is one fourth of the original image data, and the image data of the 2 nd layer is one sixteenth of the original image data. It should be noted that, in this embodiment, only the number of layers of the image pyramid is described, but not limited thereto, and the number of layers of the image pyramid may be designed according to practical situations.
It should be noted that, in this embodiment, only the manner of constructing the image pyramid is described, but not limited thereto, and other suitable manners of constructing the image pyramid may be selected or designed according to practical situations.
Further, prior to constructing the image pyramid of the digital surface model image, it is necessary to acquire data of the digital surface model and generate the digital surface model image. The digital surface model image can be acquired through a high-resolution satellite remote sensing image or an unmanned aerial vehicle image, and also can be generated through Lidar laser point cloud data. The digital surface model data may also be downloaded directly on some other geographic website and then the digital surface model image generated. In the present embodiment, only the method of acquiring the digital surface model image is described, but not limited thereto.
S120, filtering processing is carried out on a preset image layer of the image pyramid, and a non-topographic area is determined.
In this embodiment, the preset image layer may be any image layer in the image pyramid. Non-topographical areas may be understood as areas occupied by non-surface information in the digital surface model.
In this embodiment, the non-topographic region of the digital surface model image may be obtained after filtering any image layer in the image pyramid. In this embodiment, another implementation manner is provided, where a preset number of image layers of the image pyramid are respectively filtered to obtain non-topographic areas corresponding to the image layers, and the non-topographic areas of the digital surface model image are determined according to the non-topographic areas corresponding to the image layers.
Further, filtering processing can be performed on the image data of the bottommost layer of the pyramid to obtain a non-topographic region corresponding to the image data of the bottommost layer, and filtering processing is performed on the image data of the 1 st layer of the pyramid, namely, one fourth of the image data of the original image data, to obtain a non-topographic region corresponding to the image data of the 1 st layer; filtering the image data of the layer 2 of the pyramid, namely, one sixteenth of the image data of the original image data, to obtain a non-topographic region corresponding to the image data of the layer 2; and superposing the non-topographic region corresponding to the image data of the bottommost layer, the non-topographic region corresponding to the image data of the 1 st layer and the non-topographic region corresponding to the image data of the 2 nd layer to obtain the non-topographic region of the digital surface model image.
In this embodiment, a policy of extracting a specific layer from the interlayer may be used to select a preset image layer, so that the DSM scale feature may be considered, and the computing efficiency may be improved.
The method of filtering the image layers is the same regardless of whether any image layer is subjected to the filtering process or the filtering process is performed on a predetermined number of image layers.
Further, filtering processing is performed on a preset image layer of the image pyramid, and determining a non-terrain area includes: scanning and processing the two-dimensional data of the preset image layer according to each preset direction to obtain non-topographic images corresponding to each preset direction; and determining the non-topographic area by using a consistency voting method for the non-topographic image corresponding to each preset direction.
In this embodiment, each image layer is formed by a large amount of two-dimensional data, and each two-dimensional data is used to represent the position of each pixel point in the image layer. An image layer is understood to be a matrix of a large number of two-dimensional data. In this embodiment, the preset directions may be 4 directions, which are the "left-right" direction, "up-down-left" direction, "up-right-down-left" direction, and the four directions respectively, so as to perform scanning.
And respectively scanning and processing the two-dimensional data of the preset image layer according to the left-right direction, the up-down direction, the up-left-right direction and the up-right-left-down direction to obtain non-topographic images respectively corresponding to the four directions.
The direction of the two-dimensional data is specifically described in this embodiment. Illustratively, the two-dimensional data of the preset image layer is represented by a 3-row 3-column matrix. The two-dimensional data of each image layer is massive, and in this embodiment, only 3 rows and 3 columns of matrix are used to describe the preset direction.
The two-dimensional data in the matrix are scanned in the left-right direction, and the obtained one-dimensional data are a11, a12, a13, a21, a22, a23, a31, a32, a33. The two-dimensional data in the matrix are scanned in the "up-down" direction, and the obtained one-dimensional data are a11, a21, a31, a12, a22, a32, a13, a23, a33. The two-dimensional data in the matrix are scanned in the direction of 'upper right-lower left', and the obtained one-dimensional data are a11, a12, a21, a13, a22, a31, a23, a32 and a33. The two-dimensional data in the matrix are scanned in the "upper left-lower right" direction, and the obtained one-dimensional data are a13, a12, a23, a11, a22, a33, a21, a32, a31.
According to the one-dimensional data of each preset direction, calculating a non-topographic image corresponding to each direction to obtain four-direction non-topographic images, and then determining a non-topographic area by using a consistency voting method on the four-direction non-topographic images. I.e. the image of each pixel in the digital surface model in four directions, and the image in three directions is a topographic image, then the area where the pixel is located is determined to be a non-topographic area.
In the embodiment, scanning and processing the two-dimensional data of the preset image layer according to each preset direction to obtain non-topographic images corresponding to each preset direction; and a consistency voting method is used for the non-topographic images corresponding to each preset direction to determine the non-topographic area, so that the reliability and stability of detection can be ensured.
S130, interpolating the elevation value of each pixel point in the non-terrain area.
In this embodiment, the elevation value of each pixel point in the non-terrain area is determined according to the elevation value of the boundary point of the non-terrain area.
In a non-terrain area, constructing an irregular triangular network according to a Delaunay triangulation principle; and carrying out intra-elevation value difference in the irregular triangular network.
In the present embodiment, only the elevation interpolation in the non-terrain area is described, but the method is not limited thereto, and an appropriate elevation interpolation method may be selected according to the actual situation.
And S140, fusing the interpolated data of the non-topographic region with the data of the original topographic region to generate a digital topographic model.
In this embodiment, the original terrain area may be understood as the area of the original digital surface model that characterizes the terrain. And carrying out seamless weighted fusion processing on the data of the non-topographic region after interpolation and the data of the original topographic region.
Before the data of the interpolated non-topographic area and the data of the original topographic area are fused, the interpolated non-topographic area may be further subjected to frequency domain Gaussian filtering, and first, the interpolated non-topographic area is expanded to the power of 2 in both length and width dimensions by using the original digital surface model data, then the original digital surface model data is transformed from an image space domain to a frequency domain, the calculation of point multiplication by using a Gaussian template is performed in the frequency domain, and finally, the complex number after the point multiplication is transformed back to the image space domain, so that the rapid large window filtering may be realized.
Further, the data of the non-topographic region after the large window filtering and the data of the original topographic region can be fused to generate a digital topographic model.
The method for generating the digital terrain model comprises the steps of constructing an image pyramid of a digital surface model image; filtering a preset image layer of the image pyramid to determine a non-topographic area; interpolating an elevation value of each pixel point in the non-terrain area; and carrying out fusion processing on the interpolated data of the non-topographic region and the data of the original topographic region to generate a digital topographic model. In the embodiment of the invention, the non-terrain area is determined by carrying out filtering treatment on the preset image layer of the image pyramid, so that the scheme of generating the non-surface element mask by using modeling software in the manual drawing mode in the prior art is replaced, the automation degree of the generation process of the digital terrain model is high, manual intervention is not needed, and the generation efficiency is improved.
Example two
Fig. 2 is a flowchart of a method for generating a digital terrain model according to a second embodiment of the present invention, where on the basis of the foregoing embodiment, the method for generating a digital terrain model according to the present invention is further optimized, and as shown in fig. 2, the method for generating an optimized digital terrain model according to the present invention mainly includes the following steps:
s210, constructing an image pyramid of the digital surface model image.
S220, scanning the two-dimensional data of the preset image layer according to a preset direction to obtain a preset number of one-dimensional scanning data.
In the present embodiment, the preset number of one-dimensional scan data is determined by the number of two-dimensional data. The preset direction has been described in the above embodiment, and will not be described in detail in this embodiment.
S230, processing each one-dimensional scanning data to obtain a one-dimensional mask image corresponding to each one-dimensional scanning data.
It should be noted that each piece of one-dimensional scan data is processed in turn, and each piece of one-dimensional scan data corresponds to one-dimensional mask image.
Specifically, for each piece of one-dimensional scanning data, calculating the maximum integral value of each pixel point in each piece of one-dimensional scanning data according to a preset integral formula; calculating the maximum integral accumulated value corresponding to each one-dimensional scanning data according to a graph theory algorithm and the maximum integral value of each pixel point; and determining a one-dimensional mask image corresponding to each one-dimensional scanning data according to the span range of the maximum integral accumulated value corresponding to each one-dimensional scanning data.
Presetting an integral formula:
wherein f (x, w) represents the maximum integration value, x represents the window start point of the one-dimensional scan data, w represents the window width, g i Representing the elevation value at position i, h representing the minimum elevation of the non-terrain point.
In this embodiment, the maximum integration system of each pixel point is calculated point by point according to a preset integration formula. A series of f (x, w) point pairs are then obtained and then used to derive a maximum integration accumulation value using the following equations and graph theory algorithm.
Wherein f (x) i ,w i ) Represents the maximum integral of the i-th point, and max represents the maximum integral accumulation.
The span of the maximum integral accumulated value is the extension length of the non-topographic area, and the one-dimensional mask image within the span range is obtained.
S240, combining the one-dimensional mask images corresponding to the one-dimensional scanning data to obtain a non-topographic image corresponding to the preset direction.
And traversing all one-dimensional scanning data of the current layer, and combining the obtained corresponding one-dimensional mask images to generate a complete non-topographic mask image based on the direction.
S250, determining the non-topographic area by using a consistency voting method for the non-topographic image corresponding to each preset direction.
And repeatedly executing the steps S220, S230 and S240 in the four directions of left and right, up and down, left and up and right, right and up and down, and finally determining specific non-topographic positions in the digital surface model by using a consistency voting method, namely, marking more than three mask images as non-topographic on the non-topographic mask images in the four directions corresponding to each pixel, and finally judging the pixel as a non-topographic area.
S260, determining the elevation value of each pixel point in the non-topographic area according to the elevation value of the boundary pixel point in the non-topographic area.
S270, interpolating the elevation value of each pixel point in the non-terrain area through an irregular triangle network.
In the non-terrain area, the elevation value interpolation is carried out through the irregular triangular network in combination with the edge elevation information of the non-terrain area.
In this embodiment, the method of interpolating the elevation value is not limited, and an appropriate method of interpolating the elevation value may be selected according to the actual situation.
S280, converting the binary image of the non-terrain area into a floating point image.
S290, smoothing the floating point image by using a Gaussian function, and taking the smoothed floating point image as the weight of the data of the non-terrain area.
And S2100, performing seamless weighted fusion on the data of the non-topographic region and the data of the original topographic region to generate a digital topographic model.
Before the data of the interpolated non-topographic area and the data of the original topographic area are fused, the interpolated non-topographic area may be further subjected to frequency domain Gaussian filtering, and first, the interpolated non-topographic area is expanded to the length and width dimensions of 2 power by using the original digital surface model data, then the original digital surface model data is transformed from an image space domain to a frequency domain, the calculation of point multiplication by using a Gaussian template is performed in the frequency domain, and finally, the complex number after the point multiplication is transformed back to the image space domain, so that the rapid large window filtering may be realized.
Carrying out weighted fusion processing on the filtered non-topographic region data and the original topographic region data; firstly, converting a binary mask image into a floating point image, and smoothing the floating point image by using a Gaussian function with a window of 3X 3; then, using the smoothed floating point image as a weight, carrying out seamless weighted fusion on the original data and the interpolation data, and finally, carrying out simple filtering processing on the synthesized image to obtain a digital terrain model.
The method for generating the digital terrain model comprises the steps of constructing an image pyramid of a digital surface model image; scanning the two-dimensional data of the preset image layer according to a preset direction to obtain a preset number of one-dimensional scanning data; processing each one-dimensional scanning data to obtain a one-dimensional mask image corresponding to each one-dimensional scanning data, and combining the one-dimensional mask images corresponding to each one-dimensional scanning data to obtain a non-topographic image corresponding to a preset direction; a consistency voting method is used for the non-topographic images corresponding to each preset direction, the non-topographic area is determined, and the elevation value of each pixel point is interpolated in the non-topographic area; and carrying out fusion processing on the interpolated data of the non-topographic region and the data of the original topographic region to generate a digital topographic model. In the embodiment of the invention, the non-terrain area is determined by carrying out filtering treatment on the preset image layer of the image pyramid, so that the scheme of generating the non-surface element mask by using modeling software in the manual drawing mode in the prior art is replaced, the automation degree of the generation process of the digital terrain model is high, manual intervention is not needed, and the generation efficiency is improved.
Example III
Fig. 3 is a schematic structural diagram of a digital terrain model generating device according to a third embodiment of the present invention, where the present embodiment is applicable to a situation of extracting a digital terrain model from a digital surface model, and the digital terrain model generating device may be implemented in a software and/or hardware manner. As shown in fig. 3, the generating device of the digital terrain model provided by the embodiment of the invention mainly includes the following modules:
an image pyramid construction module 310, configured to construct an image pyramid of the digital surface model image;
the non-topographic region determining module 320 is configured to perform filtering processing on a preset image layer of the image pyramid to determine a non-topographic region;
an elevation value interpolation module 330, configured to interpolate an elevation value of each pixel point in the non-terrain area;
the digital terrain module generating module 340 is configured to perform fusion processing on the interpolated data of the non-terrain area and the data of the original terrain area, and generate a digital terrain model.
The embodiment of the invention constructs an image pyramid of the digital surface model image; filtering a preset image layer of the image pyramid to determine a non-topographic area; interpolating an elevation value of each pixel point in the non-terrain area; and carrying out fusion processing on the interpolated data of the non-topographic region and the data of the original topographic region to generate a digital topographic model. In the embodiment of the invention, the non-terrain area is determined by carrying out filtering treatment on the preset image layer of the image pyramid, so that the scheme of generating the non-surface element mask by using modeling software in the manual drawing mode in the prior art is replaced, the automation degree of the generation process of the digital terrain model is high, manual intervention is not needed, and the generation efficiency is improved.
Further, the non-terrain area determination module 320 includes:
the non-topographic image determining unit is used for scanning and processing the two-dimensional data of the preset image layer according to each preset direction to obtain a non-topographic image corresponding to each preset direction;
and the non-topographic region determining unit is used for determining the non-topographic region by using a consistency voting method on the non-topographic images corresponding to the preset directions.
Further, the non-topographic image determining unit includes:
a one-dimensional scanning data determining subunit, configured to scan the two-dimensional data of the preset image layer according to a preset direction to obtain a preset number of one-dimensional scanning data;
the one-dimensional mask image determining unit is used for processing each one-dimensional scanning data to obtain a one-dimensional mask image corresponding to each one-dimensional scanning data;
and the non-topographic image determining subunit is used for combining the one-dimensional mask images corresponding to the one-dimensional scanning data to obtain a non-topographic image corresponding to the preset direction.
The one-dimensional mask image determining unit is specifically used for calculating the maximum integral value of each pixel point in each one-dimensional scanning data according to a preset integral formula; calculating the maximum integral accumulated value corresponding to each one-dimensional scanning data according to a graph theory algorithm and the maximum integral value of each pixel point; and determining a one-dimensional mask image corresponding to each one-dimensional scanning data according to the span range of the maximum integral accumulated value corresponding to each one-dimensional scanning data.
Specifically, the preset integral formula is:
wherein f (x, w) represents the maximum integration value, x represents the window start point of the one-dimensional scan data, w represents the window width, g i Representing the elevation value at position i, h representing the minimum elevation of the non-terrain point.
Further, the elevation value interpolation module 330 includes:
an elevation value determining unit, configured to determine an elevation value of each pixel point in the non-terrain area according to an elevation value of a boundary pixel point of the non-terrain area
And the elevation value interpolation unit is used for interpolating the elevation value of each pixel point in the non-topographic area through the irregular triangle network.
Further, the digital terrain module generation module 340 includes:
an image conversion unit for converting a binary image of a non-terrain area into a floating point image;
the smoothing processing unit is used for smoothing the floating point image by using a Gaussian function, and taking the smoothed floating point image as the weight of the data of the non-topographic area;
and the digital terrain module generating unit is used for carrying out seamless weighted fusion on the data of the non-terrain area and the data of the original terrain area to generate a digital terrain model.
The device for generating the digital terrain model provided by the embodiment of the invention can execute the method for generating the digital terrain model provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the executing method.
Example IV
Fig. 4 is a schematic structural diagram of an apparatus according to a fourth embodiment of the present invention, and as shown in fig. 4, the apparatus includes a processor 410, a memory 420, an input device 430 and an output device 440; the number of processors 410 in the device may be one or more, one processor 410 being taken as an example in fig. 4; the processor 410, memory 420, input means 430 and output means 440 in the device may be connected by a bus or other means, for example in fig. 4.
The memory 420 is used as a computer readable storage medium for storing software programs, computer executable programs, and modules, such as program instructions/modules corresponding to the method for generating a digital terrain model in the embodiment of the present invention (e.g., the image pyramid construction module 310, the non-terrain area determination module 320, the elevation value interpolation module 330, and the digital terrain module generation module 340 in the generating device of the digital terrain model). The processor 410 executes various functional applications of the device and data processing by running software programs, instructions and modules stored in the memory 420, i.e., implements the method of generating a digital terrain model described above.
Memory 420 may include primarily a program storage area and a data storage area, wherein the program storage area may store an operating system, at least one application program required for functionality; the storage data area may store data created according to the use of the terminal, etc. In addition, memory 420 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid-state storage device. In some examples, memory 420 may further include memory located remotely from processor 410, which may be connected to the device via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input means 430 may be used to receive entered numeric or character information and to generate key signal inputs related to user settings and function control of the device. The output 440 may include a display device such as a display screen.
Example five
A fifth embodiment of the present invention also provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are for performing a method of generating a digital terrain model, the method comprising:
constructing an image pyramid of the digital surface model image;
filtering the preset image layer of the image pyramid to determine a non-topographic area;
interpolating an elevation value of each pixel point in the non-terrain area;
and carrying out fusion processing on the interpolated data of the non-topographic region and the data of the original topographic region to generate a digital topographic model.
Of course, the storage medium containing the computer executable instructions provided in the embodiments of the present invention is not limited to the method operations described above, and may also perform the related operations in the digital terrain model generating method provided in any embodiment of the present invention.
From the above description of embodiments, it will be clear to a person skilled in the art that the present invention may be implemented by means of software and necessary general purpose hardware, but of course also by means of hardware, although in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product, which may be stored in a computer readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, etc., and include several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments of the present invention.
It should be noted that, in the embodiment of the digital terrain model generating apparatus, each unit and module included are only divided according to the functional logic, but are not limited to the above-mentioned division, so long as the corresponding functions can be implemented; in addition, the specific names of the functional units are also only for distinguishing from each other, and are not used to limit the protection scope of the present invention.
Note that the above is only a preferred embodiment of the present invention and the technical principle applied. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, while the invention has been described in connection with the above embodiments, the invention is not limited to the embodiments, but may be embodied in many other equivalent forms without departing from the spirit or scope of the invention, which is set forth in the following claims.