High-speed distributed image cutting method and system based on Tiff file processing
Through the distributed parallel computing architecture, the map cutting process of large-scale map images is solved, and the problem of inefficiency in the existing technology is achieved and fast and efficient tile generation is achieved.
Patent Information
- Application Number
- CN202411809377.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-04-25
AI Technical Summary
The prior art is inefficient when processing map images with large scales, resulting in difficult or even inability to complete.
Using a high-speed distributed map cutting method based on Tiff file processing, by obtaining the original map image and performing bottom-up image shrinkage, calculating the tile boundary of the tile pyramid image for out-extend, segmenting the original map image into multiple target images, and distributing it to multiple computing nodes for distributed map cutting processing.
It significantly improves the cutting efficiency of large-scale map images, shortens processing time, from weeks or even months to hours, and improves the stability and scalability of the system.
Smart Images

Figure CN119887494A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of GIS technology, and in particular relates to a high-speed distributed image cutting method and system based on Tiff file processing. Background Art
[0002] In the prior art, when tiling a map image in Tiff file format to generate tiles, the map image is generally read first, and then the pixel range of each tile in the map image is calculated according to the tile standard. The tile is then cut and saved as a tile image. This can effectively perform tile processing when processing maps of a general small area. However, when faced with large-scale maps of a large area, the image file size is too large, and the following reasons generally lead to processing difficulties, low efficiency, or even incompletion:
[0003] 1. Directly load large Tiff files
[0004] In principle, generating fragments from large Tiff files can also be done using various tools, such as libTiff, ImageMagick, and GraphicsMagick. However, most software starts by opening and deciphering the entire image in huge temporary files in memory or on disk, which makes them very slow or often fails to complete the task due to insufficient memory.
[0005] For example, on a computer with 16 GiB of RAM and an i5 CPU, GraphicsMagick takes 70 minutes to open a Tiff file smaller than 512 MiB and make a tile of 64 JPEG files from a 103168x63232 pixel RGB image.
[0006] 2. Low CPU resource utilization
[0007] Traditional software does not use multi-threading when opening and processing a single image file. This results in the CPU utilization remaining at a very low level during the long waiting time when processing large Tiff files.
[0008] For example, on a computer with a quad-core i5 CPU, the CPU usage is generally maintained at around 25% when processing Tiff.
[0009] 3. If a failure occurs, all operations must be restarted.
[0010] Traditional GIS software processes map images to generate tiles, processing them from scratch. This means that if a failure occurs, the software must start over from the beginning. This creates significant rework costs for large-scale, large-scale maps, which can take weeks to generate tiles.
[0011] Therefore, a new map image cutting processing method is needed to improve the cutting efficiency of large-scale and large-scale map images. Summary of the Invention
[0012] In view of this, the present invention proposes a high-speed distributed image slicing method and system based on Tiff file processing, which is used to solve the problem that the existing image slicing methods have low processing efficiency for large-scale and large-scale map images.
[0013] In a first aspect, the present invention discloses a high-speed distributed image slicing method based on Tiff file processing, the method comprising:
[0014] Obtain the original map image, perform image shrinkage from bottom to top on the original map image according to the slice level, and obtain a tile pyramid image;
[0015] Expanding the tile boundary of the tile pyramid image according to the standard tile size to obtain a tile expansion boundary;
[0016] Segment the original map image according to the outer boundary of the topmost tile of this slicing task to obtain multiple target images;
[0017] Distribute multiple target images to multiple computing nodes for distributed image slicing to generate tile images.
[0018] Based on the above technical solution, preferably, the image shrinking from bottom to top on the original map image according to the slice level specifically includes:
[0019] Starting from the mth level map image, shrink upward step by step, and calculate the R, G, B and α values of each pixel in the upper level image. The calculation formula for image shrinkage is as follows:
[0020]
[0021] in, represents the red spectrum intensity of the pixel in the i-th row and j-th column of the m-1-th level image, They represent the red spectrum intensity of the pixels at the 2i-1th row and 2j-1th column, the 2i-1th row and 2jth column, the 2ith row and 2j-1th column, and the 2ith row and 2jth column in the mth level image respectively; represents the green spectrum intensity of the pixel in the i-th row and j-th column in the m-1-th level image, They represent the green spectrum intensity of the pixels at the 2i-1th row and 2j-1th column, the 2i-1th row and 2jth column, the 2ith row and 2j-1th column, and the 2ith row and 2jth column in the mth level image respectively; represents the blue spectrum intensity of the pixel in the i-th row and j-th column in the m-1-th level image, They represent the blue spectrum intensity of the pixels at the 2i-1th row and 2j-1th column, the 2i-1th row and 2jth column, the 2ith row and 2j-1th column, and the 2ith row and 2jth column in the mth level image respectively; Indicates the transparency value of the pixel in the i-th row and j-th column in the m-1-th level image. They respectively represent the transparency values of the pixels in the 2i-1th row and 2j-1th column, the 2i-1th row and 2jth column, the 2ith row and 2j-1th column, and the 2ith row and 2jth column in the mth level picture.
[0022] Based on the above technical solution, preferably, the step of expanding the tile boundary of the standard tile pyramid image according to the standard tile size specifically includes:
[0023] Upper boundary expansion:
[0024]
[0025] latitude top =|Row top ×tileSize×resolution y -latitude origin |
[0026] Among them, Row top is the tile row number where the upper boundary is located, latitude′ top is the latitude of the upper boundary after expansion, latitude top is the latitude of the upper boundary before expansion, latitude origin is the latitude of the origin of the tile scheme, tileSize is the standard tile size, resolution y It is the lowest vertical resolution of the map image;
[0027] Lower boundary expansion:
[0028]
[0029] latitude bottom =|(Row bottom +1)×tileSize×resolution-latitude origin |
[0030] Among them, Row bottom is the tile row number where the lower boundary is located, latitude′ bottom is the latitude of the lower boundary after expansion, latitude bottom is the latitude of the lower boundary before expansion;
[0031] Left border expansion:
[0032]
[0033] longitude′ left =|Col left ×tileSize×resolution x -longitude origin |
[0034] Among them, Col left is the tile row number where the left border is located, longitude′ left is the longitude of the left boundary after expansion, left is the longitude of the left boundary before expansion, resolution x It is the lowest horizontal resolution of the map image;
[0035] Right border expansion:
[0036]
[0037] longitude′ right =|(Col right +1)×tileSize×resolution x -longitude origin |
[0038] Among them, Col right is the tile row number where the right border is located, longitude′ right is the longitude of the right boundary after expansion, right is the longitude of the right boundary before expansion, resolution x It is the lowest horizontal resolution of the map image.
[0039] On the basis of the above technical solution, preferably, before segmenting the original map image, the method further includes: determining the number of tasks for segmenting the original map image, and the calculation formula for the number of tasks is: t=m×n
[0040] Where t is the number of tasks, m is the number of nodes, and n is the number of CPU processing cores of each node;
[0041] The number of tasks is the same as the number of target images.
[0042] Based on the above technical solution, preferably, generating a tile image specifically includes:
[0043] In each computing node, the position and size of each tile in the corresponding target image are specified, and the corresponding file segment is directly read and saved as a tile image.
[0044] On the basis of the above technical solution, preferably, the method further comprises:
[0045] If the original map image is composed of multiple local images, each local image is sliced using the α channel of the image to obtain the tiles corresponding to each local image, and the tiles corresponding to all local images are merged.
[0046] Based on the above technical solution, preferably, merging tiles corresponding to all local images specifically includes:
[0047] Assume that there are tiles a, b, ..., z corresponding to multiple local images under the same row and column number. The calculation formula for tile merging is as follows:
[0048]
[0049] in, They represent the red, green, and blue spectral intensity values of the pixel in the i-th row and j-th column of the final synthesized tile σ respectively; They represent the red spectrum intensity value, green spectrum intensity value, and blue spectrum intensity value of the pixel in the i-th row and j-th column of the source tile a respectively; They represent the red, green, and blue spectral intensity values of the pixel in the i-th row and j-th column of the source tile z, respectively; Respectively represent the transparency of the pixel in the i-th row and j-th column of the source tiles a and z, α max Indicates the maximum value of the alpha channel.
[0050] In a second aspect, the present invention discloses a high-speed distributed image slicing system based on Tiff file processing, the system comprising:
[0051] Image shrinkage module: used to obtain the original map image, shrink the original map image from bottom to top according to the slice level, and obtain a tile pyramid image;
[0052] Boundary expansion module: used to expand the tile boundary of the tile pyramid image according to the standard tile size to obtain the tile expansion boundary;
[0053] Image segmentation module: used to segment the original map image according to the outer boundary of the top-level tile of this cutting task to obtain multiple target images;
[0054] Tile generation module: used to distribute multiple target images to multiple computing nodes for distributed image slicing processing to generate tile images.
[0055] A third aspect of the present invention discloses an electronic device, comprising: at least one processor, at least one memory, a communication interface, and a bus;
[0056] The processor, memory, and communication interface communicate with each other via the bus.
[0057] The memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to implement the method according to the first aspect of the present invention.
[0058] According to a fourth aspect of the present invention, a computer-readable storage medium is disclosed, wherein the computer-readable storage medium stores computer instructions, and the computer instructions enable a computer to implement the method according to the first aspect of the present invention.
[0059] The present invention has the following beneficial effects compared to the prior art:
[0060] 1) The present invention adopts a distributed parallel computing architecture to divide the map image into multiple task target images of the same or similar size, and then sends them to each computing node for distributed image slicing processing. The map image required to be processed by a single tile task is reduced to less than 2 GiB, avoiding the need to load the entire file, greatly improving computing efficiency. When processing large-scale provincial-level and ultra-large map images, the processing time is shortened from the original processing cycle of several weeks or even months to several hours.
[0061] 2) The present invention expands the tile boundaries of the standard tile pyramid image according to the standard tile size to avoid the situation where the tile boundaries of the lower level are located in the center of the upper level tile, thereby improving the reliability of image segmentation.
[0062] 3) The present invention performs tile cutting on a map image composed of multiple images with irregular boundaries and then merges the tiles, which can effectively avoid time-consuming large file splicing operations and obtain complete and seamless tile files with higher processing efficiency.
[0063] 4) This invention divides the map image into multiple task images. When a failure occurs during processing, the entire process does not need to be reprocessed from the beginning. The failure of each task image can be independently processed and automatically recovered. Because the image size of a single task is relatively small, reprocessing can be completed in a very short time. When a task on a node fails, the failure information is recorded and the abnormal task is repeatedly attempted after the normal task processing is completed to ensure the task results and have good stability.
[0064] 5) The present invention adopts a distributed parallel computing architecture, which can achieve a linear improvement in processing efficiency by horizontally expanding processing equipment, and has better scalability. BRIEF DESCRIPTION OF THE DRAWINGS
[0065] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0066] Figure 1 This is a flow chart of a high-speed distributed image cutting method based on Tiff file processing of the present invention. DETAILED DESCRIPTION
[0067] The following will be combined with the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0068] See also Figure 1 The present invention discloses a high-speed distributed image cutting method based on Tiff file processing, the method comprising:
[0069] S1. Obtain an original map image, and perform image shrinkage on the original map image from bottom to top according to the slice level to obtain a tile pyramid image.
[0070] Commonly used map tile solutions include the Tiandi map solution based on the national geodetic coordinate system CGCS2000 and the Google solution based on the WGS84 coordinate system. The former is used in my country's government and public service fields such as natural resources, surveying and mapping, and construction planning, while the latter is generally used in commercial map services such as Amap.
[0071] Take the Tiandi Map solution as an example. Figure 1 As shown in Figure 1, map tiles are organized into a pyramidal structure using a quadtree. Starting from the global level, each level is a quarter-division of the previous level. The ground resolution and display scale corresponding to each level are shown in Table 1.
[0072] Table 1
[0073] level Ground resolution / (m / pixel) Display scale 1 78 271.5170 1∶295 829 355.45 2 39 135.758 5 1∶147 914 677.73 3 19 567.879 2 1∶73 957 338.86 4 9 783.939 6 1∶36 978 669.43 5 4 891.969 8 1∶18 489 334.72 6 2 445.984 9 1∶9 244 667.36 7 1 222.992 5 1∶4 622 333.68 8 611.496 2 1∶2 311 166.84 9 305.718 1 1∶1 155 583.42 10 152.874 1 1∶577 791.71 11 76.437 0 1∶288 895.85 12 38.218 5 1∶1444 447.93 13 19.109 3 1∶72 223.96 14 9.554 6 1∶36 111.98 15 4.777 3 1∶18 055.99 16 2.388 7 1∶9028.00 17 1.194 3 1∶4 514.00 18 0.597 2 1∶2 257.00 19 0.298 6 1∶1 128.50 20 0.149 3 1∶564.25
[0074] In the embodiment of the present invention, the original map image is shrunk from bottom to top at the slice level to reduce the computational effort and information loss associated with image scaling. Compared to traditional image scaling algorithms, the algorithm of the present invention uses a more efficient matrix multiplication method.
[0075] Specifically, starting from the mth level map image, shrink upward step by step, and calculate the R, G, B and α values of each pixel in the upper level image. The calculation formula for image shrinkage is as follows:
[0076]
[0077] in, represents the red spectrum intensity of the pixel in the i-th row and j-th column of the m-1-th level image, They represent the red spectrum intensity of the pixels at the 2i-1th row and 2j-1th column, the 2i-1th row and 2jth column, the 2ith row and 2j-1th column, and the 2ith row and 2jth column in the mth level image respectively; represents the green spectrum intensity of the pixel in the i-th row and j-th column in the m-1-th level image, They represent the green spectrum intensity of the pixels at the 2i-1th row and 2j-1th column, the 2i-1th row and 2jth column, the 2ith row and 2j-1th column, and the 2ith row and 2jth column in the mth level image respectively; represents the blue spectrum intensity of the pixel in the i-th row and j-th column in the m-1-th level image, They represent the blue spectrum intensity of the pixels at the 2i-1th row and 2j-1th column, the 2i-1th row and 2jth column, the 2ith row and 2j-1th column, and the 2ith row and 2jth column in the mth level image respectively; Indicates the transparency value of the pixel in the i-th row and j-th column in the m-1-th level image. They respectively represent the transparency values of the pixels in the 2i-1th row and 2j-1th column, the 2i-1th row and 2jth column, the 2ith row and 2j-1th column, and the 2ith row and 2jth column in the mth level picture.
[0078] By analogy with visible light, the algorithm of the present invention can also be used to generate tiles for multispectral and hyperspectral images.
[0079] S2. Expand the tile boundary of the tile pyramid image according to the standard tile size to obtain a tile expansion boundary.
[0080] Since the standard tile size is 256×256, the boundaries of the map image are not necessarily exactly on the tile boundaries. Therefore, before segmenting the map image, it is necessary to calculate the tile boundaries corresponding to the top, bottom, left, and right boundaries of the image and expand the tile boundaries.
[0081] In an embodiment of the present invention, the step of expanding the tile boundary of the standard tile pyramid image according to the standard tile size specifically includes:
[0082] ①Extension of the upper boundary:
[0083]
[0084] latitude top =|Row top ×tileSize×resolution y -latitude origin |
[0085] Among them, Row top is the tile row number where the upper boundary is located, latitude′ top is the latitude of the upper boundary after expansion, latitude top is the latitude of the upper boundary before expansion, latitude origin is the latitude of the origin of the tile scheme, tileSize is the standard tile size, resolution y It is the lowest vertical resolution of the map image;
[0086] ② Lower boundary expansion:
[0087]
[0088] latitude bottom =|(Row bottom +1)×tileSize×resolution y -latitude origin |
[0089] Among them, Row bottom is the tile row number where the lower boundary is located, latitude′ bottom is the latitude of the lower boundary after expansion, latitude bottom is the latitude of the lower boundary before expansion;
[0090] ③Left border expansion:
[0091]
[0092] longitude′ left =|Col left ×tileSize×resolution x -longitude origin |
[0093] Among them, Col left is the tile row number where the left border is located, longitude′ left is the longitude of the left boundary after expansion, leftis the longitude of the left boundary before expansion, resolution x It is the lowest horizontal resolution of the map image;
[0094] ④Right boundary expansion:
[0095]
[0096] longitude′ right =|(Col right +1)×tileSize×resolution x -longitude origin |
[0097] Among them, Col right is the tile row number where the right border is located, longitude′ right is the longitude of the right boundary after expansion, right is the longitude of the right boundary before expansion, resolution x It is the lowest horizontal resolution of the map image.
[0098] The final latitude top 、latitude′ bottom 、longitude′ left and longitude′ right This is the tile expansion boundary.
[0099] S3. Segment the original map image according to the outer boundary of the topmost tile of this slicing task to obtain multiple target images.
[0100] In order to fully utilize the parallel processing capabilities of multi-nodes and multi-core CPUs, the present invention adopts a distributed parallel computing architecture, which divides the map image into multiple tile generation tasks for decentralized processing. The number of tasks for segmenting the original map image is determined according to the number of CPU processing cores of each node, and the number of tasks is the same as the number of target images.
[0101] The number of tasks t should be an integer multiple of the product as much as possible. The specific calculation formula is as follows:
[0102] t=m×n
[0103] Where m is the number of nodes, and n is the number of CPU processing cores in each node.
[0104] After expanding the map image's boundaries, the original image is segmented according to the boundaries of the topmost tile in the pyramid. For example, if the prefecture-level map starts generating tiles at level 11, the segmentation is based on the tile boundaries of level 11. The remaining boundaries must be integer multiples of 256 pixels, which are used to calculate the latitude and longitude coordinates of the target image.
[0105] S4. Distribute multiple target images to multiple computing nodes for distributed image slicing processing to generate tile images.
[0106] The segmented target image, along with the latitude and longitude coordinates and task parameters, is sent to each computing node for tile generation and merging.
[0107] Each target image after segmentation may still be a large Tiff file. In order to avoid loading the entire file and improve processing efficiency, the present invention directly reads the corresponding file fragments and saves them as tile images in each computing node by specifying the position and size of each tile in the target image.
[0108] For example, if the starting tile row and column numbers (upper left corner) of the target image are row and col respectively, then the pixel range of the tile at row+i and column col+j in the image is the rectangular area from the coordinates (i×256+1,j×256+1) in the image to the coordinates ((i+1)×256,(j+1)×256).
[0109] S5. If the original map image is composed of multiple local images, each local image is sliced using the α channel of the image to obtain tiles corresponding to each local image, and the tiles corresponding to all local images are merged.
[0110] In the actual map image processing process, the original map image may be composed of multiple local images with irregular boundaries due to cloud removal and other processing. Traditional GIS software generally stitches the local images together before processing them into tiles. This large file stitching operation is very time-consuming and inefficient.
[0111] In the embodiment of the present invention, each partial image is sliced using the image's alpha channel to obtain the tile corresponding to each partial image, and the tiles corresponding to all partial images are merged. This effectively avoids the time-consuming large file splicing operation while still obtaining a complete and seamless tile file.
[0112] In the embodiment of the present invention, merging tiles corresponding to all local images specifically includes:
[0113] Assume that there are tiles a, b, ..., z corresponding to multiple local images under the same row and column number. The calculation formula for tile merging is as follows:
[0114]
[0115] in, They represent the red, green, and blue spectral intensity values of the pixel in the i-th row and j-th column of the final synthesized tile σ respectively; They represent the red spectrum intensity value, green spectrum intensity value, and blue spectrum intensity value of the pixel in the i-th row and j-th column of the source tile a respectively; They represent the red, green, and blue spectral intensity values of the pixel in the i-th row and j-th column of the source tile z, respectively; Respectively represents the transparency of the pixel in row i and column j in source tiles a and z; α max Indicates the maximum value of the α channel, which is completely opaque. max Used for normalization processing.
[0116] Since the present invention adopts a distributed parallel computing architecture, task scheduling becomes the key to whether the design advantages can be brought into play. In order to maximize the effective use of resources and ensure the efficiency of task execution, the present invention adopts an asynchronous task method for scheduling management.
[0117] First, the control node obtains the map image file, obtains the tile solution, and calculates and splits the task.
[0118] Then, each task is published to each computing node in a circular manner, and the task status is recorded in the Redis cache.
[0119] Finally, each computing node pulls the tasks to be executed from Redis, performs tile generation and updates the task status.
[0120] After the current task is completed, the computing node will pull the next task until all tasks are pulled and executed.
[0121] The distributed parallel computing architecture used in this invention can be deployed in a clustered manner, horizontally expanding processing nodes to improve processing efficiency and shorten processing time. For example, when a four-node cluster is deployed, the overall processing time is only 1 / 4 of that of a single node.
[0122] Furthermore, given that tile calculations and image reading processes for map images are largely linear computations, the present invention utilizes a thread pool to implement multi-threaded processing for a single task target image, thereby improving CPU utilization. Because the present invention divides the map image into multiple task images, task-level fault handling and automatic recovery are possible. When a task on a node fails, the fault information is recorded, and after normal task processing is completed, the faulty task is repeatedly attempted.
[0123] This method splits a large original map image in Tiff file format into multiple target images and sends them to various computing nodes for image processing. This reduces the map image size required for a single tile task to less than 2 GiB, ensuring the feasibility of tile generation tasks. When processing large-scale, provincial-level map images, this method significantly reduces the processing time from weeks or even months to just hours.
[0124] The present invention can directly read and save image tiles based on pre-calculated image segments' positions and sizes. This allows for high-speed processing of partial Tiff file contents without having to open the entire target image, further improving computational efficiency. For example, on a computer with 16 GiB of RAM and an i5 CPU, requesting to open a Tiff file smaller than 512 MiB and creating 64 JPEG tiles from a 103168 × 63232 pixel RGB image takes only 2.5 seconds.
[0125] The present invention can improve the processing efficiency of large-scale map tiles in surveying and mapping, geographic information release, land and resource utilization, and commercial map services, thereby enhancing the data freshness of high-precision maps.
[0126] Corresponding to the above method embodiment, the present invention also discloses a high-speed distributed image slicing system based on Tiff file processing, the system comprising:
[0127] Image shrinkage module: used to obtain the original map image, shrink the original map image from bottom to top according to the slice level, and obtain a tile pyramid image;
[0128] Boundary expansion module: used to expand the tile boundary of the tile pyramid image according to the standard tile size to obtain the tile expansion boundary;
[0129] Image segmentation module: used to determine the number of tasks for segmenting the original map image, and segment the original map image according to the outer boundary of the topmost tile of this segmentation task to obtain multiple target images;
[0130] Tile generation module: used to distribute multiple target images to multiple computing nodes for distributed image slicing processing to generate tile images.
[0131] The above system embodiments and method embodiments correspond one to one. For a brief description of the system embodiments, please refer to the method embodiments.
[0132] The present invention also discloses an electronic device, comprising: at least one processor, at least one memory, a communication interface and a bus; wherein the processor, memory and communication interface communicate with each other through the bus; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to implement the aforementioned method of the present invention.
[0133] The present invention also discloses a computer-readable storage medium storing computer instructions that cause the computer to implement all or part of the steps of the method described in the embodiments of the present invention. The storage medium includes various media capable of storing program code, such as a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk.
[0134] The system embodiment described above is merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be distributed across multiple network units. A person skilled in the art may, without inventive effort, select some or all of the modules as needed to achieve the objectives of this embodiment.
[0135] 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, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A high-speed distributed image cutting method based on Tiff file processing, characterized in that: The method comprises: The original map image is obtained, and the image is shrunk from bottom to top according to the slice level to obtain a tile pyramid image; Expanding the tile boundary of the tile pyramid image according to the standard tile size to obtain a tile expansion boundary; The original map image is segmented according to the outer expansion boundary of the topmost tile of this cutting task to obtain multiple target images; Distribute multiple target images to multiple computing nodes for distributed image slicing to generate tile images.
2. The high-speed distributed image cutting method based on Tiff file processing according to claim 1 is characterized in that: The image shrinking from bottom to top according to the slice level of the original map image specifically includes: Starting from the mth level map image, shrink upward step by step, and calculate the R, G, B and α values of each pixel of the upper level image. The calculation formula for image shrinkage is as follows: in, represents the red spectrum intensity of the pixel in the i-th row and j-th column in the m-1-th level image, They represent the red spectral intensity of the pixels at the 2i-1th row and 2j-1th column, the 2i-1th row and 2jth column, the 2ith row and 2j-1th column, and the 2ith row and 2jth column in the mth level picture respectively; represents the green spectrum intensity of the pixel in the i-th row and j-th column in the m-1-th level image, They represent the green spectral intensity of the pixels at the 2i-1th row and 2j-1th column, the 2i-1th row and 2jth column, the 2ith row and 2j-1th column, and the 2ith row and 2jth column in the mth level picture respectively; represents the blue spectrum intensity of the pixel in the i-th row and j-th column in the m-1-th level image, They represent the blue spectrum intensity of the pixels at the 2i-1th row and 2j-1th column, the 2i-1th row and 2jth column, the 2ith row and 2j-1th column, and the 2ith row and 2jth column in the mth level picture respectively; Indicates the transparency value of the pixel in the i-th row and j-th column in the m-1-th level image. They respectively represent the transparency values of the pixels in the 2i-1th row and 2j-1th column, the 2i-1th row and 2jth column, the 2ith row and 2j-1th column, and the 2ith row and 2jth column in the m-th level picture.
3. The high-speed distributed image cutting method based on Tiff file processing according to claim 1 is characterized in that: The step of expanding the tile boundary of the standard tile pyramid image according to the standard tile size specifically includes: Upper boundary expansion: latitude′ top =|Row top ×tileSize×resolution y -latitude origin | Among them, Row top is the tile row number where the upper boundary is located, latitude′ top is the latitude of the upper boundary after expansion, latitude top is the latitude of the upper boundary before expansion, latitude origin is the latitude of the origin of the tile scheme, tileSize is the standard tile size, resolution y It is the lowest vertical resolution of the map image; Lower boundary expansion: latitude′ bottom =|(Row bottom +1)×tileSize×resolution y -latitude origin | Among them, Row bottom is the tile row number where the lower boundary is located, latitude′ bottom is the latitude of the lower boundary after expansion, latitude bottom is the latitude of the lower boundary before expansion; Left border expansion: length′ left =|Col left ×tileSize×resolution x -longitude origin | Among them, Col left is the tile row number where the left border is located, longitude′ left is the longitude of the left border after expansion, left is the longitude of the left border before expansion, resolution x It is the lowest horizontal resolution of the map image; Right border expansion: length′ right =|(Col right +1)×tileSize×resolution x -longitude origin | Among them, Col right is the tile row number where the right border is located, longitude′ right is the longitude of the right boundary after expansion, right is the longitude of the right border before expansion, resolution x It is the lowest horizontal resolution of the map image.
4. The high-speed distributed image cutting method based on Tiff file processing according to claim 1 is characterized in that: Before segmenting the original map image, the method further includes: determining the number of tasks for segmenting the original map image, and the calculation formula for the number of tasks is: t=m×n Among them, t is the number of tasks, m is the number of nodes, and n is the number of CPU processing cores of each node; The number of tasks is the same as the number of target images.
5. The high-speed distributed image cutting method based on Tiff file processing according to claim 1 is characterized in that: The generating of the tile image specifically includes: In each computing node, the position and size of each tile in the corresponding target image are specified, and the corresponding file fragment is directly read and saved as a tile image.
6. The high-speed distributed image cutting method based on Tiff file processing according to claim 1 is characterized in that: The method further comprises: If the original map image is composed of multiple local images, each local image is cut using the α channel of the image to obtain the tile corresponding to each local image, and the tiles corresponding to all local images are merged.
7. The high-speed distributed image cutting method based on Tiff file processing according to claim 6 is characterized in that: The merging of tiles corresponding to all local images specifically includes: Assume that there are tiles a, b, ..., z corresponding to multiple local images under the same row and column number, and the calculation formula for tile merging is as follows: in, They represent the red spectrum intensity value, green spectrum intensity value, and blue spectrum intensity value of the pixel in the i-th row and j-th column of the final synthesized tile σ respectively; They represent the red spectrum intensity value, green spectrum intensity value, and blue spectrum intensity value of the pixel in the i-th row and j-th column in the source tile a respectively; They represent the red spectrum intensity value, green spectrum intensity value, and blue spectrum intensity value of the pixel in the i-th row and j-th column in the source tile z respectively; Respectively represent the transparency of the pixel in the i-th row and j-th column in the source tile a and z, α max Indicates the maximum value of the alpha channel.
8. A high-speed distributed image cutting system based on Tiff file processing, characterized in that: The system comprises: Image shrinkage module: used to obtain the original map image, shrink the original map image from bottom to top according to the slice level, and obtain a tile pyramid image; Boundary expansion module: used to expand the tile boundary of the tile pyramid image according to the standard tile size to obtain the tile expansion boundary; Image segmentation module: used to segment the original map image according to the outer boundary of the topmost tile of this cutting task to obtain multiple target images; Tile generation module: used to distribute multiple target images to multiple computing nodes for distributed image slicing processing to generate tile images.
9. An electronic device, characterized in that: include: at least one processor, at least one memory, a communication interface, and a bus; Wherein, the processor, memory, and communication interface communicate with each other via the bus; The memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions enable a computer to implement the method according to any one of claims 1 to 7.