Grid-based grid image distributed preprocessing method

By adopting a grid-based distributed preprocessing method, the problems of low image processing efficiency, inconsistent data quality, and poor scalability in traditional methods are solved, achieving efficient and accurate image processing and seamless stitching, and improving the utilization of computing resources and the adaptability of the system.

CN119006262APending Publication Date: 2024-11-22河南省种业发展中心
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411078567.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-07
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

Traditional methods cannot properly break down large single images, resulting in low utilization of computing resources, slow processing speed, and a lack of effective data preprocessing steps, which affects image data quality and scalability.

Method used

A grid-based distributed preprocessing method is adopted. By extracting the geographic coordinate range of the image, generating grid configuration parameters, cropping the image by grid cells, constructing a grid task model and a distributed task scheduler, performing preprocessing such as geometric correction, fusion, mosaicking and atmospheric correction, and finally stitching the images to output the final image.

Benefits of technology

It significantly improves image processing efficiency, reduces memory overflow errors, ensures the integrity and continuity of image data, and enhances the scalability and flexibility of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119006262A_ABST
    Figure CN119006262A_ABST
Patent Text Reader

Abstract

The invention discloses a grid-based grid image distributed preprocessing method. The grid-based grid image distributed preprocessing method comprises the following steps: extracting a geographic coordinate range of an original grid image and converting a geographic coordinate system into a target coordinate system; generating grid configuration parameters according to the extracted geographic coordinate range and a preset grid size; cutting the original grid image according to the range of each grid unit by utilizing the generated grid configuration parameters, and extracting an image part corresponding to each grid unit to obtain a grid image; constructing a grid task model, a grid image preprocessing executor, a grid task manager and a grid distributed task scheduler to complete a preprocessing process of a grid image; and carrying out edge overlapping calculation on the pre-processed grid image, cutting an overlapping region image, splicing the cut grid image, and publishing a complete output image. The method is high in processing efficiency, improves the preprocessing success rate of a single image with a large physical capacity, guarantees the integrity and continuity of output image data, and is high in expandability and adaptability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The invention relates to the technical field of remote sensing image processing, and in particular to a grid-based raster image distributed preprocessing method. Background Art

[0002] When processing a single large image, traditional methods are unable to reasonably split the object and can only rely on single-node computing resources, making it difficult to perform distributed processing, slow in processing speed, and low in computing resource utilization.

[0003] For example, the invention patent with application number 201610066304.7 discloses a parallel raster image slicing method. It includes the following steps: Step 1: Get the original raster image, set the target tile level and the total number of processes; Step 2: Read the metadata information of the original raster image; Step 3: Transform the original raster image to the WebMercator projection; Step 4: Calculate the maximum and minimum tile levels of the projection transformation result image; Step 5: Calculate the tile row and column number range of the projection transformation result image and establish an empty tile file; Step 6: Use the wheel method to divide tasks for each process; Step 7: Each process reads the tiles in its respective task pool one by one, and inversely calculates the geographical range corresponding to the tiles; Calculate the relative position and size of the intersecting area in the projection transformation result image, and read the original raster data of the intersecting area into the memory space; Step 8: Write the resampled data into the previously created empty tile file. Although it supports multi-node parallel slicing, it gets rid of the problem of limited hardware resources and low resource utilization of the traditional single-node slicing method. However, the lack of effective data preprocessing steps (such as geometric correction, fusion, mosaicking, cropping, atmospheric correction, etc.) may lead to inconsistent image data quality and affect data processing accuracy. During the image synthesis process, improper boundary processing may cause subsequent image tiles to overlap or be missing, affecting the continuity and integrity of the overall image.

[0004] Moreover, existing methods often need to be redesigned and adjusted when processing larger-scale data or adding new computing nodes, and lack good scalability. Summary of the invention

[0005] The present invention proposes a grid-based distributed preprocessing method for raster images, which is used to solve the problems of low processing efficiency, accuracy and consistency, and poor scalability when traditional methods process a single large image.

