Three-dimensional terrain reconstruction method based on elevation image, electronic device and storage medium
This patent can be applied to the field of digital image processing, specifically including efficient data processing streams.
Patent Information
- Application Number
- CN202411501006.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-25
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2044-10-25
AI Technical Summary
When processing large-scale, high-resolution elevation image data, existing technologies suffer from data access conflicts and resource contention issues in multi-threaded concurrency control technology, which limit the efficiency and speed of 3D terrain reconstruction. Furthermore, traditional methods are difficult to adapt to different terrain characteristics, resulting in excessively long reconstruction times.
Edge detection is used to divide the terrain into regions, concurrent threads are used for adaptive downsampling, feature coordinate mapping and 3D reconstruction are performed according to terrain characteristics, and the data processing flow is optimized by combining adaptive downsampling algorithm and normalization technology.
It achieves efficient image data processing, real-time and accurate image data, improves data processing efficiency, and simplifies the data visualization data processing flow.
Smart Images

Figure CN119494932B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of digital image and data processing technology, and more specifically, relates to a three-dimensional terrain reconstruction method based on elevation images, an electronic device, and a storage medium. Background Technology
[0002] Elevation images, typically referring to Digital Elevation Models (DEMs), are numerical datasets based on planar coordinates and their corresponding elevations. They can be used to represent the topographic relief of the Earth's surface or any other surface. A DEM can be seen as a virtual representation of ground elevation, digitally simulating the three-dimensional shape of actual terrain. With the rapid development of 3D maps and terrain visualization applications, the processing and visualization of elevation image data, which plays an irreplaceable role in 3D 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 dealing with large-scale, high-resolution datasets, failing to meet efficiency requirements. Therefore, how to efficiently and quickly read elevation image data has become a pressing issue. To address the slow speed of reading and visualizing elevation image data, researchers considered using multi-threaded concurrency control techniques to accelerate image data reading and processing. However, the inherent challenges of multi-threaded environments, such as data access conflicts, resource contention, and synchronization overhead, often limit performance improvement. Furthermore, effectively managing frame buffers to ensure data consistency, reduce redundant computations, and adapt to different data processing methods in various scenarios are also crucial for achieving efficient data reading.
[0004] Currently, there have been successful studies applying multi-threaded concurrency control and frame buffering technology to the field of image data processing. However, there is no effective way to reconstruct the elevation image data of three-dimensional terrain based on the characteristics of the terrain map. Its applicability and efficiency still have room for further improvement. Summary of the Invention
[0005] To address the aforementioned deficiencies or improvement needs of existing technologies, this invention provides a method, electronic device, and storage medium for three-dimensional terrain reconstruction based on elevation images. Its purpose is to combine edge detection to segment the terrain and adaptive downsampling based on different terrain types, enabling the three-dimensional reconstruction of elevation images to utilize the characteristics of the terrain and adapt to its complexity. This reduces time overhead while maintaining reconstruction resolution, thereby solving the technical problems of slow visualization loading speed and long waiting time in existing three-dimensional terrain reconstruction technologies based on elevation images.
[0006] To achieve the above objectives, according to one aspect of the present invention, a method for three-dimensional terrain reconstruction based on elevation images is provided, comprising the following steps:
[0007] (1) Data loading: Read the elevation image of the three-dimensional terrain to be reconstructed; each pixel of the elevation image includes planar coordinate information and elevation value information, the planar coordinate information is used to represent the corresponding position of the three-dimensional terrain to be reconstructed, and the elevation value information is used to represent the altitude information of the three-dimensional terrain to be reconstructed at that position;
[0008] (2) Edge detection: The edge detection algorithm is used to detect the edge contours in the elevation image obtained in step (1) to obtain the edge coordinates. The elevation image block is divided into regions according to the edge contours and the category of the region is determined.
[0009] (3) Concurrent Mapping: The elevation image obtained in step (1) is divided into blocks to obtain elevation image blocks. Concurrent threads are used to search for feature coordinates within the elevation image blocks and map them to three-dimensional coordinates. Each concurrent thread executes an elevation image block mapping subtask, which specifically includes:
[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, to obtain the sampling coordinates and use the sampling coordinates and edge coordinates of the elevation image block as feature coordinates, and the elevation value at the feature coordinates is mapped to the height value.
[0011] (4) Three-dimensional reconstruction: Collect all feature coordinates and height values at the coordinates obtained in step (3), and perform three-dimensional reconstruction to obtain a three-dimensional terrain 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 images, the elevation value is the 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 images, step (2) involves edge detection using the original image or a grayscale image when the elevation image of the three-dimensional terrain to be reconstructed is a color image;
[0014] Preferably, the edge detection algorithm used in step (2) of the three-dimensional terrain reconstruction method based on elevation images is the Sobel algorithm.
[0015] Preferably, in the three-dimensional terrain reconstruction method based on elevation images, step (3) involves adjusting the elevation image blocks according to the size and reference resolution of the elevation image, so that the number of pixels in the elevation image blocks is within a preset range.
[0016] Preferably, in the three-dimensional terrain reconstruction method based on elevation images, step (3) involves mapping the elevation values at the feature coordinates to height values and determining the mapping relationship between the elevation value g and the height value y according to the elevation value normalization method. The elevation value normalization method 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 images, step (3) when the elevation value g is logarithmically normalized, the mapping relationship between the height value y and the elevation value g is as follows:
[0018]
[0019] When the elevation value g is normalized to square, the mapping relationship between the height value y and the elevation value g is as follows:
[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 as follows:
[0022]
[0023] Among them, y min y represents the maximum height of the normalized range. max This represents the minimum height of the normalized range.
[0024] Preferably, in the three-dimensional terrain reconstruction method based on elevation images, step (3) of adaptive downsampling according to the principle that the greater the height gradient, the denser the sampling density, and the adaptive downsampling terrain correction algorithm specifically includes:
[0025] S1. For the current sampling coordinates, calculate the downsampling factor f based on its gradient, as follows:
[0026]
[0027] Where Δg is the gradient of the current sampling coordinate, th is the preset grayscale contrast threshold for the category of the region 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 gradient Δg of the current sampling coordinate is calculated as follows:
[0028] Δg=|gg - |+|gg + |
[0029] Among them, g - g is the grayscale value of the previous sampling coordinate. + The grayscale value is the presampled coordinate, which is the coordinate obtained by moving a standard step along the sampling direction;
[0030] S2. Using the quotient of the standard step size and the downsampling factor f obtained in step S1 as the sampling step size, search for the next sampling coordinate according to the preset sampling direction;
[0031] S3. Repeat steps S1 and S2 until the elevation image blocks are traversed.
[0032] According to another aspect of the present invention, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the three-dimensional terrain reconstruction method based on elevation images provided by the present invention.
[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, which, when executed by a processor, implements the steps of the three-dimensional terrain reconstruction method based on elevation images provided by the present invention.
[0034] In summary, compared with the prior art, the above-described technical solutions conceived by this invention can achieve the following beneficial effects:
[0035] This invention employs edge detection technology to divide different regions on a topographic map and performs adaptive downsampling based on the categories of different regions. The elevation values of the sampled points are converted into height information, thereby reconstructing the elevation image of the terrain into a visualized 3D image. While maintaining a visualization effect comparable to existing elevation images, a large amount of redundant data is reduced, thus significantly reducing time overhead. Attached Figure Description
[0036] Figure 1 This is a schematic diagram of the three-dimensional terrain reconstruction method based on elevation images provided by the present invention;
[0037] Figure 2 This is a flowchart of a three-dimensional terrain reconstruction method based on elevation images provided in the embodiment;
[0038] Figure 3 This is an example of an elevation image of a three-dimensional terrain used in an embodiment;
[0039] Figure 4 Yes Figure 3The image is a 3D image obtained by reconstructing a traditional elevation image;
[0040] Figure 5 This is an example of... Figure 3 The three-dimensional image obtained by reconstructing the elevation image. Detailed Implementation
[0041] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the invention. Furthermore, the technical features involved in the various embodiments of this invention described below can be combined with each other as long as they do not conflict with each other.
[0042] Topographic maps have clear boundaries as a whole, such as mountains, rivers, and trenches. The features within a region are obvious, such as hills, plains, and seabed. It is difficult to grasp the overall characteristics of a topographic map when using multi-threaded distributed topographic map reconstruction. When a high degree of restoration of a 3D topographic map is required, it is necessary to increase the sampling rate or even reconstruct it pixel by pixel, which results in a large time cost.
[0043] The present invention provides a three-dimensional terrain reconstruction method based on elevation images, such as... Figure 1 As shown, it includes the following steps:
[0044] (1) Data loading: Read the elevation image of the three-dimensional terrain to be reconstructed; each pixel of the elevation image includes planar coordinate information and elevation value information, the planar coordinate information is used to represent the corresponding position of the three-dimensional terrain to be reconstructed, and the elevation value information is used to represent the altitude information of the three-dimensional terrain to be reconstructed at that position;
[0045] In a preferred embodiment, the elevation value is the 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: The edge detection algorithm is used to detect the edge contours in the elevation image obtained in step (1) to obtain the edge coordinates. The elevation image block is divided into regions according to the edge contours and the category of the region is determined.
[0047] 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 a grayscale image. The preferred edge detection algorithm is the Sobel algorithm, which uses the discrete difference operator to calculate the gradient of the grayscale value of the image pixels and identifies edges through convolution operations in both horizontal and vertical directions. The Sobel algorithm has good robustness to images with strong noise and can perform fast edge detection, making it suitable for performing fast edge detection on elevation images with complex terrain features.
[0048] The category of the region is used to characterize the terrain category, such as hills, mountains, seabed, trenches, etc. The category can be predefined or classified using a trained and convergent classifier.
[0049] (3) Concurrent Mapping: The elevation image obtained in step (1) is divided into blocks to obtain elevation image blocks. Concurrent threads are used to search for feature coordinates within the elevation image blocks and map them to three-dimensional coordinates. Each concurrent thread executes an elevation image block mapping subtask, which specifically includes:
[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, to obtain the sampling coordinates and use the sampling coordinates and edge coordinates of the elevation image block as feature coordinates, and the elevation value at the feature coordinates is mapped to the height value.
[0051] In a preferred embodiment, the elevation image block is adjusted according to the size of the elevation image and the reference resolution, so that the number of pixels in the elevation image block is within a preset range.
[0052] The process involves mapping elevation values at characteristic coordinates to height values, and determining the mapping relationship between elevation value g and height value y using elevation value normalization methods, including but 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 as follows:
[0054]
[0055] When the elevation value g is normalized to square, the mapping relationship between the height value y and the elevation value g is as follows:
[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 as follows:
[0058]
[0059] Among them, y min y represents the maximum height of the normalized range. max This represents 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. The adaptive downsampling terrain correction algorithm (ASTR algorithm) is preferred, and the specific method is as follows:
[0061] S1. For the current sampling coordinates, calculate the downsampling factor f based on its gradient, as follows:
[0062]
[0063] Where Δg is the gradient of the current sampling coordinate, th is the preset grayscale contrast threshold for the category of the region 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 gradient Δg of the current sampling coordinate is calculated as follows:
[0064] Δg=|gg - |+|gg + |
[0065] Among them, g - g is the grayscale value of the previous sampling coordinate. + The grayscale value is the presampled coordinate, which is the coordinate obtained by moving a standard step along the sampling direction;
[0066] S2. Using the quotient of the standard step size and the downsampling factor f obtained in step S1 as the sampling step size, search for the next sampling coordinate according to the preset sampling direction;
[0067] S3. Repeat steps S1 and S2 until the elevation image blocks are traversed.
[0068] (4) Three-dimensional reconstruction: Collect all feature coordinates and height values at the coordinates obtained in step (3), and perform three-dimensional reconstruction to obtain a three-dimensional terrain map of the elevation image of the three-dimensional terrain to be reconstructed.
[0069] The following is an example:
[0070] The three-dimensional terrain reconstruction method based on elevation images provided in this embodiment includes the following steps:
[0071] (1) Data Loading: Read the elevation image of the 3D terrain to be reconstructed; each pixel of the elevation image includes planar coordinate information and elevation value information, the planar coordinate information is used to represent the corresponding position of the 3D terrain to be reconstructed, and the elevation value information is used to represent the altitude information of the 3D terrain at that position; an example of the elevation image in this embodiment is as follows. Figure 3 As shown; load the selected file path, and use a QImage object to store the elevation image with a width w corresponding to its resolution. l High h lThe acquisition of.
[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, using RGB format to represent pixel colors, and the grayscale value corresponding to the RGB value is used as the elevation value of that pixel; the calculation method is as follows:
[0073] g=0.299×R+0.587×G+0.114×B
[0074] Where 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; The edge detection algorithm is used to detect the edge contours in the elevation image obtained in step (1) to obtain the edge coordinates. The elevation image block is divided into regions according to the edge contours and the category of the region is determined.
[0076] The edge detection algorithm used in this embodiment is the Sobel algorithm; the region category is obtained by training a convolutional neural network.
[0077] (3) Concurrent mapping: such as Figure 2 As shown, the elevation image obtained in step (1) is divided into blocks to obtain elevation image patches. Concurrent threads are used to search for feature coordinates within the elevation image patches and map them to three-dimensional coordinates. Each concurrent thread executes an elevation image patch mapping subtask, which specifically includes:
[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, to obtain the sampling coordinates and use the sampling coordinates and edge coordinates of the elevation image block as feature coordinates, and the elevation value at the feature coordinates is mapped to the height value.
[0079] The elevation image blocks are adjusted according to the size and reference resolution of the elevation image to ensure that the number of pixels in the elevation image blocks is within a preset range; specifically, the following steps are included:
[0080] The step size s is initialized from the original input elevation image. The step size 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 baseline resolution P (e.g., 1024×1024) corresponding to the number of pixels px in the horizontal or vertical direction and the corresponding baseline step size S, combined with the determined ranges w and h of the in-plane coordinate axes x and 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 size s of the two-dimensional coordinate axes when performing step size calculation to generate terrain. x With s z ,as follows:
[0082]
[0083] Adjustments are made based on its relationship with the baseline resolution to accommodate elevation image data of different qualities and to maintain visual consistency of terrain models for elevation data of different resolutions.
[0084] Define the vertical dimension b of the image block, based on h. I To determine the number of blocks, the image is divided into blocks by row. Data is loaded into memory block by block by traversing the image rows. The image reading task is thus decomposed into blocks. Each subtask (the row traversal in the subtask is s) x Given the standard step size, the number of column traversals is . Create a thread pool QThreadPool, predefine the number of available threads n in the thread pool, and submit one processing task to QThreadPool when processing each image patch, and initialize one QVector. <QFutur e<QList<QSurfaceDataRow*> The custom container, Qvector, caches the data of each frame of elevation image patch and stores the results of each concurrent task. Among them, Qvector is a 3D coordinate value object, QSurface is the result object of an asynchronous task, QList is a linked list object that stores elements of a given type, and QSurfaceDataRow is a 3D data storage collection of feature coordinates.
[0085] Based on the size of the elevation image data, a reasonable number of blocks is preset. Data is loaded in batches by block by traversing the image rows, avoiding loading the entire image at once and reducing memory usage. The task of reading the entire elevation image is decomposed into multiple subtasks by block. Through a thread pool and scheduling mechanism, each subtask is submitted to the QThreadPool thread pool to be assigned to different threads for execution. The result of the entire data block is stored in a cache.
[0086] The process involves mapping elevation values at characteristic coordinates to height values, and determining the mapping relationship between elevation value g and height value y using elevation value normalization methods, including but 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 as follows:
[0088]
[0089] When the elevation value g is normalized to square, the mapping relationship between the height value y and the elevation value g is as follows:
[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 as follows:
[0092]
[0093] Among them, y min y represents the maximum height of the normalized range. max This represents 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 changes are more linear compared to logarithmic normalization; linear normalization can map grayscale values to a specific elevation range. The elevation map in this embodiment uses linear normalization.
[0095] In the segmentation subtask, the ASTR algorithm is used to adaptively adjust the downsampling rate based on the degree of gray value change of local image features. A dynamic downsampling factor is used to control the sampling density of different regions, and basic edge detection is combined to optimize the sampling strategy.
[0096] The ASTR algorithm is used to adaptively adjust the downsampling rate based on local features of the image, using a dynamic downsampling factor to control the sampling density in different regions, and combining basic edge detection to optimize the sampling strategy. This achieves efficient use of computational resources while preserving the details of the generated terrain.
[0097] 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 (ASTR algorithm) is preferred, and the specific method is as follows:
[0098] S1. For the current sampling coordinates, calculate the downsampling factor f based on its gradient, as follows:
[0099]
[0100] Where Δg is the gradient of the current sampling coordinate, th is the preset grayscale contrast threshold for the category of the region where the current sampling coordinate is located, F = 0.5, f l =1,f h =2: The gradient Δg of the current sampling coordinates is calculated as follows:
[0101] Δg=|gg - |+|gg+ |
[0102] Among them, g - g is the grayscale value of the previous sampling coordinate. + The grayscale value is the presampled coordinate, which is the coordinate obtained by moving a standard step along the sampling direction;
[0103] S2. Using the quotient of the standard step size and the downsampling factor f obtained in step S1 as the sampling step size, search for the next sampling coordinate according to the preset sampling direction;
[0104] In this example, a height mapping lookup table (LUT) of size 256 is defined. Based on the directly accessed pixel value and the normalized grayscale value, the corresponding height value y is transformed and obtained. The next sampling coordinate is searched by row and direction. The normalized elevation value of the pixel in step one is extracted to obtain the third axis coordinate value of the current pixel. 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 to QVector height mapping array lookup table (LUT) of size 256, and then directly accessing pixel operations on bitmap data, the performance overhead of multiple function calls is avoided. The accessed data is used in conjunction with the pre-defined lookup table to obtain the elevation value of each data point, thereby improving the efficiency of grayscale conversion and avoiding redundant calculations.
[0106] S3. Repeat steps S1 and S2 until the elevation image blocks are traversed. This embodiment traverses each row and column of the current elevation image data block.
[0107] Each subtask is submitted to the asynchronous execution queue using QFuture, and a mutex is created simultaneously. In QThreadPool, before each thread begins processing shared data, the mutex's locking method ensures that only one thread accesses the resource. While a thread holds the lock, it safely reads the image tile data, calls a blocking method in the current thread, and unlocks the mutex after the task completes. This process continues until all asynchronous operations are finished, and all subtasks are collected and merged into a single custom data structure, QList.<QSurfaceDataRow*> In this process, the mutex object is destroyed to release resources.
[0108] The QMutex mutex is used to lock the task before it is executed and unlock it after the task is completed. This prevents race conditions or data inconsistency caused by multiple threads accessing the shared resource at the same time. The QFuture is used to asynchronously compute the result and block the current thread until the asynchronous operation is completed, and then the results of each subtask are collected.
[0109] (4) Three-dimensional reconstruction: Collect all feature coordinates and height values at the coordinates obtained in step (3), and perform three-dimensional reconstruction to obtain a three-dimensional terrain map of the elevation image of the three-dimensional terrain to be reconstructed.
[0110] All collected feature coordinate results are stored line by line in a custom class QSurfaceDataRow, 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 in order to pass it to the data proxy QSurfaceDataProxy. The integrated interface then constructs the 3D terrain visualization of the elevation data.
[0111] Load Figure 3 A 3D reconstruction test was performed on the elevation map. Using traditional parallel loading methods, the visualization loading process took 38ms. The results are as follows... Figure 4 As shown, the time cost of this embodiment is 9ms, and the result is as follows. Figure 5 As shown, the two methods have similar 3D reconstruction effects, but the time cost of this embodiment is significantly lower.
[0112] Those skilled in the art will readily understand that the above description is merely 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 within the scope of protection of the present invention.
Claims
1. A method for reconstructing three-dimensional terrain based on elevation images, characterized in that, Includes the following steps: (1) Data loading: Read the elevation image of the three-dimensional terrain to be reconstructed; each pixel of the elevation image includes planar coordinate information and elevation value information, the planar coordinate information is used to represent the corresponding position of the three-dimensional terrain to be reconstructed, and the elevation value information is used to represent the altitude information of the three-dimensional terrain to be reconstructed at that position; the elevation value is the image grayscale value; (2) Edge detection: The edge detection algorithm is used to detect the edge contours in the elevation image obtained in step (1) to obtain the edge coordinates. The elevation image block is divided into regions according to the edge contours and the category of the region is determined. (3) Concurrent mapping: The elevation image obtained in step (1) is divided into blocks to obtain elevation image blocks. Concurrent threads are used to search for feature coordinates within the elevation image blocks and map them to three-dimensional coordinates. Each concurrent thread executes an elevation image block mapping subtask, which 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, to obtain the sampling coordinates and use the sampling coordinates and edge coordinates of the elevation image block as feature coordinates, and the elevation value at the feature coordinates is mapped to the height value. The adaptive downsampling terrain correction algorithm, which follows the principle that the greater the height gradient, the denser the sampling density, is specifically as follows: S1. For the current sampling coordinates, calculate the downsampling factor based on its gradient. ,as follows: , in, The gradient of the current sampling coordinates. The grayscale contrast threshold is preset for the category of the region where the current sampling coordinates are located. To achieve dense sampling for large grayscale changes and sparse sampling for small grayscale changes: the gradient of the current sampling coordinates. The calculation method is as follows: , in, The grayscale value of the previous sampling coordinate. The grayscale value is the presampled coordinate, which is the coordinate obtained by moving a standard step along the sampling direction; This refers to the elevation value; S2, the downsampling factor obtained in step S1 using the standard step size. The quotient is used as the sampling step size, and the next sampling coordinate is searched according to the preset sampling direction; S3. Repeat steps S1 and S2 until the elevation image blocks are traversed; (4) Three-dimensional reconstruction: Collect all feature coordinates and height values at the coordinates obtained in step (3), 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 images as described in claim 1, characterized in that, 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 images as described in 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 a grayscale image.
4. The three-dimensional terrain reconstruction method based on elevation images as described in claim 3, characterized in that, The edge detection algorithm used in step (2) is the Sobel algorithm.
5. The three-dimensional terrain reconstruction method based on elevation images as described in 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 number of pixels in the elevation image block is within a preset range.
6. The three-dimensional terrain reconstruction method based on elevation images as described in claim 1, characterized in that, Step (3) involves mapping the elevation values at the feature coordinates to height values and determining the elevation values using a normalization method. With height value The mapping relationship, wherein the elevation value normalization method includes: logarithmic normalization, square normalization, or linear normalization.
7. The three-dimensional terrain reconstruction method based on elevation images as described in claim 6, characterized in that, Step (3) When the elevation value When using log normalization, height value With elevation value The mapping relationship is as follows: , When elevation value When using square normalization, the height value With elevation value The mapping relationship is as follows: , When elevation value When using linear normalization, the height value With elevation value The mapping relationship is as follows: , in, The minimum height of the normalized range, This represents the maximum height of the normalized range.
8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the three-dimensional terrain reconstruction method based on elevation images as described in any one of claims 1 to 7.
9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the three-dimensional terrain reconstruction method based on elevation images as described in any one of claims 1 to 7.
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