Three-dimensional terrain reconstruction method based on elevation image, electronic equipment and storage medium
The terrain area is divided through edge detection and adaptive downsampling is performed, and the three-dimensional terrain reconstruction of elevation images is combined with concurrent threading technology, which solves the problem of slow three-dimensional terrain reconstruction in the existing technology and realizes efficient three-dimensional terrain reconstruction.
Patent Information
- Application Number
- CN202411501006.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2044-10-25
AI Technical Summary
The existing three-dimensional terrain reconstruction technology based on elevation images is slow in visual loading speed and long waiting time, making it difficult to meet the requirements of efficiency.
Edge detection technology is used to divide different areas on the topographic map, and adaptive downsample is performed according to the categories of different areas. Concurrent threads are used to map and reconstruct the feature coordinates in the elevation image block to reduce time overhead.
While maintaining the reconstruction resolution, the time overhead is significantly reduced and the reading and processing efficiency of elevation image data is improved.
Smart Images

Figure CN119494932A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of digital image and data processing, and more specifically, relates to a three-dimensional terrain reconstruction method based on elevation image, electronic equipment and storage medium. Background Art
[0002] Elevation images usually refer to Digital Elevation Models (DEMs), which are numerical data sets based on plane position coordinates and the elevations of corresponding points. They can be used to represent the terrain undulations on the earth's surface or any surface. DEMs can be seen as a virtual representation of ground elevations, which can simulate the three-dimensional form of actual terrain in digital form. With the rapid development of three-dimensional maps and terrain visualization applications, the processing and visualization of elevation data, which plays an irreplaceable role in the application field of three-dimensional terrain reconstruction, has become particularly important.
[0003] However, when processing complex elevation image data before 3D modeling, traditional methods often rely on single-threaded sequential execution, which is particularly inefficient when processing large-scale, high-resolution data sets and is difficult to meet the requirements of high efficiency. Therefore, how to efficiently and quickly read elevation image data has become an urgent problem to be solved. In order to solve the problem of low reading and visualization speed of elevation image data, researchers consider using multi-threaded concurrent control technology to accelerate the reading and processing of image data. However, facing the inherent challenges of multi-threaded environments, data access conflicts, resource competition, and synchronization overhead in the environment often limit the space for performance improvement. In addition, how to effectively manage the frame cache, ensure data consistency and reduce repeated calculations, and adapt to the data processing methods in different scenarios are also the key to achieving efficient data reading.
[0004] At present, there have been successful studies on the application of multi-threaded concurrent control and frame buffer technology in the field of image data processing. However, there is no effective data reconstruction based on the characteristics of topographic maps for the reconstruction of elevation image data of three-dimensional terrain. Its applicability and efficiency still have room for further improvement. Summary of the invention
[0005] In view of the above defects or improvement needs of the prior art, the present invention provides a three-dimensional terrain reconstruction method based on elevation images, an electronic device and a storage medium, the purpose of which is to combine edge detection to divide the terrain and perform adaptive downsampling according to different types of terrain, so that the three-dimensional reconstruction of the elevation image can utilize the characteristics of the terrain and adapt to the complexity of the terrain, thereby maintaining the reconstruction resolution while reducing the time overhead, thereby solving the technical problems of slow visualization loading speed and long waiting time of the existing three-dimensional terrain reconstruction technology based on elevation images.
[0006] To achieve the above object, according to one aspect of the present invention, a three-dimensional terrain reconstruction method based on elevation images is provided, comprising the following steps:
[0007] (1) Data loading: reading an elevation image of the to-be-reconstructed three-dimensional terrain; each pixel point of the elevation image includes plane coordinate information and elevation value information, wherein the plane coordinate information is used to indicate the corresponding position of the to-be-reconstructed three-dimensional terrain, and the elevation value information is used to indicate the altitude information of the position of the to-be-reconstructed three-dimensional terrain;
[0008] (2) Edge detection: using an edge detection algorithm to monitor the edge contours in the elevation image obtained in step (1) to obtain edge coordinates, dividing the elevation image blocks into regions according to the edge contours and determining the categories of the regions;
[0009] (3) Concurrent mapping: The elevation image obtained in step (1) is divided into blocks to obtain elevation image blocks, and concurrent threads are used to search for feature coordinates in the elevation image blocks and map them into three-dimensional coordinates. Each concurrent thread executes an elevation image block mapping subtask, and the elevation image block mapping subtask is specifically as follows:
[0010] According to the regions divided in step (2), for the coordinates of the elevation image block belonging to each region, adaptive downsampling is performed according to the principle that the greater the height gradient, the denser the sampling density is, to obtain sampling coordinates and use the sampling coordinates and edge coordinates of the elevation image block as feature coordinates, and map the elevation value at the feature coordinate to a height value;
[0011] (4) Three-dimensional reconstruction: Collect all feature coordinates obtained in step (3) and the height values at the coordinates, and perform three-dimensional reconstruction to obtain a three-dimensional topographic map of the elevation image of the three-dimensional terrain to be reconstructed.
[0012] Preferably, in the three-dimensional terrain reconstruction method based on elevation image, the elevation value is an image grayscale value. When the elevation image of the three-dimensional terrain to be reconstructed is a color image, the pixel color is represented in RGB format, and the grayscale value corresponding to the RGB value is used as the elevation value of the pixel.
[0013] Preferably, in the three-dimensional terrain reconstruction method based on elevation image, in step (2), when the elevation image of the three-dimensional terrain to be reconstructed is a color image, edge detection is performed using the original image or the grayscale image;
[0014] Preferably, in the three-dimensional terrain reconstruction method based on elevation images, the edge detection algorithm adopted in step (2) is: Sobel algorithm.
[0015] Preferably, in the three-dimensional terrain reconstruction method based on elevation image, in step (3), the elevation image block is adjusted according to the size and reference resolution of the elevation image so that the pixel quantity of the elevation image block is within a preset range.
[0016] Preferably, in the three-dimensional terrain reconstruction method based on elevation image, in step (3), the elevation value at the feature coordinate is mapped to a height value, and a mapping relationship between the elevation value g and the height value y is determined in a normalized manner, wherein the normalized manner includes but is not limited to: logarithmic normalization, square normalization, or linear normalization;
[0017] Preferably, in the three-dimensional terrain reconstruction method based on elevation image, when the elevation value g is logarithmically normalized in step (3), the mapping relationship between the height value y and the elevation value g is:
[0018]
[0019] When the elevation value g is normalized by square, the mapping relationship between the height value y and the elevation value g is:
[0020] y=y max ×(g / 255) 2
[0021] When the elevation value g is linearly normalized, the mapping relationship between the height value y and the elevation value g is:
[0022]
[0023] Among them, y min is the maximum height of the normalized range, y max The minimum height of the normalized range.
[0024] Preferably, in the three-dimensional terrain reconstruction method based on elevation image, the step (3) of the method performs adaptive downsampling according to the principle that the greater the height gradient, the denser the sampling density, and the adaptive downsampling terrain correction algorithm is specifically:
[0025] S1. For the current sampling coordinate, calculate the downsampling factor f according to its gradient as follows:
[0026]
[0027] Among them, Δg is the gradient of the current sampling coordinate, th is the gray value contrast threshold preset for the category of the area where the current sampling coordinate is located, and F <f l <f h , to achieve dense sampling for large grayscale changes and sparse sampling for small grayscale changes: The calculation method of the gradient Δg of the current sampling coordinate is as follows:
[0028] Δg=|gg - |+|gg + |
[0029] Among them, g - is the gray value of the previous sampling coordinate, g + is the grayscale value of the pre-sampled coordinate, and the pre-sampled coordinate is the coordinate obtained by moving the standard step length in the sampling direction;
[0030] S2, using the quotient of the standard step length and the downsampling factor f obtained in step S1 as the sampling step length, searching for the next sampling coordinate according to the preset sampling direction;
[0031] S3. Repeat steps S1 and S2 until all elevation image blocks are traversed.
[0032] According to another aspect of the present invention, an electronic device is provided, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the three-dimensional terrain reconstruction method based on elevation images provided by the present invention are implemented.
[0033] According to another aspect of the present invention, a non-transitory computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the three-dimensional terrain reconstruction method based on elevation images provided by the present invention are implemented.
[0034] In general, the above technical solutions conceived by the present invention can achieve the following beneficial effects compared with the prior art:
[0035] The present invention adopts edge detection technology to divide different areas on the topographic map, and performs adaptive downsampling according to the categories described in different areas, converting the elevation values of the sampling points into height information, thereby reconstructing the elevation image of the terrain into a visual three-dimensional image. While maintaining the visualization effect equivalent to that of the existing elevation image, a large amount of redundant data is reduced, thereby greatly reducing time overhead. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] Figure 1 It is a schematic flow chart of a three-dimensional terrain reconstruction method based on elevation images provided by the present invention;
[0037] Figure 2 is a flow chart of a three-dimensional terrain reconstruction method based on elevation images provided in an embodiment;
[0038] Figure 3 The embodiment adopts an elevation image sample of a three-dimensional terrain;
[0039] Figure 4 Yes Figure 3The three-dimensional image is obtained by the traditional elevation image reconstruction method;
[0040] Figure 5 The embodiment is Figure 3 The three-dimensional image is obtained by reconstructing the elevation image. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention is further described in detail below in conjunction with the embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0042] Topographic maps as a whole have clear dividing lines, such as mountains, rivers, and trenches, and the features within the region are obvious, such as hills, plains, and seabeds. It is difficult to grasp the overall characteristics of topographic maps using multi-threaded distributed topographic map reconstruction. When a highly restored three-dimensional topographic map is required, the sampling rate has to be increased or even pixel-by-pixel reconstruction has to be performed, which is time-consuming.
[0043] The present invention provides a three-dimensional terrain reconstruction method based on elevation images, such as Figure 1 As shown, the following steps are included:
[0044] (1) Data loading: reading an elevation image of the to-be-reconstructed three-dimensional terrain; each pixel point of the elevation image includes plane coordinate information and elevation value information, wherein the plane coordinate information is used to indicate the corresponding position of the to-be-reconstructed three-dimensional terrain, and the elevation value information is used to indicate the altitude information of the position of the to-be-reconstructed three-dimensional terrain;
[0045] In a preferred embodiment, the elevation value is an image grayscale value. When the elevation image of the three-dimensional terrain to be reconstructed is a color image, the pixel color is represented in RGB format, and the grayscale value corresponding to the RGB value is used as the elevation value of the pixel.
[0046] (2) Edge detection: using an edge detection algorithm to monitor the edge contours in the elevation image obtained in step (1) to obtain edge coordinates, dividing the elevation image blocks into regions according to the edge contours and determining the categories of the regions;
[0047] When the elevation image of the three-dimensional terrain to be reconstructed is a color image, the original image or grayscale image is used for edge detection. The preferred edge detection algorithm is: Sobel algorithm, which uses a discrete difference operator to calculate the gradient of the grayscale value of image pixels and identifies edges through convolution operations in the horizontal and vertical directions; the Sobel algorithm has good robustness for images with strong noise and can quickly detect edges. It is suitable for complex terrain characteristics to perform fast edge detection on elevation images.
[0048] The category of the region is used to characterize the terrain category, such as hills, mountains, seabed, trench, etc. The category can be pre-defined or classified using a trained converged classifier;
[0049] (3) Concurrent mapping: The elevation image obtained in step (1) is divided into blocks to obtain elevation image blocks, and concurrent threads are used to search for feature coordinates in the elevation image blocks and map them into three-dimensional coordinates. Each concurrent thread executes an elevation image block mapping subtask, and the elevation image block mapping subtask is specifically as follows:
[0050] According to the regions divided in step (2), for the coordinates of the elevation image block belonging to each region, adaptive downsampling is performed according to the principle that the greater the height gradient, the denser the sampling density is, to obtain sampling coordinates and use the sampling coordinates and edge coordinates of the elevation image block as feature coordinates, and map the elevation value at the feature coordinate to a height value;
[0051] Preferably, the elevation image block is adjusted according to the size and reference resolution of the elevation image so that the pixel quantity of the elevation image block is within a preset range;
[0052] The elevation value at the feature coordinate is mapped to a height value, and a mapping relationship between the elevation value g and the height value y is determined in a normalized manner. The normalized manner of the elevation value includes but is not limited to: logarithmic normalization, square normalization, or linear normalization; specifically:
[0053] When the elevation value g is logarithmically normalized, the mapping relationship between the height value y and the elevation value g is:
[0054]
[0055] When the elevation value g is normalized by square, the mapping relationship between the height value y and the elevation value g is:
[0056] y=y max ×(g / 255) 2
[0057] When the elevation value g is linearly normalized, the mapping relationship between the height value y and the elevation value g is:
[0058]
[0059] Among them, y min is the maximum height of the normalized range, y max The minimum height of the normalized range.
[0060] The adaptive downsampling is performed according to the principle that the greater the height gradient, the denser the sampling density. Preferably, an adaptive downsampling terrain correction algorithm (ASTR algorithm) is used, and specifically the following method is used:
[0061] S1. For the current sampling coordinate, calculate the downsampling factor f according to its gradient as follows:
[0062]
[0063] Among them, Δg is the gradient of the current sampling coordinate, th is the gray value contrast threshold preset for the category of the area where the current sampling coordinate is located, and F <f l <f h , to achieve dense sampling for large grayscale changes and sparse sampling for small grayscale changes: The calculation method of the gradient Δg of the current sampling coordinate is as follows:
[0064] Δg=|gg - |+|gg + |
[0065] Among them, g - is the gray value of the previous sampling coordinate, g + is the grayscale value of the pre-sampled coordinate, and the pre-sampled coordinate is the coordinate obtained by moving the standard step length in the sampling direction;
[0066] S2, using the quotient of the standard step length and the downsampling factor f obtained in step S1 as the sampling step length, searching for the next sampling coordinate according to the preset sampling direction;
[0067] S3. Repeat steps S1 and S2 until all elevation image blocks are traversed.
[0068] (4) Three-dimensional reconstruction: Collect all feature coordinates obtained in step (3) and the height values at the coordinates, and perform three-dimensional reconstruction to obtain a three-dimensional topographic map of the elevation image of the three-dimensional terrain to be reconstructed.
[0069] The following are examples:
[0070] The three-dimensional terrain reconstruction method based on elevation images provided in this embodiment includes the following steps:
[0071] (1) Data loading: reading an elevation image of the to-be-reconstructed three-dimensional terrain; each pixel point of the elevation image includes plane coordinate information and elevation value information, wherein the plane coordinate information is used to indicate the corresponding position of the to-be-reconstructed three-dimensional terrain, and the elevation value information is used to indicate the altitude information of the position of the to-be-reconstructed three-dimensional terrain; an example of the elevation image of this embodiment is as follows: Figure 3 As shown; load the selected file path and use the QImage object to store the elevation image with a width w corresponding to its resolution l , high h lto obtain.
[0072] The elevation value is the image grayscale value. In this embodiment, the elevation image of the three-dimensional terrain to be reconstructed is a color image. The pixel color is represented in RGB format, and the grayscale value corresponding to the RGB value is used as the elevation value of the pixel. The calculation method is as follows:
[0073] g=0.299×R+0.587×G+0.114×B
[0074] Among them, g is the grayscale value of the pixel, R is the red component of the pixel, G is the green component of the pixel, and B is the blue component of the pixel.
[0075] (2) edge detection: using an edge detection algorithm to monitor the edge contour in the elevation image obtained in step (1) to obtain edge coordinates, dividing the elevation image block into regions according to the edge contour and determining the category of the region;
[0076] The edge detection algorithm used in this embodiment is: Sobel algorithm; the category of the region is obtained by training a convolutional neural network.
[0077] (3) Concurrent mapping: Figure 2 As shown, the elevation image obtained in step (1) is divided into blocks to obtain elevation image blocks, and concurrent threads are used to search for feature coordinates in the elevation image blocks and map them into three-dimensional coordinates. Each concurrent thread executes an elevation image block mapping subtask, and the elevation image block mapping subtask is specifically:
[0078] According to the regions divided in step (2), for the coordinates of the elevation image block belonging to each region, adaptive downsampling is performed according to the principle that the greater the height gradient, the denser the sampling density is, to obtain sampling coordinates and use the sampling coordinates and edge coordinates of the elevation image block as feature coordinates, and map the elevation value at the feature coordinate to a height value;
[0079] The elevation image block is adjusted according to the size and the reference resolution of the elevation image so that the pixel quantity of the elevation image block is within a preset range; specifically comprising the following steps:
[0080] The step length s is initialized by the original input elevation image, and the step length is calculated based on the resolution of the elevation image and adjusted according to its relationship with the reference resolution, specifically:
[0081] Input the preset reference resolution P (such as 1024×1024) corresponding to the number of pixels px in the horizontal or vertical direction and the corresponding reference step size S, combined with the range w, h of the determined plane coordinate axes x, z, and the width w corresponding to the resolution of the original input image I I , high h I and number of pixels The step length s of the two-dimensional coordinate axis when performing step calculation to generate terrain x With s z ,as follows:
[0082]
[0083] It is adjusted based on its relationship to the base resolution to accommodate elevation image data of varying quality and to maintain visual consistency in terrain models for elevation data of varying resolutions.
[0084] Define the vertical size b of the image block, according to h I To determine the number of blocks, divide the image into blocks by row, traverse the image rows, load the data into memory block by block, and decompose the image reading task into subtasks (the number of rows traversed in a subtask is s x is the standard step size, and the number of column traversals is ), create a thread pool QThreadPool, predefine the number of threads n available in the thread pool, submit a processing task to QThreadPool when processing each image block, and initialize a QVector <QFutur e<QList<QSurfaceDataRow*> *>> is a custom container that caches the data of each frame of elevation image blocks and stores the results of each concurrent task; among them, Qvector is a three-dimensional coordinate value object, QFuture is a result object calculated by an asynchronous task, QList is a linked list object that stores elements of a given type, and QSurfaceDataRow is a three-dimensional data storage collection of feature coordinates.
[0085] A reasonable number of blocks is preset according to the size of the elevation image data. The data is loaded in batches by traversing the image rows to avoid loading the entire image at one time and reduce memory usage. The task of reading the entire elevation image is decomposed into multiple subtasks by block. Through the thread pool and scheduling mechanism, each subtask is submitted to the QThreadPool thread pool to be assigned to different threads for execution, and the results of the entire data block obtained are stored in a cache.
[0086] The elevation value at the feature coordinate is mapped to a height value, and a mapping relationship between the elevation value g and the height value y is determined in a normalized manner. The normalized manner of the elevation value includes but is not limited to: logarithmic normalization, square normalization, or linear normalization; specifically:
[0087] When the elevation value g is logarithmically normalized, the mapping relationship between the height value y and the elevation value g is:
[0088]
[0089] When the elevation value g is normalized by square, the mapping relationship between the height value y and the elevation value g is:
[0090] y=y max ×(g / 255) 2
[0091] When the elevation value g is linearly normalized, the mapping relationship between the height value y and the elevation value g is:
[0092]
[0093] Among them, y min is the maximum height of the normalized range, y max The minimum height of the normalized range.
[0094] Different methods can be selected according to actual needs: logarithmic normalization can highlight low-altitude areas; square normalization can amplify the differences between low-altitude areas, and the change is more linear than logarithmic normalization; linear normalization can map the grayscale value to a specific elevation range. The elevation map of this embodiment adopts linear normalization.
[0095] In the segmentation subtask, the ASTR algorithm is used to adaptively adjust the downsampling rate according to the degree of change in the grayscale value of the local features of the image. A dynamic downsampling factor is used to control the sampling density of different areas, and basic edge detection is combined to optimize the sampling strategy.
[0096] The ASTR algorithm is used to adaptively adjust the downsampling rate according to the local features of the image, a dynamic downsampling factor is used to control the sampling density of different areas, and basic edge detection is combined to optimize the sampling strategy, while maintaining the details of the image-generated terrain while achieving effective use of computing resources.
[0097] The adaptive downsampling is performed according to the principle that the greater the height gradient, the denser the sampling density. Preferably, an adaptive downsampling terrain correction algorithm (ASTR algorithm) is used, and specifically the following method is used:
[0098] S1. For the current sampling coordinate, calculate the downsampling factor f according to its gradient as follows:
[0099]
[0100] Among them, Δg is the gradient of the current sampling coordinate, th is the preset gray value contrast threshold of the category in the area where the current sampling coordinate is located, F = 0.5, f l =1,f h =2: The calculation method of the gradient Δg of the current sampling coordinate is as follows:
[0101] Δg=|gg - |+|gg+ |
[0102] Among them, g - is the gray value of the previous sampling coordinate, g + is the grayscale value of the pre-sampled coordinate, and the pre-sampled coordinate is the coordinate obtained by moving the standard step length in the sampling direction;
[0103] S2, using the quotient of the standard step length and the downsampling factor f obtained in step S1 as the sampling step length, searching for the next sampling coordinate according to the preset sampling direction;
[0104] In this example, a height mapping array lookup table LUT with a size of 256 is defined. According to the directly accessed pixel value and the normalized grayscale value, the corresponding height value y is converted and obtained, and the next sampling coordinate is searched by row and direction. The normalized elevation value of the pixel point in step 1 is extracted to obtain the third axis coordinate value of the current pixel point, and this three-dimensional coordinate value is passed as a QVector to the custom class QSurfaceDataRow as a data coordinate value in the traversed row.
[0105] By defining a global grayscale value of 256 to QVector's height mapping array lookup table (Look-up Table, LUT for short), and then directly accessing the pixel operation bitmap data to avoid the performance overhead of multiple function calls, the accessed data is used in combination with the preset lookup table to obtain the elevation value of each data point to improve the efficiency of its grayscale conversion and avoid repeated calculations.
[0106] S3, repeat steps S1 and S2 until the elevation image block is traversed. In this embodiment, each row and column of the current elevation image data block is traversed.
[0107] Use QFuture to submit each subtask to the asynchronous execution queue and create a mutex. Before each thread in QThreadPool starts processing shared data, use the mutex locking method to ensure that only one thread accesses the resource. When the thread holds the lock, safely read the image block data, call the blocking method in the current thread, unlock the mutex after the task is executed, and merge all subtasks into a custom data structure QList until all asynchronous operations are completed.<QSurfaceDataRow*> , destroy the mutex object to release resources.
[0108] Use the mutex QMutex to lock the task before execution and unlock it after the task is completed to prevent race conditions or data inconsistency caused by multiple threads accessing shared resources at the same time, and use QFuture asynchronous calculation results to block the current thread until the asynchronous operation is completed and collect the results of each subtask.
[0109] (4) Three-dimensional reconstruction: Collect all feature coordinates obtained in step (3) and the height values at the coordinates, and perform three-dimensional reconstruction to obtain a three-dimensional topographic map of the elevation image of the three-dimensional terrain to be reconstructed.
[0110] All the collected feature coordinate results are stored row by row in the custom class QSurfaceDataRow and merged into a complete terrain data point set dataArray. The allocated memory is cleared, and the internal data structure is updated by resetting the data proxy method to pass it to the data proxy QSurfaceDataProxy. The integrated interface is used to construct a three-dimensional terrain visualization of the elevation data.
[0111] Loading Figure 3 The 3D reconstruction test of the elevation map was performed. The traditional parallel loading method took 38ms to complete the visualization loading. The results are as follows Figure 4 As shown, the time overhead of this embodiment is 9ms, and the result is as follows Figure 5 As shown, there is little difference in the 3D reconstruction effects between the two, and the time overhead of this embodiment is significantly smaller.
[0112] It will be easily understood by those skilled in the art that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A three-dimensional terrain reconstruction method based on elevation image, characterized in that: The following steps are involved: (1) Data loading: reading an elevation image of the to-be-reconstructed three-dimensional terrain; each pixel point of the elevation image includes plane coordinate information and elevation value information, wherein the plane coordinate information is used to indicate the corresponding position of the to-be-reconstructed three-dimensional terrain, and the elevation value information is used to indicate the altitude information of the position of the to-be-reconstructed three-dimensional terrain; (2) Edge detection: using an edge detection algorithm to monitor the edge contours in the elevation image obtained in step (1) to obtain edge coordinates, dividing the elevation image blocks into regions according to the edge contours and determining the categories of the regions; (3) Concurrent mapping: The elevation image obtained in step (1) is divided into blocks to obtain elevation image blocks, and concurrent threads are used to search for feature coordinates in the elevation image blocks and map them into three-dimensional coordinates. Each concurrent thread executes an elevation image block mapping subtask, and the elevation image block mapping subtask is specifically as follows: According to the regions divided in step (2), for the coordinates of the elevation image block belonging to each region, adaptive downsampling is performed according to the principle that the greater the height gradient, the denser the sampling density is, to obtain sampling coordinates and use the sampling coordinates and edge coordinates of the elevation image block as feature coordinates, and map the elevation value at the feature coordinate to a height value; (4) Three-dimensional reconstruction: Collect all feature coordinates obtained in step (3) and the height values at the coordinates, and perform three-dimensional reconstruction to obtain a three-dimensional topographic map of the elevation image of the three-dimensional terrain to be reconstructed.
2. The three-dimensional terrain reconstruction method based on elevation image according to claim 1, characterized in that: The elevation value is an image grayscale value. When the elevation image of the three-dimensional terrain to be reconstructed is a color image, the pixel color is represented in RGB format, and the grayscale value corresponding to the RGB value is used as the elevation value of the pixel.
3. The three-dimensional terrain reconstruction method based on elevation image according to claim 1, characterized in that: Step (2) When the elevation image of the three-dimensional terrain to be reconstructed is a color image, edge detection is performed using the original image or grayscale image.
4. The three-dimensional terrain reconstruction method based on elevation image according to claim 3, characterized in that: The edge detection algorithm used in step (2) is: Sobel algorithm.
5. The three-dimensional terrain reconstruction method based on elevation image according to claim 1, characterized in that: In step (3), the elevation image block is adjusted according to the size of the elevation image and the reference resolution so that the pixel quantity of the elevation image block is within a preset range.
6. The three-dimensional terrain reconstruction method based on elevation image according to claim 1, characterized in that: In step (3), the elevation value at the feature coordinate is mapped to a height value, and the mapping relationship between the elevation value g and the height value y is determined by a normalization method of the elevation value. The normalization method of the elevation value includes but is not limited to: logarithmic normalization, square normalization, or linear normalization.
7. The three-dimensional terrain reconstruction method based on elevation image according to claim 6, characterized in that: Step (3) When the elevation value g is logarithmically normalized, the mapping relationship between the height value y and the elevation value g is: When the elevation value g is squared and normalized, the mapping relationship between the height value y and the elevation value g is: y=y max ×(g / 255) 2 When the elevation value g is linearly normalized, the mapping relationship between the height value y and the elevation value g is: Among them, y min is the maximum height of the normalized range, y max The minimum height of the normalized range.
8. The three-dimensional terrain reconstruction method based on elevation image according to claim 1, characterized in that: In step (3), the adaptive downsampling is performed according to the principle that the greater the height gradient, the denser the sampling density. The adaptive downsampling terrain correction algorithm is specifically as follows: S1. For the current sampling coordinate, calculate the downsampling factor f according to its gradient as follows: Among them, Δg is the gradient of the current sampling coordinate, th is the gray value contrast threshold preset for the category of the area where the current sampling coordinate is located, and F <f l <f h , to achieve dense sampling for large grayscale changes and sparse sampling for small grayscale changes: The calculation method of the gradient Δg of the current sampling coordinate is as follows: Δg=|g―g ― |+|g―g + | Among them, g ― is the gray value of the previous sampling coordinate, g + is the grayscale value of the pre-sampled coordinate, and the pre-sampled coordinate is the coordinate obtained by moving the standard step length in the sampling direction; S2, using the quotient of the standard step length and the downsampling factor f obtained in step S1 as the sampling step length, searching for the next sampling coordinate according to the preset sampling direction; S3. Repeat steps S1 and S2 until all elevation image blocks are traversed.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, the steps of the three-dimensional terrain reconstruction method based on elevation images as described in any one of claims 1 to 8 are implemented.
10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the three-dimensional terrain reconstruction method based on elevation images as claimed in any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Image display device, driving method and device of image display device
CN101038734A
Vision-based ship engine accessory defect detection method
CN115049664A
Method of assisting detection of man-made structures in a digital elevation map (DEM)
US6104981A