[0006] In order to achieve the above object, the technical solution of the present invention is achieved as follows:

[0007] A grid-based raster image distributed preprocessing method includes the following steps:

[0008] S1, extract the geographic coordinate range of the original raster image, and convert the geographic coordinate system into the target coordinate system;

[0009] S2. generating grid configuration parameters according to the extracted geographic coordinate range and the predetermined grid size;

[0010] S3, using the generated grid configuration parameters, clipping the original grid image according to the range of each grid unit, extracting the image portion corresponding to each grid unit, and obtaining a grid image;

[0011] S4, constructing a grid task model, a grid image preprocessing executor, a grid task manager and a grid distributed task scheduler, wherein the grid distributed task scheduler receives all grid images clipped based on the grid as parameters and schedules and configures the grid task manager, and the grid task model assembles input parameters formed after the original raster image is divided into grids based on the grid task model and transmits them to the grid image preprocessing executor managed by the grid task manager, and the grid image preprocessing executor completes the preprocessing process of the grid image;

[0012] S5. Calculate edge overlap of the preprocessed grid images, crop the overlapping area images, stitch the cropped grid images and publish the complete output image.

[0013] The grid task model includes a task ID, a grid coordinate object, a grid image input path, a grid image output path, and a processing parameter object; wherein the grid coordinate object includes a grid starting x coordinate, a grid starting y coordinate, a grid cell width, and a grid cell height, and the processing parameter object includes geographic correction and atmospheric correction.

[0014] The grid image preprocessing executor includes four image preprocessing classes, namely, geometric correction class, fusion class, mosaic class and atmospheric correction class.

[0015] The grid task manager uses the startExecutor(self,task,grid) function to start a new grid image preprocessing executor instance; the grid task manager uses the stopExecutor(self,executorID) function to stop the running grid image preprocessing executor; the grid task manager uses the destroyExecutor(self,executorID) function to destroy the grid image preprocessing executor instance; the grid task manager updates the grid image preprocessing executor status through the updateStatus(self,executorID,status) function.

[0016] The grid distributed task scheduler periodically checks the execution status of all grid task managers and updates the task status through the DistributedTaskScheduler.monitorManagers(self) method, sends a control command to the specified grid task manager through the DistributedTaskScheduler.sendCommand(self, managerID, command) method, monitors the error status of the grid task manager through the DistributedTaskScheduler.handleErrors(self) method, and if an error occurs in a grid task manager, starts a new grid task manager to replace it; the grid distributed task scheduler centrally manages all pre-processed grid image files through the DistributedTaskScheduler.collectResults(self) method to form a grid image file collection.

[0017] The grid configuration parameters include the number of grid cells, the size, position and unique identifier of each grid cell, and the number of horizontal grid cells of the original raster image. The number of vertical grid cells in the original raster image Among them, tile_width is the grid unit width, tile_height is the grid unit height, E max is the coordinate of the southern boundary of the original raster image, E min is the northern boundary coordinate of the original raster image, N max is the western boundary coordinate of the original raster image, N min It is the eastern boundary coordinate of the original raster image.

[0018] The grid configuration parameters include the number of grid cells, the size, position and unique identifier of each grid cell, and the number of horizontal grid cells of the original raster image. The number of vertical grid cells in the original raster image Among them, tile_width is the grid unit width, tile_height is the grid unit height, E max is the coordinate of the southern boundary of the original raster image, E min is the northern boundary coordinate of the original raster image, N max is the western boundary coordinate of the original raster image, N min It is the eastern boundary coordinate of the original raster image.

[0019] The method for extracting the image portion corresponding to each grid unit is as follows: first use the ReadAsArray() method in the GDAL library to read according to the pixel coordinate range of the grid unit: offset =i*tile_width,yoffset =j*tile_height, then read from (x offset ,y offset ) to (x offset +tile_width,y offset +tile_height) image data; where x offset is the starting x coordinate of the grid, y offset is the starting y coordinate of the grid, tile_width is the grid unit width, tile_height is the grid unit height, i is the row number of the grid, and j is the column number of the grid.

