Single image slicing method and related device
By using the decoupling method of I/O threads, data processing thread groups and encoding thread groups in single-frame super-large image slice processing, the problems of low data reading efficiency and redundancy are solved, and the CPU utilization and slice performance are improved .
Patent Information
- Application Number
- CN202411582906.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-02-18
AI Technical Summary
When performing slicing of single super-large images, the prior art has problems such as low data reading efficiency and redundancy in data reading, resulting in low CPU utilization and unsatisfactory slice performance.
Through I/O threads, multiple data reading operations are performed on the target single image to obtain multiple data groups; while reading data, the data group is processed according to the target tile segmentation grid through the data processing thread group. , generate multiple tiles; and tile fusion and conversion are generated through the encoding thread group to generate multiple tiles files.
By decoupling I/O threads, data processing thread groups and encoding thread groups, data reading efficiency is improved, redundant reading is reduced, and CPU utilization and slicing performance of single super-large image files are improved.
Smart Images

Figure CN119484845A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of image slicing, and in particular to a single image slicing method and related devices. Background Art
[0002] A single image contains all the information of a picture or image and is an independent and complete image file. A single super-large image is an image file with a width dimension greater than 100,000 pixels or a height dimension greater than 100,000 pixels.
[0003] Currently, single-machine multi-threading, multi-machine multi-threading or distributed slicing methods can be used to slice a single large image. However, no matter which of the above processing methods is used, it is limited by the disk I / O characteristics and the random distribution of slices of each thread, and there are problems such as low data reading efficiency and data reading redundancy, which in turn leads to low CPU utilization and unsatisfactory single large image slicing performance.
[0004] Therefore, how to solve the problems of low data reading efficiency and data reading redundancy, improve CPU utilization efficiency, and improve the slicing performance of single large image files has become one of the technical problems to be solved urgently in the field of image processing technology. Summary of the invention
[0005] Based on the above problems, the present application provides a single image slicing method to solve the problems of low data reading efficiency and data reading redundancy, improve CPU utilization efficiency, and improve the slicing performance of a single large image file.
[0006] The embodiments of the present application disclose the following technical solutions:
[0007] The present application discloses a single image slicing method, comprising:
[0008] Performing multiple data reading operations on a single target image through an I / O thread to obtain multiple data groups; each data reading operation obtains one data group;
[0009] While performing a data reading operation on the target single image through the I / O thread, a data processing operation is performed on the acquired data group according to the target tile subdivision grid through the data processing thread group to generate a plurality of tiles; the size of each tile is consistent with the size of a grid in the target tile subdivision grid;
[0010] While the data processing thread group performs data processing operations on the acquired data group according to the target tile subdivision grid, the encoding thread group performs fusion conversion operations on the multiple tiles that have been generated to generate multiple tile files.
[0011] In an optional implementation, the size of the target single image is P pixels × Q pixels; the size of the tile is M pixels × M pixels; P, Q and M are all integers greater than 1; P is greater than M; each of the data groups is composed of data corresponding to an image block; and the size of the image block is M pixels × Q pixels.
[0012] In an optional implementation, the target tile subdivision grid is a subdivision grid of the 16th level of the global subdivision.
[0013] In an optional implementation, if it is determined that the image coordinate system of the target single image is inconsistent with the coordinate system of the target tile subdivision grid, the data processing operation includes an image rendering operation, a projection conversion operation, and an interpolation scaling operation.
[0014] In an optional implementation, if it is determined that the image coordinate system of the target single image is consistent with the coordinate system of the target tile subdivision grid, the data processing operation includes an image rendering operation.
[0015] In an optional implementation, the performing a fusion conversion operation on the plurality of tiles that have been generated by the encoding thread group to generate a plurality of tile files includes:
[0016] By using the encoding thread group, bitmap fusion is performed on a plurality of tiles having the same row and column numbers that have been generated to generate a plurality of target tiles; no overlapping area exists between any two of the target tiles;
[0017] While the encoding thread group performs bitmap fusion on the multiple tiles that have been generated, the output thread group converts the multiple target tiles that have been generated into multiple tile files; the format of the tile files is WEP, PNG or JPG format.
[0018] In an optional implementation, the method further includes:
[0019] Using multiple tile files generated based on the target tile grid as the first reference target tile;
[0020] Generate a second reference target tile corresponding to the 15th level of global subdivision through the first reference target tile;
[0021] The third reference target tile corresponding to the 14th level of global subdivision is generated through the second reference target tile; and so on, until the reference tile corresponding to the 1st level of global subdivision is generated.
[0022] A second aspect of the present application provides a single image slicing device, the device comprising:
[0023] A data reading module is used to perform multiple data reading operations on a single target image through an I / O thread to obtain multiple data groups; each reading operation obtains one data group;
[0024] A data processing module, configured to perform data processing operations on the obtained data group according to the target tile subdivision grid through the data processing thread group while performing data reading operations on the target single image through the I / O thread to generate multiple tiles; the size of each tile is consistent with the size of the grid in the target tile subdivision grid;
[0025] The data encoding module is used to perform data processing operations on the acquired data group according to the target tile subdivision grid through the data processing thread group, and at the same time, perform fusion conversion operations on the multiple tiles that have been generated through the encoding thread group to generate multiple tile files.
[0026] A third aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the method introduced in any implementation manner of the first aspect.
[0027] A fourth aspect of the present application provides an electronic device, including:
[0028] a memory having a computer program stored thereon;
[0029] A processor is used to execute the computer program in the memory to implement the steps of the method introduced in any implementation manner of the first aspect.
[0030] Compared with the prior art, this application has the following beneficial effects:
[0031] The present application discloses a single image slicing method, comprising: performing multiple data reading operations on a target single image through an I / O thread to obtain multiple data groups; while performing data reading operations on the target single image through the I / O thread, performing data processing operations on the obtained data group according to a target tile subdivision grid through a data processing thread group to generate multiple tiles; while performing data processing operations on the obtained data group according to a target tile subdivision grid through the data processing thread group, performing fusion conversion operations on the generated multiple tiles through an encoding thread group to generate multiple tile files.
[0032] In this way, by decoupling the I / O thread, the data processing thread group and the encoding thread group, it is ensured that while the I / O thread performs data reading operations on the target single image to generate a data group, the data processing thread group can perform data processing operations on the already obtained data group to generate multiple tiles; the encoding thread group can perform thread fusion conversion operations on the multiple tiles that have been generated to generate multiple tile files; thereby solving the problems of low data reading efficiency and data reading redundancy in traditional solutions, improving CPU utilization efficiency, and improving the slicing performance of single large image files. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the embodiments of the present application 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 application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0034] Figure 1 A schematic diagram of image scan line storage provided by an embodiment of the present application;
[0035] Figure 2 A schematic diagram of image strip storage provided by an embodiment of the present application;
[0036] Figure 3 A schematic diagram of image block storage provided in an embodiment of the present application;
[0037] Figure 4 A schematic diagram of random distribution of tiles provided in an embodiment of the present application;
[0038] Figure 5 A flow chart of a single image slicing method provided in an embodiment of the present application;
[0039] Figure 6 A schematic diagram of an I / O thread reading data in batches provided in an embodiment of the present application;
[0040] Figure 7 A schematic diagram of the relationship between a target single image and a target tile subdivision grid provided in an embodiment of the present application;
[0041] Figure 8 A schematic diagram of another relationship between a single target image and a target tile subdivision grid provided in an embodiment of the present application;
[0042] Fig. 9 A schematic diagram of performing projection conversion on the nth batch of image data provided in an embodiment of the present application;
[0043] Fig.10 A schematic diagram of scaling an image provided by an embodiment of the present application;
[0044] Fig.11 A schematic diagram of segmenting a rendered image provided in an embodiment of the present application;
[0045] Fig.12 A schematic diagram of bitmap fusion of multiple tiles provided in an embodiment of the present application;
[0046] Fig.13 A schematic diagram of merging tiles based on a pyramid algorithm provided in an embodiment of the present application;
[0047] Fig.14 A schematic structural diagram of a single image slicing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0048] Currently, three methods are usually used to store single images: scan line storage, strip storage and block storage. The reading methods of single images are also different under different storage methods.
[0049] Scan line storage is to store images by line (scan line). Usually, images are compressed and encoded. For the images stored by scan line, each line of pixel data is compressed and encoded separately. Therefore, when reading the image data stored by scan line, even if only part of the continuous pixel data in a line of pixel data is needed, the whole line of data must be read; and then the required part of the continuous pixel data is obtained from the whole line of data.
[0050] Figure 1 A schematic diagram of image scan line storage provided in an embodiment of the present application. Figure 1 The 1, 2, 3, 64, 8W and 10W data in the image are the codes corresponding to each pixel in the image. Figure 1 The three consecutive pixel data with codes 1, 2, and 3 in the first row of the image need to be read Figure 1 All pixel data of the first row of the image are obtained, and then the required three consecutive pixel data with codes 1, 2 and 3 are obtained from all the pixel data of the first row read.
[0051] Strip storage means storing image data according to a specified strip width, such as N scan lines, and image compression encoding will also be processed according to strips. When reading image strip storage data, even if only part of the continuous pixel data in the strip is needed, the entire strip data must be read; then the required part of the continuous pixel data is obtained from the entire strip data.
[0052] Figure 2A schematic diagram of image strip storage provided in an embodiment of the present application. Figure 2 The data 1, 2, 3, 64, 8W and 10W in the image are the codes corresponding to each pixel in the image. Figure 2 The three consecutive pixel data with codes 1, 2, and 3 in the first row of the image need to be read Figure 2 The middle strip, that is, all pixel data in N scan lines; and then the required three consecutive pixel data with codes 1, 2 and 3 are obtained from the read strip.
[0053] Block storage is to store images in blocks of specified size, such as 64 pixels × 64 pixels. Image compression coding will also be processed by blocks. When reading the data stored in the affected block, even if only part of the continuous pixel data in the block needs to be read, the entire block data must be read; then the required part of the continuous pixel data is obtained from the block data.
[0054] Figure 3 A schematic diagram of image block storage provided in an embodiment of the present application. Figure 3 The data such as 1, 2, 3, 64, 8W and 10W are the codes corresponding to each pixel in the image. Figure 3 The block size corresponding to the medium block storage is 64 pixels × 64 pixels. Figure 3 The three consecutive pixel data with codes 1, 2, and 3 in the first row of the image need to be read Figure 3 The data in the corresponding block in the read block is obtained; and then the three consecutive pixel data with the required encoding 1, encoding 2 and encoding 3 are obtained from the read block.
[0055] Since the tiles of the slicing threads are randomly distributed regardless of single-machine multi-threading, multi-machine multi-threading or distributed slicing methods, the current image storage method and reading characteristics limit the performance of image slicing processing in traditional solutions.
[0056] Figure 4 A schematic diagram of random distribution of tiles provided in an embodiment of the present application. Figure 4 As shown in Figure 1, process A tiles, process B tiles, and process C tiles are randomly distributed, and there are cases where multiple processes read the same scan line, strip, or block of the image at the same time. For example, when process A tiles obtain the image data required for slicing, that is, Figure 4 The process C tile also sends a request to read the data in the same area. According to the disk I / O characteristics, the process C tile has to wait in line. After the process A tile completes data reading and data processing, the process C tile will read Figure 4The data in the red dotted box results in low efficiency in tile data acquisition and tile slicing in process C, which affects the slicing efficiency.
[0057] At the same time, when process A tile obtains the image data required for slicing ( Figure 4 When the image data is the data stored in the scan line, in the image file reading stage, all the scan lines covered by the red dashed box should be read, and the data required by the process A tile should be obtained from the read data, and this part of the data should be output to the tile; Figure 4 In the process C tile, it is necessary to repeatedly read the tile read by process A. Figure 4 The data in the red dotted box in the , and then obtain the data required by the process C tile from the read data, and output this part of the data to the tile. This leads to the problem of data reading redundancy and low data utilization.
[0058] In summary, when slicing images, due to the limitations of existing image storage and reading technologies, whether a single-machine multi-threading, multi-machine multi-threading or distributed slicing method is used to slice a single large image, the following problems exist in practical applications:
[0059] First, when multiple processes read the same image file at the same time, the other processes need to wait when the image file is occupied by one of the processes. In the processing of a single large image file, the existence of this problem increases the waiting time and reduces the data acquisition rate.
[0060] Second, the slices of each process are randomly distributed, and the data covered by tiles of different processes may be located in the same scan line, strip, or block of the image. When these processes are executed, the same data content will be repeatedly read, resulting in data reading redundancy.
[0061] The existence of the above problems leads to low CPU utilization and unsatisfactory image slicing performance in the existing process of slicing a single large image.
[0062] Based on the above problems, the present application discloses a single image slicing method, including: performing multiple data reading operations on a target single image through an I / O thread to obtain multiple data groups; while performing data reading operations on the target single image through the I / O thread, performing data processing operations on the obtained data group according to a target tile subdivision grid through a data processing thread group to generate multiple tiles; while performing data processing operations on the obtained data group according to a target tile subdivision grid through the data processing thread group, performing fusion conversion operations on the generated multiple tiles through an encoding thread group to generate multiple tile files. In this way, by decoupling the I / O thread, the data processing thread group and the encoding thread group, it is ensured that while the I / O thread performs data reading operations on the target single image to generate a data group, the data processing thread group can perform data processing operations on the already obtained data group to generate multiple tiles; the encoding thread group can perform thread fusion conversion operations on the multiple tiles that have been generated to generate multiple tile files; thereby solving the problems of low data reading efficiency and data reading redundancy in traditional solutions, improving CPU utilization efficiency, and improving the slicing performance of single large image files.
[0063] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0064] Figure 5 A flowchart of a single image slicing method provided in an embodiment of the present application. Figure 5 As shown, the single image slicing method disclosed in the present application comprises:
[0065] S501, performing multiple data reading operations on a target single image through an I / O thread to obtain multiple data groups.
[0066] The target single image in this application is a single large image that needs to be sliced. The single large image in this application can be a remote sensing image.
[0067] In this application, an independent I / O thread is used to sequentially read the target single image. In this application, the size of the target single image is P pixels × Q pixels; the size of the preset tile is M pixels × M pixels, where P, Q and M are all integers greater than 1, and P and Q are both greater than M. For example, M can be 256; P can be 8W; Q can be 10W.
[0068] In the present application, a data reading operation (hereinafter referred to as a reading operation) obtains a data group. Each data group is composed of data corresponding to an image block, and the size of the image block is M pixels×Q pixels.
[0069] Combine the following Figure 6 , the content of S501 in this application is introduced again. Figure 6 A schematic diagram of an I / O thread reading data in batches provided in an embodiment of the present application. One read operation obtains data of a data group. Figure 6 As shown, the first data reading operation obtains the first batch of read data, the second data reading operation obtains the second batch of read data, and the nth data reading operation obtains the nth batch of read data. Figure 6 The default tile height is 256 rows of pixels. Figure 6 The data obtained from a data reading operation covers all pixel columns of the target single image and vertically covers pixel rows equal to the tile height, that is, 256 rows of pixels. In this way, multiple data groups can be obtained.
[0070] S502, while performing a data reading operation on the target single image through the I / O thread, a data processing thread group performs a data processing operation on the acquired data group according to a target tile subdivision grid to generate a plurality of tiles.
[0071] It should be emphasized that in the present application, the data reading operation is performed on the target single image through the I / O thread to generate a data group; two operations are performed simultaneously. The first operation is to assign the generated data group to the dynamic task allocator, and the dynamic task allocator assigns the read data group to the data processing thread group, and the data processing thread group processes the data group; the other operation performed simultaneously is to continue to perform data reading operations on the images that have not been read in the target single image through the I / O thread to generate a new data group.
[0072] In this application, the data processing thread group performs data processing operations on the obtained data group, specifically, the data processing thread group performs data processing operations on the obtained data group according to the target tile grid division to generate multiple tiles. Each tile has information such as row and column numbers.
[0073] To facilitate understanding of the above process, this application takes the data read in the nth batch as an example to explain the process in detail.
[0074] The size of each tile in this application is consistent with the size of the grid in the target tile subdivision grid. In this application, the subdivision grid of the 16th level of the global subdivision is used as the target tile subdivision grid. Among them, the scale of the 16th level of the global subdivision is 1:4513.997733376549; the size of each tile in this application is 256 pixels × 256 pixels.
[0075] Those skilled in the art can calculate the tile grid of the maximum slice scale level according to the slice parameters, such as the slice coordinate system, the slice range, the slice origin, and the slice scale level range; and then use the highest level, that is, the grid with the largest scale, as the target grid in this application. This process is well known to those skilled in the art, and this application does not provide a detailed introduction to the process of calculating the tile grid of the maximum slice scale level based on the slice parameters.
[0076] It is understandable that the target single image has a corresponding image coordinate system, and the target tile subdivision grid has a corresponding grid coordinate system. In actual work, the image coordinate system of the target single image may be consistent with the coordinate system of the target tile subdivision grid, or may be inconsistent.
[0077] Figure 7 A schematic diagram of the relationship between a target single image and a target tile subdivision grid provided in an embodiment of the present application. Figure 7 The figure shows the relative position relationship between the target single image and the target tile subdivision grid when the target single image coordinate system and the target tile subdivision grid coordinate system are consistent. Figure 7 The blue box in the figure represents the tile subdivision grid; Figure 7 The black dashed line in the figure represents a single image of the target. Figure 7 Among them, (a, b), (a, b+i), (a+i, b) and (a+i, b+i) all represent the row number and list of the tile.
[0078] Figure 8 A schematic diagram of the relationship between another target single image and a target tile subdivision grid provided in an embodiment of the present application. Figure 8 The figure shows the relative position relationship between the target single image and the target tile subdivision grid when the target single image coordinate system and the target tile subdivision grid coordinate system are inconsistent. Figure 8 The blue box represents the tile subdivision grid; Figure 8 The black dashed line in the figure represents a single image of the target. Figure 8 Here, (k, j), (k, j+n), (k+n, j) and (k+n, j+n) represent the row number and list of the tile.
[0079] When it is determined that the target single image coordinate system and the target tile grid coordinate system are inconsistent, the data processing thread group performs data processing operations on the acquired data group according to the target tile grid to generate multiple tiles. The data processing operations involved here include image rendering operations, projection conversion operations, and interpolation and scaling operations.
[0080] The rendering operation refers to rendering the image according to the parameters set by the user in the renderer in advance, including but not limited to image style parameters, stretching parameters and contrast.
[0081] The projection conversion operation refers to the operation of converting the coordinate system of a single target image to the coordinate system of a target tile grid, also known as a dynamic projection operation. A schematic diagram of performing projection conversion on the nth batch of image data provided in an embodiment of the present application. Fig. 9 As shown, after the 256 rows of pixel image data read in the nth batch are projected and resampled, the horizontal and vertical spans of the image data will change.
[0082] It is understandable that the scale of the coordinate system of the target single image is not necessarily exactly the same as the scale of the target tile grid; in the case where the two are different, a differential scaling operation is required. The differential scaling operation refers to the operation of using an interpolation algorithm to estimate the value of each pixel in the new size image based on the values of adjacent pixels in the original image.
[0083] Fig.10 A schematic diagram of scaling an image provided in an embodiment of the present application. Fig.10 (a) represents that the nth batch of data is read and the image is enlarged to ensure that the scale of the enlarged image is equal to the scale of the target tile subdivision grid. Fig.10 (b) represents that the data read in the nth batch is reduced in size to ensure that the scale of the reduced image is equal to the scale of the target tile grid. Fig.10 It can be seen that in the process of differential scaling the image to make its scale equal to the scale of the target mesh subdivision grid, the horizontal and vertical spans of the image data will also be changed.
[0084] For images that require dynamic projection, after image rendering, projection conversion, and interpolation scaling operations, the grid will be divided according to the target tile, that is, the tile grid will be divided according to the current maximum scale level, and the tile cutting operation will be performed. Fig.11 A schematic diagram of segmenting a rendered image provided in an embodiment of the present application. Fig.11 Middle (c) represents,a schematic diagram of slicing the image after image magnification and image rendering; Fig.11 (c) and Fig.10 Corresponding to (a). Fig.11 Middle (d) represents,a schematic diagram of slicing the image after image reduction and image rendering; Fig.11 (d) and Fig.10 Corresponding to (b).
[0085] It can be understood that if the target single image coordinate system is consistent with the target tile subdivision grid coordinate system, and there is no need to dynamically render the image, the data processing thread group performs data processing operations on the acquired data group according to the target tile subdivision grid to generate multiple tiles; the data processing operations here include image rendering operations and interpolation scaling operations.
[0086] S503, while performing data processing operations on the acquired data group according to the target tile subdivision grid through the data processing thread group, performing fusion conversion operations on the generated multiple tiles through the encoding thread group to generate multiple tile files.
[0087] It should be emphasized that in this application, data processing operations are performed on the obtained data group according to the target tile subdivision grid through the data processing thread group to generate multiple tiles; two operations are performed at the same time. The first operation is to assign the generated multiple tiles to the dynamic task allocator; the dynamic task allocator is responsible for allocating threads to perform encoding processing on the cut tiles; the other operation performed simultaneously is to continue to perform data processing operations on the obtained data group according to the target tile subdivision grid through the data processing thread group to generate multiple tiles.
[0088] The encoding thread group in this application performs a fusion conversion operation on the multiple tiles that have been generated to generate multiple tile files, which specifically includes the following two steps:
[0089] In the first step, the encoding thread group is used to perform bitmap fusion on multiple tiles that have been generated to generate multiple target tiles.
[0090] Since the data read by different batches of I / O threads are processed by the data processing thread group, that is, after being processed by dynamic projection and rendering operations, the tiles they cover overlap. Therefore, the encoding thread group first needs to process the tiles with the same row and column numbers across batches, perform bitmap fusion on these tiles, and generate multiple target tiles.
[0091] Fig.12 A schematic diagram of bitmap fusion of multiple tiles provided in an embodiment of the present application. Fig.12 As shown, the tiles with the same row and column numbers in the rendered images of the n-1th batch, the rendered images of the nth batch, and the rendered images of the n+1th batch are bitmap fused, that is, the tiles with the same row and column numbers across batches in the red frame are bitmap fused to obtain the target tiles. There is no overlap between any two target tiles in this application.
[0092] In the second step, while the encoding thread group performs bitmap fusion on the multiple tiles with the same row and column numbers, the output thread group converts the multiple target tiles that have been generated into multiple tile files. The format of the tile files is WEP, PNG or JPG format.
[0093] It should be emphasized that in this application, the encoding thread group is used to perform bitmap fusion on the multiple tiles that have been generated to generate the target tile; at the same time, the output thread group is used to convert the multiple target tiles that have been generated into tile files of a specified format, such as WEP tile files, PNG tile files or JPG tile files.
[0094] It should be noted that the present application does not limit the specific number of threads included in the encoding thread group, the data processing thread group and the output thread group. The number of threads in each thread group may be one or more.
[0095] It should be emphasized that in the present application, the output thread group can set the tile storage to a preset size, such as the output thread group is responsible for outputting a tile file of 256 pixels×256 pixels according to the tile storage setting.
[0096] From the introduction of the aforementioned embodiments, it can be seen that by decoupling the I / O thread, the data processing thread group and the encoding thread group from each other, it is ensured that while the I / O thread performs a data reading operation on the target single image to generate a data group, the data processing thread group can perform a data processing operation on the acquired data group to generate multiple tiles; the encoding thread group can perform a thread fusion conversion operation on the multiple tiles that have been generated to generate multiple tile files; thereby solving the problems of low data reading efficiency and data reading redundancy in the traditional solution, improving CPU utilization efficiency, and improving the slicing performance of a single large image file.
[0097] Through the introduction of the above embodiments, it can be known that in this application, after performing multiple data reading operations on the target single image through the I / O thread to obtain multiple data groups, the generated data group is immediately transmitted to the dynamic tasker, and the corresponding data processing thread group is assigned to the data group through the dynamic tasker; after performing data processing operations on the obtained data group to generate multiple tiles through the data processing thread group, the generated multiple tiles are immediately transmitted to the dynamic tasker, and the corresponding encoding thread group is assigned to the multiple tiles through the dynamic tasker; after performing fusion conversion operations on the generated multiple tiles through the encoding thread group to generate multiple target tiles, the generated multiple target tiles are immediately transmitted to the dynamic tasker, and the corresponding output thread group is assigned to the multiple tiles through the dynamic tasker. That is, in this application, a dynamic task allocation mechanism is introduced in the data processing, encoding and output stages to continuously maintain the high load state of the CPU and make full use of CPU resources.
[0098] Through the single image slicing method described in the above embodiment, multiple tile files corresponding to the target tile subdivision grid can be obtained. The target tile subdivision grid in this application is a tile subdivision grid of the maximum slicing scale level. For example, the target tile subdivision grid in this application is a subdivision grid of the 16th level of global subdivision (scale of 1:4513.997733376549).
[0099] In an optional implementation, after obtaining a plurality of target tiles corresponding to the 16th level of the global subdivision grid, target tiles of other levels may be generated based on a pyramid generation technique.
[0100] Take multiple target tiles corresponding to the subdivision grid of the 16th level of global subdivision as the first reference target tile, and generate the second reference target tile corresponding to the 15th level of global subdivision through the first reference target tile; generate the third reference target tile corresponding to the 14th level of global subdivision through the second reference target tile; and so on, until the reference target tile corresponding to the 1st level of global subdivision is generated.
[0101] Fig.13 A schematic diagram of merging tiles based on a pyramid algorithm provided in an embodiment of the present application. Fig.13 As shown in the figure, the maximum level scale is 1:4513.997733376549 (the 16th level of the global subdivision grid). When generating tiles with a scale of 1:9027.995466753098 (the 15th level of the global subdivision grid), the above-mentioned process of reading image data, processing data and outputting tiles will no longer be performed. Instead, based on the idea of the pyramid algorithm, based on the 16-level target tiles, the bilinear interpolation algorithm combined with the transparent weight is used to merge the tiles; when the 15-level target tiles are generated, the target tiles with a scale of 1:18055.990933506197 (the 14th level of the global subdivision) are generated based on the same algorithm, and so on, and the target tiles of other levels are generated layer by layer until the minimum level.
[0102] Based on the pyramid generation technology, after generating target tiles of other levels according to the first reference target tile (multiple tiles corresponding to the 16th level of the global subdivision grid), a multi-process approach is used in the tile merging stage, that is, the total task is split into multiple subtasks, and the subtasks are assigned to multiple processes for independent and parallel operation.
[0103] In this way, only the target tiles of the largest level, that is, only the target tiles corresponding to the 16th level of the global subdivision need to execute the operations in S501-S503. For other levels, such as the 15th level of the global subdivision, it is only necessary to generate the target tiles of the corresponding levels based on the existing target tiles. There is no need to execute the operations in S501-S503, which greatly improves the generation efficiency of tiles of other levels.
[0104] In summary, the present invention provides a high-performance slicing method for a single large image, which effectively solves the problem of low CPU utilization caused by data acquisition bottleneck, thereby limiting slicing efficiency. It also combines dynamic task allocation technology to continuously maintain a high CPU load state. In addition, it adopts the pyramid algorithm idea to efficiently synthesize tiles of other levels. The effective combination of the three greatly improves the slicing efficiency.
[0105] Based on the single image slicing method provided in the above-mentioned embodiment, the present application also discloses a single image slicing device. Fig.14 A schematic diagram of the structure of a single image slicing device provided in an embodiment of the present application. Fig.14 As shown, the single image slicing device 1400 disclosed in the present application includes:
[0106] The data reading module 1401 is used to perform multiple data reading operations on a single target image through an I / O thread to obtain multiple data groups; each reading operation obtains one data group;
[0107] The data processing module 1402 is used to perform data processing operations on the obtained data group according to the target tile subdivision grid through the data processing thread group while performing data reading operations on the target single image through the I / O thread to generate multiple tiles; the size of each tile is consistent with the size of the grid in the target tile subdivision grid;
[0108] The data encoding module 1403 is used to perform data processing operations on the acquired data group according to the target tile subdivision grid through the data processing thread group, and perform fusion conversion operations on the generated multiple tiles through the encoding thread group to generate multiple tile files.
[0109] In an optional implementation, the data encoding module 1403 includes:
[0110] A bitmap fusion unit, used for performing bitmap fusion on the plurality of tiles that have been generated through the encoding thread group to generate a plurality of target tiles; no overlapping area exists between any two of the target tiles;
[0111] The tile output unit is used to convert the generated multiple target tiles into multiple tile files through the output thread group while performing bitmap fusion on the generated multiple tiles through the encoding thread group; the format of the tile files is WEP, PNG or JPG format.
[0112] In an optional implementation, the single image slicing device 1400 disclosed in the present application further includes:
[0113] A first reference target tile determination module, configured to use a plurality of tile files generated based on the target tile subdivision grid as first reference target tiles;
[0114] A second reference target tile determination module, configured to generate a second reference target tile corresponding to the 15th level of global subdivision by using the first reference target tile;
[0115] The third reference target tile determination module is used to generate a third reference target tile corresponding to the 14th level of global subdivision using the second reference target tile; and so on, until a reference tile corresponding to the 1st level of global subdivision is generated.
[0116] Based on the single image slicing method and device provided in the aforementioned embodiments, the present application also provides a computer-readable storage medium, on which a computer program is stored, which, when executed by a processor, implements some or all of the steps in the single image slicing method mentioned above.
[0117] Based on the single image slicing method and device provided in the above embodiments, the present application further provides an electronic device, including:
[0118] a memory having a computer program stored thereon;
[0119] A processor is used to execute the computer program in the memory to implement part or all of the steps in the single image slicing method provided in the above embodiment.
[0120] It should be noted that each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is merely schematic, in which the unit described as a separate component may or may not be physically separated, and the component prompted as a unit may or may not be a physical unit, that is, it may be located in one place, or it may be distributed on multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0121] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A single image slicing method, characterized in that: The method comprises: Performing multiple data reading operations on a single target image through an I / O thread to obtain multiple data groups; each data reading operation obtains one data group; While performing a data reading operation on the target single image through the I / O thread, a data processing operation is performed on the acquired data group according to the target tile subdivision grid through the data processing thread group to generate a plurality of tiles; the size of each tile is consistent with the size of a grid in the target tile subdivision grid; While the data processing thread group performs data processing operations on the acquired data group according to the target tile subdivision grid, the encoding thread group performs fusion conversion operations on the multiple tiles that have been generated to generate multiple tile files.
2. The method according to claim 1, characterized in that The size of the target single image is P pixels×Q pixels; the size of the tile is M pixels×M pixels; P, Q and M are all integers greater than 1; P is greater than M; each of the data groups is composed of data corresponding to an image block; the size of the image block is M pixels×Q pixels.
3. The method according to claim 1, characterized in that: The target tile subdivision grid is a subdivision grid of the 16th level of the global subdivision.
4. The method according to any one of claims 1 to 3, characterized in that If it is determined that the image coordinate system of the target single image is inconsistent with the coordinate system of the target tile subdivision grid, the data processing operation includes an image rendering operation, a projection conversion operation and an interpolation scaling operation.
5. The method according to any one of claims 1 to 3, characterized in that: If it is determined that the image coordinate system of the target single image is consistent with the coordinate system of the target tile subdivision grid, the data processing operation includes an image rendering operation and an interpolation scaling operation.
6. The method according to claim 1, characterized in that The step of performing a fusion conversion operation on the plurality of tiles that have been generated by the encoding thread group to generate a plurality of tile files includes: By using the encoding thread group, bitmap fusion is performed on a plurality of tiles having the same row and column numbers that have been generated to generate a plurality of target tiles; no overlapping area exists between any two of the target tiles; While the encoding thread group performs bitmap fusion on the multiple tiles that have been generated, the output thread group converts the multiple target tiles that have been generated into multiple tile files; the format of the tile files is WEP, PNG or JPG format.
7. The method according to claim 3, characterized in that The method further comprises: Using a plurality of tile files generated based on the target tile subdivision grid as first reference target tiles; Generate a second reference target tile corresponding to the 15th level of global subdivision through the first reference target tile; The third reference target tile corresponding to the 14th level of global subdivision is generated through the second reference target tile; and so on, until the reference tile corresponding to the 1st level of global subdivision is generated.
8. A single image slicing device, characterized in that: The device comprises: A data reading module is used to perform multiple data reading operations on a single target image through an I / O thread to obtain multiple data groups; each data reading operation obtains one data group; A data processing module, configured to perform data processing operations on the obtained data group according to the target tile subdivision grid through the data processing thread group while performing data reading operations on the target single image through the I / O thread to generate multiple tiles; the size of each tile is consistent with the size of the grid in the target tile subdivision grid; The data encoding module is used to perform data processing operations on the acquired data group according to the target tile subdivision grid through the data processing thread group, and at the same time, perform fusion conversion operations on the multiple tiles that have been generated through the encoding thread group to generate multiple tile files.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.
10. An electronic device, characterized in that: include: a memory having a computer program stored thereon; A processor, configured to execute the computer program in the memory to implement the steps of the method according to any one of claims 1 to 7.