[0020] The method for edge overlap calculation in step S5 is: Assume that the coordinates of the lower left corner of the grid image after the first rectangular preprocessing are (x1 min , y1 min ), the coordinates of the upper right corner are (x1 max , y1 max ); The coordinate of the lower left corner of the second rectangular preprocessed grid image is (x2 min , y2 min ), the coordinates of the upper right corner are (x2 max , y2 max ); then the lower left corner coordinate of the overlapping area of ​​the two rectangular preprocessed grid images is x min =max(x1 min ,x2 min ), y min =max(y1 min ,y2 min ), calculate the coordinate of the upper right corner of the overlapping area of ​​the two rectangular preprocessed grid images as x max =min(x1 max ,x2 max ), y max =min(y1 max ,y2 max ), so the area of ​​the overlapped area of ​​the two rectangular preprocessed grid images is overlap_area = (x max -x min )*(y max -y min ).

[0021] The method for cropping the overlapping area image in step S5 is: opening the input preprocessed grid image file, and using the gdal.Translate(output_filepath, dataset, projWin = [ulx, uly, lrx, lry]) function to crop the overlapping area image according to the specified four-dimensional coordinates, and saving the cropped grid image.

[0022] The method for stitching the cropped grid image in step S5 is: using the gdal.BuildVRT('temporary.vrt',input_files) function to create a virtual image file from the cropped grid image file list, and then using the gdal.Translate(output_filepath,vrt) function to convert the virtual image file into an actual stitched image file and save it.

[0023] Compared with the prior art, the present invention has the following beneficial effects:

[0024] 1. The present invention realizes distributed image preprocessing through coordinate grid division, greatly reduces the preprocessing time of raster images, and significantly improves the processing efficiency.

[0025] 2. The present invention crops a single large image through coordinate grid division, reduces it into multiple small images, and distributes them to different servers for preprocessing, thereby reducing the error rate due to server memory overflow due to large images, thereby improving the preprocessing success rate of single images with large physical capacity (greater than 2G).

[0026] 3. The present invention ensures the accurate geographic location of each grid image through equally spaced coordinate grid division and precise coordinate correction, ensures seamless splicing of grid images by calculating and cutting overlapping areas, reduces errors, ensures the integrity and continuity of output image data, and effectively removes noise, corrects and standardizes processing to improve the consistency of output image data.

[0027] 4. The present invention has enhanced scalability and flexible design. It can dynamically adjust grid division parameters and the number of computing nodes according to data scale and processing requirements, and has strong adaptability. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. 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 creative work.

[0029] Figure 1 It is the technical roadmap of the grid-based raster image distributed preprocessing method of the present invention. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments 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 creative work are within the scope of protection of the present invention.

[0031] like Figure 1 As shown in the figure, a grid-based distributed preprocessing method for raster images is shown in the figure. The specific steps are as follows:

[0032] S1. Extract the geographic coordinate range of the original raster image and convert the geographic coordinate system into the target coordinate system.

[0033] Extract the geographic coordinate range from the input original raster image, use the metadata of the original raster image, extract the boundary coordinates (north boundary, south boundary, east boundary, west boundary) of the original raster image, expressed as (N_min, N_max, E_min, E_max), these coordinates are obtained through the geographic reference information (GeoTransform) and projection information (Projection) of the original raster image, and provide basic data for subsequent grid division. For a GeoTIFF image file, use the GetGeoTransform() and GetProjection() methods in the GDAL (Geospatial DataAbstraction Library) library to extract the boundary coordinates and coordinate system.

[0034] Convert the geographic coordinate system of the original raster image to the target coordinate system, such as the Web Mercator projection (EPSG:3857). This conversion is performed through an affine transformation matrix to ensure that all original raster image data is processed in a unified coordinate system. Use the Warp() function of GDAL for projection conversion. The parameters include the source coordinate system and the target coordinate system. The formula is as follows:

[0035] (x′,y′)=T(x,y) (1)

[0036] Where (x, y) is the original coordinate, (x′, y′) is the transformed coordinate, and T is the transformation matrix.

[0037] S2. Generate grid configuration parameters according to the extracted geographic coordinate range and the predetermined grid size.

[0038] After completing step S1, the grid configuration parameters covering the entire original raster image are generated according to the extracted geographic coordinate range and the predetermined grid size (such as 256x256 pixels), the size, position and unique identifier of each grid cell are defined, and the number of grid cells is calculated using the following formula:

[0039]

[0040] Among them, n x and n y are the number of grid cells in the horizontal and vertical directions of the original raster image, tile_width is the grid cell width, tile_height is the grid cell height, and E max is the coordinate of the southern boundary of the original raster image, E min is the northern boundary coordinate of the original raster image, N max is the western boundary coordinate of the original raster image, N min It is the eastern boundary coordinate of the original raster image.

[0041] S3. Using the generated grid configuration parameters, the original raster image is cropped according to the range of each grid unit, and the image portion corresponding to each grid unit is extracted to obtain a grid image.

[0042] Use GDAL's ReadAsArray() method to read according to the pixel coordinate range of the grid unit. The steps are as follows:

[0043] x offset =i*tile_width (4)

[0044] y offset =j*tile_height (5)

[0045] Then read from (x offset ,y offset ) to (x offset +tile_width,y offset +tile_height) image data. offset is the starting x coordinate of the grid, y offset is the starting y coordinate of the grid, tile_width is the grid unit width, tile_height is the grid unit height, i is the row number of the grid, and j is the column number of the grid.

[0046] S4. Construct a grid task model, a grid image preprocessing executor, a grid task manager and a grid distributed task scheduler. The grid distributed task scheduler receives all grid images cropped based on the grid as parameters and schedules and configures the grid task manager. The grid task model assembles input parameters formed by dividing the original raster image into grids based on the grid task model and passes them to the grid image preprocessing executor managed by the grid task manager. The grid image preprocessing executor completes the grid image preprocessing process.

[0047] S4.1. Build a grid task model, assemble input parameters according to the grid task model and pass the input parameters to the grid image preprocessing executor RasterPreprocessingExecutor.

[0048] Based on the grid divided in step S2 and the grid image obtained by grid clipping in step S3, a grid task model is constructed. The grid task model GridTaskModel includes the attributes of task ID, grid coordinate object gridCoordinates, grid image input path inputPath, grid image output path outputPath, and processing parameter object parameters. The grid coordinate object gridCoordinates includes the grid starting x coordinate x_offset, the grid starting y coordinate y_offset, the grid cell width width, and the grid cell height height. The processing parameter object parameters includes geographic correction geoCorrection and atmospheric correction atmosphericCorrection.

[0049] S4.2. Build the grid image preprocessing executor RasterPreprocessingExecutor to complete the grid image preprocessing process.

[0050] First, initialize the grid image preprocessing executor RasterPreprocessingExecutor class, pass the grid task model and grid parameters to it, and define four image preprocessing classes, namely, GeometricCorrection, Fusion, Mosaicking, and AtmosphericCorrection. During the execution process, the grid image data is imported through the GDAL library, and then the apply methods of GeometricCorrection.apply(dataset,params), Fusion.apply(dataset,params), Mosaicking.apply(datasets,params), and AtmosphericCorrection.apply(dataset,params) are called in sequence to perform geometric correction, fusion, mosaicking, and atmospheric correction. Each class uses the input parameters passed in by the grid task model to complete the corresponding processing operation, and finally saves the processed grid image to the specified path through the RasterPreprocessingExecutor.save(data,output_path) method, thus realizing the grid image preprocessing process.

[0051] Among them, dataset is a cropped single grid image dataset opened by gdal.Open(input_filepath), params is a dictionary containing the parameters required for geometric correction, including the target coordinate system dstSRS, the coordinate system srcSRS of the original raster image, and the ground control points GCPs. data is a grid image dataset opened by gdal.Open(input_filepath), and after preprocessing, it is still stored in the dataset variable, and output_path is the string 'output_image.tif', which specifies the target file path for saving the preprocessed grid image.

[0052] S4.3. Construct a grid task manager GridTaskManager to initialize the grid image preprocessing executor and manage the status of the grid image preprocessing executor.

[0053] Construct the grid task manager GridTaskManager to initialize the grid image preprocessing executor RasterPreprocessingExecutor and manage the state of the grid image preprocessing executor. It can start, stop, and destroy the grid image preprocessing executor, and report the state to the grid distributed task scheduler. The specific implementation method is as follows: in the grid task manager GridTaskManager class, initialize the grid distributed task scheduler through the __init__(self,taskScheduler) method, and create a dictionary to store the state of the grid image preprocessing executor; use the startExecutor(self,task,grid) function to start a new grid image preprocessing executor RasterPreprocessingExecutor instance, and call its execute() method to execute the task; use the stopExecutor(self,executorID) function to stop the running grid image preprocessing executor; use the destroyExecutor(self,executorID) function to destroy the grid image preprocessing executor instance; update the grid image preprocessing executor state through the updateStatus(self,executorID,status) function, and report to the grid distributed task scheduler.

[0054] S4.4. Build a grid distributed task scheduler. The grid distributed task scheduler is the core of distributed processing. It receives all grid images cropped based on the grid as parameters. It can be configured to start multiple grid task managers, monitor the execution status of all grid task managers, and send control commands to each grid task manager (such as start, pause, stop, and resume). When an error occurs in a grid task manager, a new grid task manager can be started to replace it, and finally the grid image files processed by all grid preprocessors can be obtained.

[0055] First, initialize the grid distributed task scheduler through DistributedTaskScheduler.__init__(self,numManagers,gridTasks), and pass in the number of managers to be started numManagers and the parameter set gridTasks[] of the grid task model component; configure and start the manager, through the DistributedTaskScheduler.startManagers(self) method, create and start the specified number of GridTaskManager instances, and assign grid tasks to each manager; monitor the manager status, through the DistributedTaskScheduler.monitorManagers(self) method, regularly check the execution status of all managers and update the task status , send control commands, such as start, pause, stop and resume, to the specified manager through the DistributedTaskScheduler.sendCommand(self,managerID,command) method; error handling and replacement, monitor the error status of the manager through the DistributedTaskScheduler.handleErrors(self) method. If an error occurs in a manager, start a new manager to replace it; obtain processing results, centrally manage all pre-processed grid image files through the DistributedTaskScheduler.collectResults(self) method to form a grid image file collection gridRasterResults[], and form a complete pre-processed output image through the subsequent grid image stitching process.

[0056] S5. Calculate edge overlap of the preprocessed grid images, crop the overlapping area images, stitch the cropped grid images and publish the complete output image.

[0057] S5.1. Calculate the edge overlap of the preprocessed grid images. The following is a basic algorithm formula for calculating the overlap area of ​​two rectangular preprocessed grid images. Assume that there are two rectangular preprocessed grid images, represented by the coordinates of their lower left corner and upper right corner respectively:

[0058] The coordinates of the lower left corner of the first rectangular preprocessed grid image are: (x1 min , y1 min ), the coordinate of the upper right corner is (x1 max , y1 max ).

[0059] The coordinates of the lower left corner of the second rectangular preprocessed grid image are: (x2 min , y2 min ), the coordinate of the upper right corner is (x2 max , y2 max ).

[0060] Calculate the lower left corner coordinates of the overlapping area of ​​two rectangular preprocessed grid images:

[0061] x min =max(x1 min ,x2 min ) (6)

[0062] y min =max(y1 min ,y2 min ) (7)

[0063] Calculate the coordinates of the upper right corner of the overlapping area of ​​two rectangular preprocessed grid images:

[0064] x max =min(x1 max ,x2 max ) (8)

[0065] y max =min(y1 max ,y2 max ) (9)

[0066] Calculate the overlap area overlap_area of ​​two rectangular preprocessed grid images:

[0067] overlap_area=(x max -x min )*(y max -y min ) (10)

[0068] S5.2. Crop the overlapping area images. Open the input preprocessed grid image file through gdal.Open(input_filepath), and use the gdal.Translate(output_filepath,dataset,projWin=[ulx,uly,lrx,lry]) function to crop the overlapping area images according to the specified four-dimensional coordinates, and save the cropped grid images to the output_filepath path.

[0069] S5.3. After stitching the cropped grid image, use the gdal.BuildVRT('temporary.vrt',input_files) function to create a virtual image file VRT from the cropped grid image file list, and then use the gdal.Translate(output_filepath,vrt) function to convert the VRT into an actual stitched image file and save it to the output_filepath path.

[0070] The present invention mainly aims at improving the processing efficiency of a single large raster image, improving accuracy and consistency, and enhancing scalability.

[0071] In terms of processing efficiency, the present invention accurately divides the original raster image into equally spaced grid units through a preset coordinate system, crops the image based on the grid units, and distributes the grid image to different servers for preprocessing through distributed task scheduling, thereby improving processing efficiency.

[0072] In terms of improving accuracy and consistency, the present invention considers the boundary processing of grid cells when dividing, ensures seamless splicing between grid images, avoids overlaps and gaps, improves the overall continuity and integrity of the output image, introduces a buffer mechanism, and expands the boundary cells to ensure that the boundary data will not be lost or distorted in subsequent analysis and application.

[0073] In terms of enhancing scalability, we designed the grid distributed task scheduler DistributedTaskScheduler and the grid image preprocessing executor RasterPreprocessingExecutor, and deployed the executor Actuator in the newly added nodes. Through configuration, they can be automatically registered with the scheduler without redesign, which increases flexibility.

[0074] 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 principle of the present invention should be included in the protection scope of the present invention.

Claims

1. A grid-based distributed preprocessing method for raster images, characterized in that: The steps include: S1, extract the geographic coordinate range of the original raster image, and convert the geographic coordinate system into the target coordinate system; S2. generating grid configuration parameters according to the extracted geographic coordinate range and the predetermined grid size; S3, using the generated grid configuration parameters, clipping the original grid image according to the range of each grid unit, extracting the image portion corresponding to each grid unit, and obtaining a grid image; S4, constructing a grid task model, a grid image preprocessing executor, a grid task manager and a grid distributed task scheduler, wherein the grid distributed task scheduler receives all grid images clipped based on the grid as parameters and schedules and configures the grid task manager, and the grid task model assembles input parameters formed after the original raster image is divided into grids based on the grid task model and transmits them to the grid image preprocessing executor managed by the grid task manager, and the grid image preprocessing executor completes the preprocessing process of the grid image; S5. Calculate edge overlap of the preprocessed grid images, crop the overlapping area images, stitch the cropped grid images and publish the complete output image.

2. The grid-based raster image distributed preprocessing method according to claim 1, characterized in that: The grid task model includes a task ID, a grid coordinate object, a grid image input path, a grid image output path, and a processing parameter object; wherein the grid coordinate object includes a grid starting x coordinate, a grid starting y coordinate, a grid cell width, and a grid cell height, and the processing parameter object includes geographic correction and atmospheric correction.

3. The grid-based raster image distributed preprocessing method according to claim 2, characterized in that: The grid image preprocessing executor includes four image preprocessing classes, namely, geometric correction class, fusion class, mosaic class and atmospheric correction class.

4. The grid-based raster image distributed preprocessing method according to claim 3, characterized in that: The grid task manager uses the startExecutor(self,task,grid) function to start a new grid image preprocessing executor instance; the grid task manager uses the stopExecutor(self,executorID) function to stop the running grid image preprocessing executor; the grid task manager uses the destroyExecutor(self,executorID) function to destroy the grid image preprocessing executor instance; the grid task manager updates the grid image preprocessing executor status through the updateStatus(self,executorID,status) function.

5. The grid-based raster image distributed preprocessing method according to claim 4, characterized in that: The grid distributed task scheduler periodically checks the execution status of all grid task managers and updates the task status through the DistributedTaskScheduler.monitorManagers(self) method, sends a control command to the specified grid task manager through the DistributedTaskScheduler.sendCommand(self, managerID, command) method, monitors the error status of the grid task manager through the DistributedTaskScheduler.handleErrors(self) method, and if an error occurs in a grid task manager, starts a new grid task manager to replace it; the grid distributed task scheduler centrally manages all pre-processed grid image files through the DistributedTaskScheduler.collectResults(self) method to form a grid image file collection.

6. The grid-based raster image distributed preprocessing method according to claim 1 or 5, characterized in that: The grid configuration parameters include the number of grid cells, the size, position and unique identifier of each grid cell, and the number of horizontal grid cells of the original raster image. The number of vertical grid cells in the original raster image Among them, tile_width is the grid unit width, tile_height is the grid unit height, E max is the coordinate of the southern boundary of the original raster image, E min is the northern boundary coordinate of the original raster image, N max is the western boundary coordinate of the original raster image, N min It is the eastern boundary coordinate of the original raster image.

7. The grid-based raster image distributed preprocessing method according to claim 6, characterized in that: The method for extracting the image portion corresponding to each grid unit is as follows: first use the ReadAsArray() method in the GDAL library to read according to the pixel coordinate range of the grid unit: xoffset = i*tile_width, yoffset = j*tile_height, and then read the image data from (xoffset, yoffset) to (xoffset+tile_width, yoffset+tile_height); where xoffset is the starting x coordinate of the grid, y offset is the starting y coordinate of the grid, tile_width is the grid unit width, tile_height is the grid unit height, i is the row number of the grid, and j is the column number of the grid.

8. The grid-based raster image distributed preprocessing method according to claim 7, characterized in that: The method for edge overlap calculation in step S5 is: Assume that the coordinates of the lower left corner of the grid image after the first rectangular preprocessing are (x1 min ,y1 min ), the coordinates of the upper right corner are (x1 max ,y1 max ); The coordinate of the lower left corner of the grid image after the second rectangle preprocessing is (x2 min , y2 min ), the coordinates of the upper right corner are (x2 max , y2 max ); then the lower left corner coordinate of the overlapping area of ​​the two rectangular preprocessed grid images is x min =max(x1 min ,x2 min ), y min =max(y1 min ,y2 min ), calculate the coordinate of the upper right corner of the overlapping area of ​​the two rectangular preprocessed grid images as x max =min(x1 max ,x2 max ), y max =min(y1 max ,y2 max ), so the area of ​​the overlapped area of ​​the two rectangular preprocessed grid images is overlap_area = (x max -x min )*(y max -y min ).

9. The grid-based raster image distributed preprocessing method according to claim 1 or 8, characterized in that: The method for cropping the overlapping area image in step S5 is: opening the input preprocessed grid image file, and using the gdal.Translate(output_filepath, dataset, projWin = [ulx, uly, lrx, lry]) function to crop the overlapping area image according to the specified four-dimensional coordinates, and saving the cropped grid image.

10. The grid-based raster image distributed preprocessing method according to claim 9, characterized in that: The method for stitching the cropped grid image in step S5 is: using the gdal.BuildVRT('temporary.vrt',input_files) function to create a virtual image file from the cropped grid image file list, and then using the gdal.Translate(output_filepath,vrt) function to convert the virtual image file into an actual stitched image file and save it.

Citation Information

Cited By

  • Method, system and equipment for automatically cutting large-scale grid image

    CN121962527A

  • Large-scale grid image automatic cutting method, system and device

    CN121962527B