Image file generation method, image processing method and device
By dividing the image into tiles and generating image files containing file headers and tile offsets, the problem of slow image loading on the cloud is solved, efficient image browsing and storage is achieved, and the amount of data transmission and reading is reduced time.
Patent Information
- Application Number
- CN202310786240.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2023-04-12
- Filing Date
- 2023-06-29
- Publication Date
- 2024-10-18
AI Technical Summary
In the current cloud architecture, the large amount of image data causes slow loading of images on the cloud, making it difficult to achieve efficient browsing. Especially when users frequently perform panning and zooming operations, the client side needs to transmit a large number of requests, resulting in slow loading of images on the cloud.
By dividing the image into tiles and generating an image file, including file header, tile data and tile offset, the terminal device can request the target tile without downloading the original image in full, improving browsing efficiency and Optimize the image browsing experience with multi-level tiles and thumbnails.
Significantly alleviates the problem of slow image loading on the cloud, improves browsing efficiency, reduces the amount of data transmission, and saves storage space and reading time.
Smart Images

Figure CN118796782A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of image processing, and more specifically, to an image file generating method, an image processing method and a device. Background Art
[0002] Taking images of objects with high-definition cameras is one of the most direct and effective ways to obtain data for future digital twin scenarios. Currently, all fields involve massive amounts of large image data, which are multi-source heterogeneous, large in size, and complex in type. In order to store massive amounts of image raster data, cloud storage-based services are gradually becoming an industry trend. Therefore, image raster data such as images can be stored in a cloud server, and when browsing on the end side, images stored on the cloud can be transferred to the end side to enable image browsing. Summary of the invention
[0003] The present application provides an image file generation method, an image processing method and an apparatus, wherein the image file includes tiles segmented based on an original image and an offset indicating a tile position, so that a terminal device can request tiles corresponding to a target image without having to download the original image in full, which is beneficial to alleviating the problem of slow image loading on the cloud and improving browsing efficiency.
[0004] In a first aspect, a method for generating an image file is provided, comprising: acquiring data of a first image, the data of the first image including map data; dividing the first image to generate a plurality of tiles; generating a first image file based on the plurality of tiles, the first image file comprising: a first data structure area for storing a file header of the first image file, the file header being used to indicate a file type of the first image file; a second data structure area for storing data of a second image, the data of the second image including data of a plurality of tiles; and a third data structure area for storing offsets of a plurality of tiles, the offsets of the plurality of tiles being used to indicate storage locations of the data of the plurality of tiles in the second data structure area.
[0005] Based on the above embodiment, a method for generating an image file including the above data structure area is provided, so that only tiles corresponding to the target image can be requested, thereby eliminating the need to download the original image in full, which is beneficial to alleviating the problem of slow image loading on the cloud, thereby helping to improve browsing efficiency.
[0006] In combination with the first aspect, in some implementations of the first aspect, the method further includes: resampling multiple tiles to generate multi-level tiles, wherein the second image includes the multi-level tiles. Based on the above embodiment, providing multi-level tiles facilitates requesting tiles of different levels according to zooming, which is conducive to improving the image browsing experience.
[0007] In combination with the first aspect, in certain implementations of the first aspect, for multiple homogeneous tiles among multiple tiles, the data of the second image in the second data structure area includes data of feature tiles among the multiple homogeneous tiles, and the multiple homogeneous tiles are multiple tiles whose pixel proportion that is the same as the feature tile reaches a predetermined threshold.
[0008] In combination with the first aspect, in some implementations of the first aspect, the offsets corresponding to the multiple homogeneous tiles stored in the third data structure area are the same, and the same offsets of the multiple homogeneous tiles indicate the storage position of the feature tile in the second data structure area. Based on the above embodiment, tile reuse is achieved, thereby effectively saving storage space.
[0009] In combination with the first aspect, in certain implementations of the first aspect, the third data structure area is adjacent to the first data structure area in the first image file. Based on this embodiment, data reading efficiency is improved.
[0010] In combination with the first aspect, in some implementations of the first aspect, the third data structure area includes a tag, and the tag includes an index code and an offset of each tile in the second image. Based on the above embodiment, it is convenient to find the offset in the third data structure area according to the code index, and then locate the tile of the target image according to the offset, which is conducive to improving the search efficiency.
[0011] In combination with the first aspect, in certain implementations of the first aspect, the data of the second image also includes the first image and / or the first thumbnail, wherein the first thumbnail includes an image obtained by resampling based on the first image; and the third data structure area also includes an offset corresponding to the first image and / or the first thumbnail.
[0012] Based on the above embodiment, setting the second image in the first image file to further include the original image can make the first image file more compatible with the existing TIFF format files; and setting the image data of the first image file to further include the first thumbnail is conducive to image browsing and processing based on the first thumbnail; in addition, compared with storing the thumbnail or tile pyramid independently from the original image, storing all three in the image data of the first image file can also reduce the file input / output frequency and improve the reading and writing efficiency.
[0013] In combination with the first aspect, in some implementations of the first aspect, the first thumbnail includes a multi-level thumbnail, and the multi-level thumbnail includes a plurality of images with different resolutions obtained by resampling the first image multiple times. Based on the above embodiment, a multi-level thumbnail is provided to facilitate thumbnails of different levels according to zoom requests, which is conducive to improving the image browsing experience.
[0014] In combination with the first aspect, in some implementations of the first aspect, the first image file further includes: a fourth data structure area, the fourth data structure area is used to store specific attributes of the multiple tiles, and the size of the specific attribute is greater than a certain threshold.
[0015] In combination with the first aspect, in some implementations of the first aspect, the method further includes:
[0016] defining a projected coordinate system for the first image;
[0017] defining a coordinate reference hierarchy for the first image based on the projected coordinate system;
[0018] The first image is segmented according to the coordinate reference level to obtain a plurality of tiles.
[0019] In a second aspect, a method for image processing is provided, the method comprising: receiving a first data request from a terminal device, the first data request being used to request data of a first target image in a first image file, the first image file comprising a second data structure area, the second data structure area comprising data of a second image, the second image comprising a plurality of tiles, the plurality of tiles comprising an image obtained by segmentation based on the first image, wherein the first target image comprises one or more tiles in the second image; obtaining the data of the first target image in the first image file according to the first data request; and sending the data of the first target image to the terminal device.
[0020] Based on the above embodiment, the server receives a first data request sent by the terminal device, and then obtains one or more tiles included in the first target image according to the first data request, and sends it to the terminal device, so that there is no need to download the original image in full, which can significantly alleviate the problem of slow image loading on the cloud and improve browsing efficiency; and can also reduce the amount of data transmission.
[0021] In conjunction with the second aspect, in some implementations of the second aspect, the second image includes multiple layers of tiles, the multiple layers of tiles include multiple layers of tiles obtained by multiple resampling based on multiple tiles, and the first target image specifically includes one or more tiles of the same layer in the multiple layers of tiles. Based on the above embodiment, multiple tiles in one layer can be requested through one request, which is conducive to saving transmission overhead.
[0022] In combination with the second aspect, in certain implementations of the second aspect, the first image file also includes a third data structure area, the third data structure area includes the offset of the data of multiple tiles in the second image, and the offset is used to indicate the storage position of the data of the multiple tiles in the second data structure area.
[0023] In combination with the second aspect, in certain implementations of the second aspect, for multiple homogeneous tiles among multiple tiles, the data of the second image in the second data structure area includes data of feature tiles among the multiple homogeneous tiles, and the multiple homogeneous tiles are multiple tiles whose pixel proportion that is the same as the feature tile reaches a predetermined threshold.
[0024] In combination with the second aspect, in some implementations of the second aspect, the offsets corresponding to the multiple homogeneous tiles stored in the third data structure area are the same, and the same offsets of the multiple homogeneous tiles indicate the storage position of the feature tile in the second data structure area. Based on the above embodiment, by implementing tile reuse, storage space is effectively saved.
[0025] In combination with the second aspect, in certain implementations of the second aspect, obtaining data of the first target image in the first image file according to the first data request includes: determining the first target image according to the first data request; determining a first tile corresponding to the first target image according to the first target image; obtaining a first offset, the first offset being an offset of the first tile; obtaining the first tile according to the first offset, and sending the data of the first target image to the terminal device includes: sending the data of the first tile to the terminal device.
[0026] In combination with the second aspect, in certain implementations of the second aspect, the first data request includes a first offset, the first offset is the offset of the first tile corresponding to the first target image, and obtaining the data of the first target image in the first image file according to the first data request includes: obtaining the first tile according to the first offset, and sending the data of the first target image to the terminal device includes: sending the data of the first tile to the terminal device.
[0027] Based on the above scheme, the first target image can be requested by including the first offset in the first data request. The server does not need to search for the offset corresponding to the first target image in the third data structure area, and can directly determine the location of the required tile according to the first offset in the first data request, which is beneficial to improving reading efficiency; and in this scheme, data of multiple tiles can be requested through one data request, which can save transmission overhead and improve browsing efficiency.
[0028] In conjunction with the second aspect, in some implementations of the second aspect, before receiving the first data request from the terminal device, the method further includes: receiving a second data request from the terminal device, the second data request being used to request a third data structure area of the first image file; obtaining the third data structure area according to the second data request; and sending the third data structure area to the terminal device. Based on this solution, the terminal device can query the corresponding first offset in the third data structure area according to the set of index codes corresponding to the tiles in the first target image.
[0029] In conjunction with the second aspect, in some implementations of the second aspect, the first image file further includes a first data structure area, the first data structure area includes a file header of the first image file, the file header is used to indicate a file type, and the third data structure area is adjacent to the first data structure area in the first image file. In this solution, the third data structure area can be read quickly after the first data structure area is read, which is conducive to improving data reading efficiency.
[0030] In conjunction with the second aspect, in some implementations of the second aspect, the third data structure area includes a tag, and the tag includes an index code and an offset of each tile in the first tile. In this solution, the offset can be found in the third data structure area according to the code index, and then the tile of the target image is located according to the offset, which is conducive to improving the search efficiency.
[0031] In combination with the second aspect, in certain implementations of the second aspect, the second image also includes the first image and / or the first thumbnail, the first thumbnail includes an image obtained by resampling based on the first image; the third data structure area also includes the offset corresponding to the data of the first image and / or the data of the first thumbnail.
[0032] Based on the above embodiment, the image data of the first image file is set to further include the original image, which can make the first image file more compatible with the existing TIFF format files; and the image data of the first image file is set to further include the first thumbnail, which is conducive to image browsing and processing based on the first thumbnail; in addition, compared with additionally storing the thumbnail or tile pyramid independently of the original image, storing all three in the image data of the first image file can also reduce the file input / output frequency and improve the reading and writing efficiency.
[0033] In combination with the second aspect, in some implementations of the second aspect, the first thumbnail includes a multi-level thumbnail, and the multi-level thumbnail includes a plurality of images with different resolutions obtained by performing multiple resampling on the first image.
[0034] In combination with the second aspect, in some implementations of the second aspect, the first image file further includes: a fourth data structure area, the fourth data structure area is used to store specific attributes of the multiple tiles, and the size of the specific attribute is greater than a certain threshold.
[0035] In a third aspect, a method for image processing is provided, comprising: sending a first data request to a server, the first data request being used to request data of a first target image in a first image file, the first image file comprising a second data structure area, the second data structure area comprising data of a second image, the second image comprising a plurality of tiles, the plurality of tiles comprising an image obtained by segmentation based on the first image, wherein the first target image comprises one or more tiles in the second image; receiving data of the first target image from the server; and presenting the first target image according to the data of the first target image.
[0036] Based on the above solution, the terminal device can request the first target image in the first image file in the server by sending a first data request to the server. The server then obtains one or more tiles included in the first target image according to the first data request and sends them to the terminal device, thereby eliminating the need to download the entire original image, thereby significantly alleviating the problem of slow image loading on the cloud and improving browsing efficiency; and can also reduce the amount of data transmission.
[0037] In combination with the third aspect, in certain implementations of the third aspect, the second image includes multiple layers of tiles, the multi-level tiles include multiple different levels of tiles obtained by multiple resampling based on multiple tiles, and the first target image specifically includes one or more tiles of the same level in the multi-level tiles.
[0038] In combination with the third aspect, in certain implementations of the third aspect, the first image file also includes a third data structure area, which is used to store the offset of the data of the tiles in the second image, and the offset is used to indicate the storage position of the data of multiple tiles in the second data structure area.
[0039] In combination with the third aspect, in certain implementations of the third aspect, for multiple homogeneous tiles among multiple tiles, the data of the second image in the second data structure area includes data of feature tiles among the multiple homogeneous tiles, and the multiple homogeneous tiles are multiple tiles in which the proportion of pixels that are the same as the feature tiles reaches a predetermined threshold.
[0040] In combination with the third aspect, in certain implementations of the third aspect, the offsets corresponding to the multiple homogeneous tiles stored in the third data structure area are the same, and the same offsets of the multiple homogeneous tiles indicate the storage position of the feature tile in the second data structure area.
[0041] In combination with the third aspect, in some implementations of the third aspect, the first data request includes a first offset, the first offset is an offset of a first tile, and the first tile includes one or more tiles corresponding to the first target image.
[0042] In combination with the third aspect, in certain implementations of the third aspect, before sending a first data request to the server, the method also includes: sending a second data request to the server, the second data request being used to request a third data structure area of the first image file; receiving the third data structure area from the server; and determining a first offset based on the third data structure area.
[0043] In combination with the third aspect, in certain implementations of the third aspect, before sending the first data request to the server, the method also includes: obtaining an image access request, the image access request being used to request display of a first target image in the first image; and determining the first target image based on the image access request.
[0044] In combination with the third aspect, in certain implementations of the third aspect, determining the first target image includes: determining the level and pixel coordinates of the first target image according to the image access request; determining the first target image according to the level and pixel coordinates of the first target image.
[0045] In combination with the third aspect, in certain implementations of the third aspect, the third data structure area includes a label, the label includes an index code and an offset of each tile in the second image, and determining the first offset based on the third data structure area includes: obtaining the index code of the tile of the first target image; searching in the third data structure area according to the index code of the tile of the first target image to determine the first offset.
[0046] In combination with the third aspect, in certain implementations of the third aspect, the first image file also includes a first data structure area, the first data structure area includes a file header of the first image file, the file header is used to indicate the file type, and the third data structure area is adjacent to the first data structure area in the first image file.
[0047] In combination with the third aspect, in certain implementations of the third aspect, the second image data in the second data structure area also includes data of the first image and / or data of the first thumbnail, and the first thumbnail includes an image obtained by resampling based on the first image data; the third data structure area also includes an offset corresponding to the data of the first image and / or the data of the first thumbnail.
[0048] In combination with the third aspect, in some implementations of the third aspect, the first thumbnail includes a multi-level thumbnail, and the multi-level thumbnail includes a plurality of images with different resolutions obtained by performing multiple resampling on the first image.
[0049] In a fourth aspect, an image file generating device is provided, the device comprising: a transceiver module for receiving data of a first image, the data of the first image comprising map data; a processing module for segmenting the first image to generate a plurality of tiles; the processing module is further for generating a first image file based on the plurality of tiles, wherein the first image file comprises: a first data structure area for storing a file header of the image file, the file header being used to indicate a file type; a second data structure area for storing data of a second image, the data of the second image comprising data of a plurality of tiles; and a third data structure area for storing offsets of a plurality of tiles in the second image data, the offsets of the plurality of tiles being used to indicate storage locations of the data of the plurality of tiles in the second image data.
[0050] Based on the above embodiment, the image file generation device can generate an image file including the above data structure area, so that only the tiles corresponding to the target image can be requested, thereby eliminating the need to download the entire original image, which is helpful in alleviating the problem of slow image loading on the cloud, thereby helping to improve browsing efficiency.
[0051] In a fifth aspect, an image processing device is provided, characterized in that the device includes: a transceiver module for receiving a first data request from a terminal device, the first data request is used to request data of a first target image in a first image file, the first image file includes a second data structure area, the second data structure area includes data of a second image, the data of the second image includes data of multiple tiles, the multiple tiles include an image obtained by segmentation based on the first image, wherein the first target image includes one or more tiles in the second image; a processing module for obtaining the data of the first target image in the first image file according to the first data request; the transceiver module is also used to send the data of the first target image to the terminal device.
[0052] Based on the above scheme, the image processing device can receive a data request sent by the terminal device through the transceiver module, and the processing module then obtains one or more tiles included in the first target image according to the first data request, and sends it to the terminal device, so that there is no need to download the original image in full, which can significantly alleviate the problem of slow image loading on the cloud and improve browsing efficiency; and can also reduce the amount of data transmission.
[0053] In a sixth aspect, a device for image processing is provided, characterized in that the device includes: a transceiver module for sending a first data request to a server, the first data request is used to request data of a first target image in a first image file, the first image file includes a second data structure area, the second data structure area includes data of a second image, the second image includes multiple tiles, the multiple tiles include an image obtained by segmentation based on the first image data, wherein the first target image includes one or more tiles in the second image; the transceiver module is also used to receive data of the first target image from the server; and a processing module is used to present the first target image according to the data of the first target image.
[0054] Based on the above scheme, the image processing device can send a first data request to the server through the transceiver module, so as to request the first target image in the first image file in the server. The server then obtains one or more tiles included in the first target image according to the first data request, so that there is no need to download the original image in full. After the transceiver module receives the data of the first target image from the server, the processing module presents the first target image according to the data of the first target image, thereby significantly alleviating the problem of slow image loading on the cloud and improving browsing efficiency; and it can also reduce the amount of data transmission.
[0055] In a seventh aspect, a first image file is provided, comprising a first data structure area for storing a file header of the first image file, wherein the file header is used to indicate a file type of the first image file; a second data structure area for storing data of a second image, wherein the data of the second image includes data of multiple tiles; the multiple tiles include an image obtained by segmenting the first image; and a third data structure area for storing offsets of multiple tiles, wherein the offsets of multiple tiles are used to indicate storage locations of the data of multiple tiles in the second data structure area.
[0056] In an eighth aspect, a computing device is provided, comprising a processor and a memory, wherein the processor is configured to execute instructions stored in the memory so that the computing device executes a method as described in any one of the first aspect, the second aspect, or the third aspect.
[0057] In a ninth aspect, a computing device cluster is provided, comprising at least one computing device, each computing device comprising a processor and a memory; the processor of at least one computing device is used to execute instructions stored in the memory of at least one computing device, so that the computing device cluster performs a method as described in any one of the first aspect, the second aspect, or the third aspect.
[0058] In a tenth aspect, a computer-readable storage medium is provided, comprising computer program instructions. When the computer instructions are executed by a computing device cluster, the computing device cluster executes a method as in any one of the first aspect, the second aspect, or the third aspect.
[0059] In an eleventh aspect, a computer program product comprising instructions is provided, wherein when the instructions are executed by a computing device cluster, the computing device cluster executes a method as described in any one of the first aspect, the second aspect, or the third aspect.
[0060] In the twelfth aspect, a cloud-side device is provided, comprising at least one processor, wherein the at least one processor is coupled to at least one memory, and the at least one processor is used to execute a computer program or instruction stored in the at least one memory, so that the cloud-side device executes a method as in the first aspect or any one of the second aspects.
[0061] In the thirteenth aspect, an end-side device is provided, comprising at least one processor, wherein the at least one processor is coupled to at least one memory, and the at least one processor is used to execute a computer program or instruction stored in the at least one memory, so that the end-side device executes any one of the methods in the third aspect.
[0062] In a fourteenth aspect, a terminal-cloud collaborative system is provided, comprising a cloud-side device as in the twelfth aspect and a terminal-side device as in the thirteenth aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] Figure 1 A schematic diagram of a terminal-cloud collaborative system provided in accordance with an embodiment of the present application.
[0064] Figure 2 A schematic diagram of an image processing method provided in one embodiment of the present application.
[0065] Figure 3 A schematic diagram of an image file generation method provided in one embodiment of the present application.
[0066] Figure 4 A TIFF image provided in an embodiment of the present application.
[0067] Figure 5 A schematic diagram of the file structure of a TIFF image file provided in one embodiment of the present application.
[0068] Figure 6 A schematic diagram of coordinate mapping of a TIFF image provided in one embodiment of the present application.
[0069] Figure 7 A schematic diagram of an image resampling and segmentation process provided in one embodiment of the present application.
[0070] Figure 8 A schematic diagram of the file structure of a first image file provided in an embodiment of the present application.
[0071] Fig. 9 A schematic diagram of a process for determining tiles of a first target image provided by an embodiment of the present application.
[0072] Fig.10 A schematic block diagram of an image file generating device provided in one embodiment of the present application.
[0073] Fig.11 A schematic block diagram of an image processing device provided in one embodiment of the present application.
[0074] Fig.12 It is a schematic structural block diagram of a computing device provided in an embodiment of the present application.
[0075] Fig.13 It is a schematic structural block diagram of a computing device cluster provided in an embodiment of the present application.
[0076] Fig.14 It is a schematic structural block diagram of another computing device cluster provided in an embodiment of the present application. DETAILED DESCRIPTION
[0077] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0078] The end-side device in the embodiment of the present invention may also be referred to as a terminal device, a user equipment (UE), a mobile station (MS), or a mobile terminal, etc. The end-side device may be, for example, a mobile phone (or a "cellular" phone) or a computer with a mobile terminal, for example, a portable, pocket-sized, handheld, computer-built-in, or vehicle-mounted mobile device.
[0079] The cloud-side device in the embodiment of the present invention may be a server or a server cluster. The cloud-side device may also be referred to as a computing node or a cloud-side computing cluster.
[0080] In order to facilitate understanding and description of the image processing method provided by the embodiment of the present invention, Figure 1 Describe the end-cloud collaboration system 100 provided in an embodiment of the present application.
[0081] like Figure 1As shown, the end-cloud collaborative system 100 includes an end-side device 110 and a cloud-side device 120. The end-side device 110 includes an image processing system 111 and an application 112 (APP1, APP2, ..., APPN). The image processing system 111 includes: a transceiver module and a processing module; wherein the transceiver module is used to send image data requests or receive image data. The cloud-side device 120 includes a cloud storage module, a transceiver module, and a processing module. wherein the cloud storage module is used to store image data.
[0082] The following is an introduction to the relevant terms involved in the embodiments of the present application.
[0083] 1. Raster image: It can also be called a bitmap image or a dot matrix image. It refers to an image whose smallest unit is composed of pixels. It is usually obtained by photography, scanning, and photography. The file formats include BMP, GIF, JPG, TIFF, etc. It is widely used in satellite remote sensing, astronomical observation, biomedicine, land management and other fields.
[0084] 2. Tile: refers to a number of small images that are evenly and seamlessly divided into an image according to a fixed specification (such as 256*256, etc.). The process of dividing an image into tiles is called image slicing.
[0085] 3. Tile pyramid: Tiles of different levels form a tile pyramid, also known as an image pyramid, which can also be called a multi-level tile in this application. It is a model with multiple resolution levels. Each tile is identified by "layer number, row number, column number". Among them, the level refers to the level of resolution. The higher the number of layers, the higher the image resolution of the tile and the clearer the tile.
[0086] 4. Thumbnail: refers to a small image that is proportionally resampled from a large image. Except for the different file sizes, the thumbnail and the original image maintain similar visual effects. Usually, there can be thumbnails of multiple resolutions depending on the degree of scaling.
[0087] 5. Homogeneous areas: Areas with consistent large-scale color patterns are called homogeneous areas, such as large geographical snow-capped mountains, deserts, ocean areas, etc.
[0088] The above briefly describes the terms involved in this application, which will not be repeated in the following embodiments. In addition, the above description of terms is only for the sake of ease of understanding, and does not limit the protection scope of the embodiments of this application.
[0089] In the current cloud architecture, most information systems use the Browser / Server (B / S) architecture. In the B / S architecture design, the display of images on the cloud on the client side mainly relies on the network (Web) transmission technology, that is, after the image to be displayed on the cloud is transmitted to the client side through the Web, the client side renders a part of the image according to the screen range. However, when faced with a large amount of image data and users frequently perform operations such as panning and zooming, the client side will send a large number of requests, and each request requires the transmission of the original image, resulting in abnormally slow loading of images on the cloud, making it difficult to achieve efficient browsing of large images on the cloud.
[0090] In view of this, the present application proposes a solution that can alleviate the problem that images on the cloud are difficult to browse efficiently on the terminal side.
[0091] Figure 2 A schematic diagram of an image processing method 200 provided in an embodiment of the present application is shown. The method can be applied to Figure 1 The end-cloud collaborative system shown is not limited to this embodiment of the present application.
[0092] The method comprises the following steps:
[0093] S210, the terminal device sends a first data request to the server;
[0094] The terminal device may send a first data request to the server, wherein the first data request may be used to request data of a first target image in a first image file.
[0095] Among them, the first target image can be an image that the terminal device needs to browse. Among them, the first image file can include a second data structure area, and the second data structure area can be used to store data of the second image, and the second image can include multiple tiles obtained by segmenting based on the first image. In an embodiment of the present application, the first target image can include one or more tiles in the second image. It can be understood that the first image can be an original image, and the first image hereinafter can also be referred to as an original image, which is not limited here. Exemplarily, the data of the first image can include map data.
[0096] In some implementations, the second image in the second data structure area may include multiple layers of tiles, and the multiple layers of tiles may specifically include multiple layers of tiles obtained by multiple resamplings based on the multiple tiles. Based on the above embodiment, multiple layers of tiles are provided to facilitate requesting tiles of different layers according to zooming, which is beneficial to improving the image browsing experience.
[0097] In some embodiments, the first image file may further include a third data structure area, which may be used to store offsets of data of multiple tiles in the second image, wherein the offsets are used to indicate storage locations of the data of the multiple tiles in the second data structure area.
[0098] In some implementations, the first image file may further include a first data structure area, and the first data structure area may be used to store a file header of the first image file, wherein the file header is used to identify or indicate a file type.
[0099] Optionally, the first data request may be an HTTP range (GET Range) request.
[0100] Correspondingly, the server may receive a first data request from the terminal device. Optionally, the first image file may be stored in the server, and after receiving the first data request from the terminal device, the server may obtain data of the first target image in the first image file according to the first data request.
[0101] Optionally, before receiving the first data request from the terminal device, the server may generate a first image file. The present application provides an image file generation method 300, such as Figure 3 As shown, the method includes:
[0102] S310, acquiring data of a first image;
[0103] S320, dividing the first image into multiple tiles;
[0104] S330: Generate a first image file according to the multiple tiles.
[0105] Specifically, the first image file may include:
[0106] A first data structure area, the first data structure area is used to store the file header of the image file;
[0107] The file header may identify or indicate the file type. In some embodiments, the file header of the image file may be the same as the file header of the original image, so that the image file is compatible with the original image format. Alternatively, the file header of the original image may be directly extracted as the file header of the image file.
[0108] A second data structure area, the second data structure area is used to store data of a second image, the data of the second image includes data of a plurality of tiles;
[0109] The third data structure area may be used to store the offset of the data of the plurality of tiles in the second image.
[0110] Based on the embodiment of the above-mentioned image file generation method, an image file including the above-mentioned data structure area is provided, so that only tiles corresponding to the target image can be requested, thereby eliminating the need to download the entire original image, which is conducive to alleviating the problem of slow image loading on the cloud, thereby helping to improve browsing efficiency.
[0111] In some embodiments, the second image may include multiple layers of tiles, and in step S330, a projection coordinate system may be first defined for the original image, and then a coordinate reference level may be defined based on the projection coordinate system. Further, the original image may be segmented and resampled according to the coordinate reference level to obtain multiple layers of tiles, and specifically, multiple tiles obtained by segmenting the original image may be resampled multiple times according to the coordinate reference level to obtain multiple layers of tiles.
[0112] In some implementations, the first image file may further include a fourth data structure area, wherein the fourth data structure area may be used to store a specific attribute of the second image. Optionally, the size of the specific attribute is greater than a certain threshold.
[0113] In a specific embodiment of the present application, the first data structure area may be described as a "file header", the second data structure area may be described as "image data", the third data structure area may be described as an "image attribute directory", and the fourth image attribute may be described as an "attribute value". The following will not be repeated. It should be understood that the following is only an example given for the convenience of description and understanding, and should not constitute any limitation on the technical solution.
[0114] The above-mentioned image file generation method is introduced below in conjunction with specific embodiments.
[0115] Exemplarily, the format of the first image file can be named as RM-TIFF format. In some embodiments, the format of the original image can be Tag Image File Format (TIFF). Exemplarily, the suffix of the original image file can include tif, tiff, TIF, TIFF, etc. TIFF format image files generally include a file header (Image File Header, IFH), image data, an image attribute directory (Image File Directory, IFD) and attribute values. It should be noted that a TIFF file can store multiple images, that is, there can be one or more image data, and the image data and IFD appear in pairs. In other words, each image data corresponds to one or more corresponding IFDs.
[0116] In order to facilitate understanding of the embodiments of the present application, Figure 4 A TIFF image of the embodiment of the present application is provided. The TIFF image is opened as follows Figure 4As shown in the figure, the TIFF image has a width of 750 pixels and a height of 1000 pixels. Figure 5 Shows Figure 4 Schematic diagram of the file structure of the image file of the TIFF image in FIG. Figure 5 As shown, the image file of the TIFF format image includes IFH, image data, IFD, and attribute values. Since the image in this embodiment is not large, it only includes one image data, and the attributes in the image are recorded through one IFD.
[0117] TIFF format image files usually start with an 8-byte IFH. IFH can include a sequence flag, a TIFF flag, and the offset of the first IFD. The sequence flag occupies 2 bytes; the TIFF flag occupies 2 bytes; the offset of the first IFD occupies 4 bytes, and the offset of the first IFD can indicate the position of the first IFD corresponding to the first image data.
[0118] IFD can record the attributes within the image. Specifically, IFD includes the number of tags, tags, and the offset of the next IFD. Among them, the number of tags occupies 2 bytes and records the total number of tags that follow; each tag occupies 12 bytes, representing a certain attribute of the image, which can be divided into tag number (2 bytes), value type (2 bytes), number of values (4 bytes) and data or offset (4 bytes). If the byte length of the value type multiplied by the number of values is less than or equal to 4 bytes, the data can be stored directly in the tag, otherwise the data can be stored in the attribute value at the end of the TIFF format, and the offset is recorded in the tag. At the end of the IFD, there is also the offset of the next IFD. If the next IFD does not exist, this value can be NULL (0x00000000). In IFD, the tag numbers are arranged in ascending order. This number is defined in the TIFF specification. For example, the tag numbered 256 represents the image width, and the tag numbered 282 represents the offset of the stripe data. A stripe is a continuous data segmentation into data blocks, and each data block is stored in a different location. In Figure 5 In the image file shown, tag 3 points to the location in the TIFF file where the image data of the TIFF image is located.
[0119] In some embodiments, the format of the original image can also be Geo Tag Image File Format (GeoTIFF). GeoTIFF is an extended format of Tag Image File Format (TIFF), that is, some Geo Tags are defined on the basis of TIFF to define and store various coordinate systems, ellipsoid references, projection information, etc., so that image data and geographic data are stored in the same image file, thereby facilitating the production and use of images with geographic information. Exemplarily, geographic information can be information such as coordinate system, longitude and latitude. Processing based on the image in GeoTIFF format defines a standard coordinate system for the image, which is conducive to subsequent format conversion.
[0120] Specifically, in the above step S310, the file header IFH of the original image can be first extracted as the file header of the first image file. Optionally, the format of the original image can be checked first to verify whether it is in the correct TIFF format or GeoTIFF format. Exemplarily, a third-party library such as libtiff can be used to verify whether the image is in the correct TIFF format. Exemplarily, a third-party library such as GDAL, OpenCV, etc. can be used to verify whether the image is in GeoTIFF format.
[0121] In some embodiments, the original image may be resampled to obtain a first thumbnail. The first thumbnail may include multiple levels of thumbnails, and the multiple levels of thumbnails include multiple images with different resolutions obtained by resampling the original image multiple times. The multiple levels of thumbnails may also be generated based on the above-mentioned coordinate reference level.
[0122] In an embodiment of the present application, when the second data structure area in the first image file is generated in step S330, the first thumbnail and / or the original image can also be stored in the second data structure area. Based on the above embodiment, the original image is stored in the second data structure area of the first image file, which can make the first image file more compatible with the existing TIFF format file. The first thumbnail is stored in the second data structure area of the first image file, which can facilitate image browsing and processing based on the first thumbnail. Compared with additionally storing thumbnails or tile pyramids independently of the original image, storing all three in the second data structure area of the first image file is conducive to reducing the file input / output (I / O) frequency and improving read and write efficiency.
[0123] Optionally, in step S330, the offset of the data of the first thumbnail and / or the original image in the second data structure area may also be stored in the third data structure area. Further, the image attributes in the IFD of the original image may also be stored in the third data structure area.
[0124] In some embodiments, the image attributes in the IFD of the original image may be extracted and stored in the memory. Figure 4 For the TIFF image shown, the image attributes in the IFD of the original image can be Figure 5 The image width, image height, strip offset, etc. of the original image shown.
[0125] In some embodiments, a data structure, such as a Map structure, may be used to temporarily store the extracted IFH of the original image, the IFD of the original image, and the image data of the original image for subsequent use. In other embodiments, the extracted IFH of the original image, the IFD of the original image, and the image data of the original image may be directly stored in a file for persistent use.
[0126] The following describes the definition of the projection coordinate system and the coordinate reference level in the above step S330, and the segmentation and resampling based on the original image in combination with the coordinate reference level in conjunction with a specific embodiment.
[0127] (1) Define the projection coordinate system
[0128] Specifically, when the format of the original image is TIFF format, the original image in TIFF format may be converted into GeoTIFF format first.
[0129] The image file in GeoTIFF format contains geographic data, and a geographic coordinate system is defined based on the geographic data. It can be understood that the geographic coordinate system is a spherical coordinate system in space, and the projection coordinate system is a plane coordinate system. The process of converting spherical coordinates into plane coordinates is called projection.
[0130] In some implementations, an image in GeoTIFF format is defined with a geographic coordinate system and a projection coordinate system, that is, each pixel in GeoTIFF format may correspond to a geographic coordinate and a projection coordinate.
[0131] In other implementations, the image in GeoTIFF format only defines a geographic coordinate system, and a projection coordinate system needs to be defined based on the geographic coordinate system.
[0132] In the embodiment of the present application, defining the projection coordinate system can be understood as converting the coordinates of the spherical surface into the coordinates of the plane. Exemplarily, the projection coordinate system can be defined by the DefineProjection_management method of the arcpy script. It should be noted that defining the projection coordinate system does not change the geometric information of the image, only updates the coordinate system, and therefore does not cause deformation to the display of the image. Exemplarily, the projection coordinate system can be defined as a spherical Mercator coordinate system (also referred to as a "Web Mercator coordinate system"), and can be projected based on the projection standard of EPSG:3857.
[0133] In some implementations, the pixel coordinates of the original image may be directly mapped to the projection coordinates. Specifically, the width and height of the TIFF image may be mapped to coordinates on a two-dimensional plane coordinate system as the projection coordinates of the image.
[0134] For example, Figure 6 for Figure 4 The coordinate mapping diagram of the TIFF image shown is shown. Figure 4 The resolution of the TIFF image shown is 750*1000. The lower left corner of the TIFF image can be set as the origin of the projection coordinate system (0,0), and the coordinates of the upper right corner of the TIFF image are (750,1000). Figure 6 The figure shows the projection coordinates of the TIFF image after mapping.
[0135] (2) Define the coordinate reference level
[0136] In some embodiments, the coordinate reference level can be defined based on the projection coordinate system of the original image, so as to facilitate the generation of multi-level thumbnails and multi-level tiles, and the coordinate reference level corresponds to the level in the multi-level thumbnails and multi-level tiles. Generally, the maximum zoom level resolution when browsing an image does not exceed the original resolution of the image, and the resolution of adjacent levels is 2 times.
[0137] For example, assuming that the length and width of a tile are both 256 pixels, the tile pyramid can use 1*1 tiles to represent the image at layer 0, 2*2 tiles to represent the image at layer 1, 4*4 tiles to represent the image at layer 2, and so on, and the tile level correspondence shown in Table 1 can be obtained:
[0138] Table 1 Tile level correspondence of an embodiment of the present application
[0139]
[0140] According to Table 1, the 18th level of the pyramid can represent images with a maximum range of 67,108,864*67,108,864 pixels. Images exceeding this range can be further divided. Figure 4 When the TIFF image shown is the original image, the image size is 750*1000, so it can be represented by the second level of the tile pyramid with a pixel range of 1024*1024. The pyramid level where the image is located is the second level, covering 12 tiles.
[0141] Based on the defined coordinate reference level, the original image can be segmented and resampled to obtain multi-level tiles; the original image can also be resampled to obtain multi-level thumbnails. Segmentation can also be called cropping. For example, segmentation and resampling can be completed with the help of third-party libraries such as GDAL and OpenCV.
[0142] (3) Segmentation and resampling based on the original image
[0143] The resampling and segmentation process is introduced below in conjunction with a specific embodiment. Figure 7 A schematic diagram of a resampling and segmentation process provided in an embodiment of the present application, wherein the original image in the resampling and segmentation process is Figure 4 For example, in this embodiment, the length and width of the tile are both 256 pixels.
[0144] like Figure 7 As shown in the figure, the multi-level tile acquisition process is as follows: the original image with a resolution of 750*1000 is segmented to obtain 12 second-layer tiles; the 12 second-layer tiles are resampled to obtain 4 first-layer tiles. For example, the four second-layer tiles marked as ①, ②, ③, and ④ in the figure are resampled to obtain one first-layer tile marked as ⑤ in the figure; the four first-layer tiles are resampled to obtain one 0th-layer tile.
[0145] The process of obtaining multi-level thumbnails is as follows: the original image with a resolution of 750*1000 is directly used as the second-level thumbnail; the second-level thumbnail is resampled to obtain a first-level thumbnail with a resolution of 375*500; the first-level thumbnail is resampled to obtain a zero-level thumbnail.
[0146] Specifically, in step S330, the obtained multi-level thumbnails and multi-level tiles can be uniformly encoded, and the index code and offset of each image can be stored in the third data structure area. Exemplarily, the encoding can be performed using the geohash method, or other encoding methods, such as a custom encoding method, which is not limited in this application. Figure 7In the embodiment shown, the geohash method can be used to encode the tiles in a zigzag order, and the index codes of the tiles numbered ①, ②, ③, and ④ in the second layer of tiles are 0000, 0001, 0010, and 0011 respectively; the index code of the tile numbered ⑤ in the first layer of tiles is 00. Based on the above embodiment, it is convenient to determine the offset according to the encoding index, so as to locate the tile of the target image according to the offset.
[0147] In some embodiments, the index code and offset of the thumbnail can be stored in a tag in the third data structure area; when the number of thumbnails is relatively large, the code and offset of the thumbnail can also be correspondingly stored in multiple tags in the third data structure area. Similarly, the code and offset of the tile can also be stored in one or more tags in the third data structure area. Exemplarily, in the embodiment of the present application, the offsets of the 0-2 layer thumbnails are uniformly stored in one tag.
[0148] In summary, the first image file can be generated based on the original image.
[0149] like Figure 8 FIG. 1 is a schematic diagram of the file structure of a first image file according to an embodiment of the present application. Figure 8 , the first image file includes IFH, IFD, attribute values, and image data. Among them, tags 1 to n in IFD are attribute information of the original image, such as image width, image height, strip offset, etc.; tags n+1 to m are coordinate information; tags m+1 to k are the offset of the original image, and the subsequent other tags are used to store the offset of thumbnails and tiles.
[0150] In some embodiments, region detection may be performed on tiles in the first image file to determine homogeneous tiles, wherein homogeneous tiles are tiles whose proportion that is the same as that of feature tiles reaches a predetermined threshold. Exemplarily, homogeneous region detection may be analyzed using methods such as deep learning and histogram analysis. Specifically, similarity detection may be performed on tiles, and tiles with consistent large-scale color patterns belong to homogeneous regions. In similarity detection, a parameter λ may be set so that when the proportion of identical or similar pixels in two tiles exceeds λ, the two tiles are considered to be homogeneous tiles. Specifically, the parameter λ may be set according to actual needs during application.
[0151] For multiple homogeneous tiles, the tile that best represents the area can be extracted as a feature tile. Exemplarily, the feature tile can be extracted by manual selection or machine learning. In the image data of the first image file, only the data of the feature tile among multiple homogeneous tiles can be included, that is, the data of the homogeneous tiles other than the feature tile can be deleted; and the offsets corresponding to the multiple homogeneous tiles in the IFD are all set to the offset of the feature tile, that is, the offsets of the multiple homogeneous tiles all indicate the position of the feature tile in the first image file. Based on the above embodiment, by being able to realize tile reuse, storage space is effectively saved.
[0152] In some embodiments, the image data in the first image file may be compressed to reduce the storage space occupied and reduce the network transmission cost. After compression, the offset in the IFD needs to be updated synchronously. Exemplarily, the compression method may be LZM, JPEG, DEFLATE, etc.
[0153] In some embodiments, the third data structure area can be arranged adjacent to the first data structure area. Specifically, in the first image file, IFD can be arranged adjacent to IFH. Based on this embodiment, it is helpful to improve data reading efficiency. In some embodiments, the attribute value can also be placed adjacent to IFD after the file header to facilitate one-time reading of complete image attributes.
[0154] Based on the above embodiment, the first image file in the RM-TIFF format can be obtained by performing format conversion on the original image.
[0155] S220: The server obtains data of the first target image in the first image file according to the first data request.
[0156] After receiving the first data request in S210 , the server may obtain data of the first target image in the first image file according to the first data request.
[0157] S230: The server sends data of the first target image to the terminal device.
[0158] Correspondingly, the terminal device can receive the data of the first target image from the server, and present the first target image according to the data of the first target image.
[0159] Based on the above embodiment, the terminal device can request the first target image in the first image file in the server by sending a first data request to the server. The server then obtains one or more tiles included in the first target image according to the first data request and sends them to the terminal device, thereby eliminating the need to download the entire original image, thereby significantly alleviating the problem of slow image loading on the cloud and improving browsing efficiency; and can also reduce the amount of data transmission.
[0160] Before the above S210, the terminal device may also determine the first target image. Specifically, the terminal device may first obtain an image access request. For example, the image access request may be a user performing operations such as panning and zooming, and the image access request is used to request to display the first target image in the original image.
[0161] In some implementations, the terminal device may determine the first target image according to the image access request. Specifically, the terminal device may determine the level and pixel coordinates of the first target image according to the image access request, and then determine the first target image and the tile corresponding to the first image according to the level and pixel coordinates of the first target image.
[0162] Exemplarily, the level of the tiles within the window range can be determined based on the user's operations such as translation and zooming, and the screen coordinates can be converted into pixel coordinates; the pixel coordinates can then be converted into projection coordinates to obtain the projection coordinate range of the tiles within the window range; and the set of index codes corresponding to the tiles can be obtained based on the projection coordinate range of the tiles. It should be noted that the window on the terminal device side and the image on the server side both adopt the same encoding method, for example, both adopt the geohash method for encoding, so that the index codes of the window on the terminal device side and the corresponding server-side tiles are unified.
[0163] In some embodiments, the first data request may include geographic information corresponding to the first target image, such as longitude and latitude ranges, etc. After receiving the first data request, the server may obtain data of the first target image in the first image file according to the first data request. Specifically, the server may determine the first target image according to the first data request; then determine the first tile corresponding to the first target image according to the first target image, wherein the first tile may include one or more tiles; then obtain the first offset corresponding to the first tile; then obtain the data of the first tile according to the first offset, and send the data of the first tile to the terminal device.
[0164] In some embodiments, before the above step S210, the terminal device may also send a second data request to the server to request the third data structure area of the first image file. Optionally, the second data request may be an HTTP GETRange request. Correspondingly, the server may receive the second data request from the terminal device, obtain the third data structure area in the first image file according to the second data request, and then send the third data structure area of the first image file to the terminal device.
[0165] Furthermore, the terminal device can query the corresponding first offset in the third data structure area according to the set of index codes corresponding to the tiles in the first target image. It can be understood that the first offset is a set of offsets corresponding to one or more tiles in the first tile. When the first target image covers only one tile, there is one index code and one corresponding offset, which constitutes the above-mentioned first offset; when the first target image covers multiple tiles, there are multiple index codes and multiple corresponding offsets, which constitute the above-mentioned first offset.
[0166] Furthermore, the first data request may include a first offset, so that the server can directly locate the location of the data of the first target image according to the first offset. Based on the above scheme, the first target image can be requested by including the first offset in the first data request. The server does not need to search for the offset corresponding to the first target image in the third data structure area, and can directly determine the location of the required tile according to the first offset in the first data request, which is conducive to improving reading efficiency; and in this scheme, the data of multiple tiles can be requested through one data request, which can save transmission overhead and improve browsing efficiency.
[0167] The following describes a process of determining a set of index codes corresponding to tiles in a first target image in conjunction with a specific embodiment.
[0168] Fig. 9 Schematic diagram of the process of determining the tiles of the first target image provided by an embodiment of the present application. Assume that the image display area (or "window") is 300*300 pixels, and the zoom level is at level 0 when the user initially loads the image. Then the user changes the zoom level to level 2 through translation and zoom operations. The pixel coordinates corresponding to the upper left corner of the image window are (200, 200). See Fig. 9 , the window is at the second zoom level, and the pixel coordinates corresponding to the upper left corner of the window are (200,200). At this time, the screen cannot display the entire image, so the tiles within the window range are requested.
[0169] In this embodiment, the index encoding determination process of the tile of the first target image is as follows:
[0170] (1) The screen coordinates can be converted to pixel coordinates. According to the window size of 300*300 and the pixel coordinates of the upper left corner (200,200), the pixel coordinates of the lower right corner of the window can be calculated to be (500,500); (2) According to the projection coordinate system of the image, the pixel coordinates are converted to standard projection coordinates. The origin of the pixel coordinates is located in the upper left corner, and the y-axis increases from top to bottom, while the origin of the projection coordinates is located in the lower left corner, and the y-axis increases from bottom to top, so a coordinate system conversion is required. Align the upper left corner coordinates of the projection coordinate system in the figure with the origin of the pixel coordinate system, and the projection coordinate range within the window range is [200,500] on the x-axis and [524,824] on the y-axis; (3) According to the geohash encoding method, the projection coordinate range is converted to an index encoding set, that is, four tiles of 0100, 0101, 0110, and 0111.
[0171] In some embodiments, the first target image may include a thumbnail. For example, when the user's image display area (or "window") is initially in the 0th layer, the upper left corner of the screen coordinates is (0,0) and the lower right corner is (300,300). The image thumbnail size of the 0th layer is 256*256 pixels, so the full image can be displayed directly through the thumbnail. Optionally, the terminal device can retrieve the second offset corresponding to the thumbnail in the IFD, and accordingly, the first data request includes the second offset. The server can determine the position of the thumbnail according to the second offset in the first data request, and send the thumbnail data to the terminal device.
[0172] In some implementations, the terminal device may cache the received data of the first target image. Optionally, a memory cache may be used; when the cache requirement is large, a database may be used for caching. Subsequent identical requests may be searched in the local cache first to improve efficiency.
[0173] Combination of the above Figures 1 to 9 , describes in detail the method side embodiment of the present application, and will be combined with Figures 10 to 12 , the device side embodiment of the present application is described in detail. It should be understood that the description of the device embodiment corresponds to the description of the method embodiment, so the part not described in detail can refer to the previous method embodiment.
[0174] Fig.10 is a schematic block diagram of an image file generating device 1000 provided in an embodiment of the present application. Fig.10 As shown, the image file generating device 1000 may include a transceiver module 1010 and a processing module 1020. In a possible design, the image file generating device 1000 may implement the steps or processes executed by the image file generating method in the above method embodiment.
[0175] Optionally, the image file generating device 1000 can be applied to a server. In some embodiments, the transceiver module 1010 can be used to receive data of a first image. The data of the first image can include map data; the processing module 1020 can be used to segment the first image to generate multiple tiles; the processing module 1020 can also be used to generate a first image file based on multiple tiles, wherein the first image file includes: a first data structure area for storing a file header of the image file, the file header is used to indicate the file type; a second data structure area for storing data of a second image, the data of the second image includes data of multiple tiles; a third data structure area for storing the offsets of multiple tiles in the second image data, the offsets of multiple tiles are used to indicate the storage location of the data of multiple tiles in the second image data.
[0176] Based on the image file generated by the image file generating device 1000 and including the data structure area, the terminal device can only request tiles corresponding to the target image in the image file, thereby eliminating the need to download the original image in full, which is conducive to alleviating the problem of slow image loading on the cloud and improving browsing efficiency.
[0177] In some embodiments, the processing module 1020 may also be used to resample the plurality of tiles to generate multi-level tiles, and the second image may include the multi-level tiles.
[0178] In some embodiments, for multiple homogeneous tiles in the first tile, the second data structure area may only store data of feature tiles among the multiple homogeneous tiles, and the offsets corresponding to the multiple homogeneous tiles in the third data structure area may be set to be the same, and the same offsets corresponding to the multiple homogeneous tiles may point to the location of the data of the feature tiles in the second data structure area.
[0179] Optionally, the third data structure area may be arranged adjacent to the first data structure area. In some embodiments, the third data structure area may include a tag, and the tag may include an index code and an offset of each tile in the first tile.
[0180] In some embodiments, the second data structure area may also store data of the original image and / or data of the first thumbnail, wherein the first thumbnail includes an image obtained by resampling the original image. Further, the third data structure area may also store the data of the original image and / or the offset corresponding to the data of the first thumbnail.
[0181] Furthermore, the first thumbnail may include a multi-level thumbnail, and the multi-level thumbnail may include a plurality of images with different resolutions obtained by performing multiple resampling operations based on the original image.
[0182] In some implementations, the processing module 1020 may also be used to compress the data of the second image in the third data structure area. It should be noted that after compression, the offset of each image changes, so the offset in the third data structure area also needs to be updated.
[0183] In some embodiments, the processing module 1020 may be specifically configured to define a projection coordinate system for the original image; define a coordinate reference level for the original image based on the projection coordinate system; and segment the original image according to the coordinate reference level to obtain a plurality of tiles.
[0184] Fig.11 1 is a schematic block diagram of an image processing device 1100 provided in an embodiment of the present application. Fig.11 As shown, the image processing device 1100 may include a transceiver module 1110 and a processing module 1120. The transceiver module 1110 may communicate with the outside, the processing module 1120 is used for data processing, and the transceiver module 1110 may also be called a communication interface.
[0185] In one possible design, the image processing device 1100 can implement steps or processes corresponding to those executed by the server (i.e., cloud device) in the above method embodiment, wherein the processing module 1120 can be used to execute processing-related operations of the server in the above image processing method embodiment, and the transceiver module 1110 can be used to execute transceiver-related operations of the server in the above image processing method embodiment.
[0186] In some embodiments, the transceiver module 1110 can be used to receive a first data request from a terminal device, wherein the first data request is used to request data of a first target image in a first image file, the first image file includes a second data structure area, the second data structure area includes data of a second image, the data of the second image includes data of multiple tiles, the multiple tiles include an image obtained by segmenting based on the first image, wherein the first target image includes one or more tiles in the second image; the processing module 1120 can be used to obtain data of the first target image in the first image file according to the first data request; the transceiver module 1110 can also be used to send the data of the first target image to the terminal device.
[0187] Based on the above embodiment, the image processing device 1100 can receive the first data request sent by the terminal device through the transceiver module 1110, and the processing module 1120 can obtain one or more tiles included in the first target image according to the first data request, and send it to the terminal device, so that the terminal device does not need to download the original image in full, thereby significantly alleviating the problem of slow image loading on the cloud and improving browsing efficiency; and can also reduce the amount of data transmission.
[0188] In one possible design, the image processing device 1100 can implement steps or processes corresponding to those executed by the terminal device in the above method embodiment, wherein the processing module 1120 can be used to execute processing-related operations of the terminal device in the above image processing method embodiment, and the transceiver module 1110 can be used to execute transceiver-related operations of the terminal device in the above image processing method embodiment.
[0189] In some embodiments, the transceiver module 1110 can be used to send a first data request to a server, the first data request is used to request data of a first target image in a first image file, the first image file includes a second data structure area, the second data structure area includes data of a second image, the second image includes multiple tiles, the multiple tiles include an image obtained by segmentation based on the first image data, wherein the first target image includes one or more tiles in the second image; the transceiver module 1110 can also be used to receive data of the first target image from the server; the processing module 1120 can be used to present the first target image based on the data of the first target image.
[0190] Based on the above scheme, the image processing device can send a first data request to the server through the transceiver module 1110, so as to request the first target image in the first image file in the server. The server then obtains one or more tiles included in the first target image according to the first data request, so that there is no need to download the original image in full. After the transceiver module 1110 receives the data of the first target image from the server, the processing module 1120 presents the first target image according to the data of the first target image, thereby significantly alleviating the problem of slow image loading on the cloud and improving browsing efficiency; and it can also reduce the amount of data transmission.
[0191] The present application also provides a computing device 1200. Fig.12 As shown, the computing device 1200 includes: a bus 1202, a processor 1204, a memory 1206, and a communication interface 1208. The processor 1204, the memory 1206, and the communication interface 1208 communicate through the bus 1202. The computing device 1200 can be a server or a terminal device. It should be understood that the present application does not limit the number of processors and memories in the computing device 1200.
[0192] The bus 1202 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Fig.12 The bus 1202 may include a path for transmitting information between various components of the computing device 1200 (eg, the memory 1206, the processor 1204, and the communication interface 1208).
[0193] The processor 1204 may include any one or more of a central processing unit (CPU), a graphics processing unit (GPU), a microprocessor (MP), or a digital signal processor (DSP).
[0194] The memory 1206 may include a volatile memory, such as a random access memory (RAM). The processor 1204 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD), or a solid state drive (SSD).
[0195] The memory 1206 stores executable program codes, and the processor 1204 executes the executable program codes to respectively implement the functions of the aforementioned transceiver module and the processing module, thereby implementing the aforementioned image file generation method or image processing method. That is, the memory 1206 stores instructions for executing the aforementioned image file generation method or image processing method.
[0196] The communication interface 1208 uses a transceiver module such as, but not limited to, a network interface card or a transceiver to implement communication between the computing device 1200 and other devices or communication networks.
[0197] The embodiment of the present application also provides a computing device cluster. The computing device cluster includes at least one computing device. The computing device can be a server, such as a central server, an edge server, or a local server in a local data center. In some embodiments, the computing device can also be a terminal device such as a desktop computer, a laptop computer, or a smart phone.
[0198] like Fig.13As shown, the computing device cluster includes at least one computing device 1200. The memory 1206 in one or more computing devices 1200 in the computing device cluster may store the same instructions for executing the above-mentioned image file generation method or image processing method.
[0199] In some possible implementations, the memory 1206 of one or more computing devices 1200 in the computing device cluster may also store partial instructions for executing the above-mentioned image file generation method or image processing method. In other words, the combination of one or more computing devices 1200 may jointly execute instructions for executing the above-mentioned image file generation method or image processing method.
[0200] It should be noted that the memory 1206 in different computing devices 1200 in the computing device cluster may store different instructions, which are respectively used to execute part of the functions of the above-mentioned image file generation method or image processing method. That is, the instructions stored in the memory 1206 in different computing devices 1200 may implement the functions of one or more modules of the processing module and the transceiver module.
[0201] In some possible implementations, one or more computing devices in the computing device cluster may be connected via a network, which may be a wide area network or a local area network. Fig.14 A possible implementation is shown. Fig.14 As shown, two computing devices 1200A and 1200B are connected via a network. Specifically, they are connected to the network via a communication interface in each computing device. In this type of possible implementation, the memory 1206 in the computing device 1200A stores instructions for executing the functions of the task trigger module.
[0202] It should be understood that Fig.14 The functions of the computing device 1200A shown in FIG. 1200A may also be completed by multiple computing devices 1200. Similarly, the functions of the computing device 1200B may also be completed by multiple computing devices 1200.
[0203] An embodiment of the present application also provides a chip, which includes a processor and a data interface. The processor reads instructions stored in a memory through the data interface to execute the above-mentioned image file generation method or image processing method.
[0204] The embodiment of the present application also provides a computer program product including instructions. The computer program product may be software or a program product including instructions that can be run on a computing device or stored in any available medium. When the computer program product is run on at least one computing device, the at least one computing device executes the above-mentioned image file generation method or image processing method.
[0205] The embodiment of the present application also provides a computer-readable storage medium. The computer-readable storage medium can be any available medium that can be stored by a computing device or a data storage device such as a data center containing one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk). The computer-readable storage medium includes instructions that instruct the computing device to execute the above-mentioned image file generation method or image processing method.
[0206] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0207] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0208] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0209] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0210] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0211] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which 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 method for generating an image file, characterized in that: The method comprises: Acquire data of a first image, wherein the data of the first image includes map data; Slicing the first image to generate a plurality of tiles; Generate a first image file according to the plurality of tiles, the first image file comprising: A first data structure area, used to store a file header of the first image file, wherein the file header is used to indicate a file type of the first image file; A second data structure area is used to store data of a second image, wherein the data of the second image includes data of the plurality of tiles; The third data structure area is used to store the offsets of the multiple tiles, and the offsets of the multiple tiles are used to indicate the storage location of the data of the multiple tiles in the second data structure area.
2. The method according to claim 1, characterized in that The method further comprises: The plurality of tiles are resampled to generate multi-level tiles, and the second image includes the multi-level tiles.
3. The method according to claim 1 or 2, characterized in that: For multiple homogeneous tiles among the multiple tiles, the data of the second image in the second data structure area includes data of feature tiles among the multiple homogeneous tiles, and the homogeneous tiles are tiles whose pixel proportion identical to that of the feature tiles reaches a predetermined threshold.
4. The method according to claim 3, characterized in that The offsets corresponding to the multiple homogeneous tiles stored in the third data structure area are the same, and the same offsets of the multiple homogeneous tiles indicate the storage position of the feature tile in the second data structure area.
5. The method according to any one of claims 1 to 4, characterized in that The third data structure area in the first image file is adjacent to the first data structure area.
6. The method according to any one of claims 1 to 5, characterized in that The third data structure area includes a tag, and the tag includes an index code of each tile in the second image and the offset.
7. The method according to any one of claims 1 to 6, characterized in that The second image also includes the first image and / or a first thumbnail, and the first thumbnail includes an image obtained by resampling the first image; The third data structure area also includes an offset corresponding to the first image and / or the first thumbnail.
8. The method according to claim 7, characterized in that The first thumbnail includes a multi-level thumbnail, and the multi-level thumbnail includes a plurality of images with different resolutions obtained by performing multiple resampling on the first image.
9. The method according to any one of claims 1 to 8, characterized in that The first image file also includes: A fourth data structure area, the fourth data structure area is used to store specific attributes of the multiple tiles, and the size of the specific attribute is greater than a certain threshold.
10. The method according to any one of claims 1 to 9, characterized in that The method further comprises: defining a projected coordinate system for the first image; defining a coordinate reference hierarchy for the first image based on the projected coordinate system; The first image is segmented according to the coordinate reference level to obtain the plurality of tiles.
11. A method for image processing, characterized in that: The method comprises: Receiving a first data request from a terminal device, the first data request is used to request data of a first target image in a first image file, the first image file includes a second data structure area, the second data structure area includes data of a second image, the second image includes a plurality of tiles, the plurality of tiles include an image obtained by segmenting the first image, wherein the first target image includes one or more tiles in the second image; Acquire data of the first target image in the first image file according to the first data request; Sending data of the first target image to the terminal device.
12. The method according to claim 11, characterized in that The second image includes multiple levels of tiles, and the multiple levels of tiles include multiple levels of tiles obtained by performing multiple resampling on the multiple tiles. Furthermore, the first target image specifically includes one or more tiles of the same level among the multi-level tiles.
13. The method according to claim 11 or 12, characterized in that: The first image file also includes a third data structure area, which is used to store offsets of data of multiple tiles in the second image, and the offsets are used to indicate storage locations of the data of the tiles in the second image in the second data structure area.
14. The method according to claim 13, characterized in that For multiple homogeneous tiles among the multiple tiles, the data of the second image in the second data structure area includes data of feature tiles among the multiple homogeneous tiles, and the homogeneous tiles are tiles whose pixel proportion identical to that of the feature tiles reaches a predetermined threshold.
15. The method according to claim 14, characterized in that The offsets corresponding to the multiple homogeneous tiles stored in the third data structure area are the same, and the same offsets of the multiple homogeneous tiles indicate the storage position of the feature tile in the second data structure area.
16. The method according to any one of claims 13 to 15, characterized in that: Acquiring data of the first target image in the first image file according to the first data request includes: determining the first target image according to the first data request; Determining, according to the first target image, a first tile corresponding to the first target image; Obtain the first offset, where the first offset is the offset of the first tile; According to the first offset, obtaining data of the first tile, The sending of the data of the first target image to the terminal device comprises: Send the data of the first tile to the terminal device.
17. The method according to any one of claims 13 to 15, characterized in that: The first data request includes a first offset, where the first offset is an offset of a first tile corresponding to the first target image. Acquiring data of the first target image in the first image file according to the first data request includes: According to the first offset, obtaining the first tile, The sending of the data of the first target image to the terminal device comprises: Send the data of the first tile to the terminal device.
18. The method according to any one of claims 13 to 17, characterized in that: Before receiving the first data request from the terminal device, the method further includes: receiving a second data request from the terminal device, wherein the second data request is used to request the third data structure area of the first image file; Acquire the third data structure area according to the second data request; The third data structure area is sent to the terminal device.
19. The method according to any one of claims 13 to 18, characterized in that: The first image file further includes a first data structure area, the first data structure area includes a file header of the first image file, the file header is used to indicate a file type, and the third data structure area is adjacent to the first data structure area in the first image file.
20. The method according to any one of claims 13 to 19, characterized in that The third data structure area includes a tag, and the tag includes an index code of each tile in the second image and the offset.
21. The method according to any one of claims 13 to 20, characterized in that The second image also includes the first image and / or a first thumbnail, and the first thumbnail includes an image obtained by resampling the first image; The third data structure area also includes an offset corresponding to the data of the first image and / or the data of the first thumbnail.
22. The method according to claim 21, characterized in that The first thumbnail includes a multi-level thumbnail, and the multi-level thumbnail includes a plurality of images with different resolutions obtained by performing multiple resampling on the first image.
23. The method according to any one of claims 11 to 22, characterized in that: The first image file also includes: A fourth data structure area, the fourth data structure area is used to store specific attributes of the multiple tiles, and the size of the specific attribute is greater than a certain threshold.
24. A method of image processing, characterized in that: The method comprises: Sending a first data request to a server, the first data request being used to request data of a first target image in a first image file, the first image file comprising a second data structure area, the second data structure area comprising data of a second image, the second image comprising a plurality of tiles, the plurality of tiles comprising an image obtained by segmenting the first image, wherein the first target image comprises one or more tiles in the second image; receiving data of the first target image from the server; The first target image is presented according to the data of the first target image.
25. The method according to claim 24, characterized in that The second image includes multiple levels of tiles, and the multiple levels of tiles include multiple levels of tiles obtained by performing multiple resampling on the multiple tiles. Furthermore, the first target image specifically includes one or more tiles of the same level among the multi-level tiles.
26. The method according to claim 24 or 25, characterized in that The first image file further includes a third data structure area, where the third data structure area is used to store offsets of the data of the plurality of tiles, and the offsets are used to indicate storage locations of the data of the plurality of tiles in the second data structure area.
27. The method according to claim 26, characterized in that For multiple homogeneous tiles among the multiple tiles, the data of the second image in the second data structure area includes data of feature tiles among the multiple homogeneous tiles, and the homogeneous tiles are tiles whose pixel proportion that is the same as that of the feature tiles reaches a predetermined threshold.
28. The method according to claim 27, characterized in that The offsets corresponding to the multiple homogeneous tiles stored in the third data structure area are the same, and the same offsets of the multiple homogeneous tiles indicate the storage position of the feature tile in the second data structure area.
29. The method according to any one of claims 26 to 28, characterized in that The first data request includes a first offset, where the first offset is an offset of a first tile, and the first tile includes one or more tiles corresponding to the first target image.
30. The method according to claim 29, characterized in that Before sending the first data request to the server, the method further includes: Sending a second data request to the server, where the second data request is used to request the third data structure area of the first image file; receiving the third data structure area from the server; The first offset is determined according to the third data structure area.
31. The method according to any one of claims 24 to 30, characterized in that Before sending the first data request to the server, the method further includes: Obtaining an image access request, where the image access request is used to request display of the first target image in the first image; The first target image is determined according to the image access request.
32. The method according to claim 31, characterized in that The determining the first target image comprises: Determining the level and pixel coordinates of the first target image according to the image access request; The first target image is determined according to the level and pixel coordinates of the first target image.
33. The method according to any one of claims 29-30, characterized in that The third data structure area includes a tag, wherein the tag includes an index code of each tile in the second image and the offset, The determining the first offset according to the third data structure area comprises: Obtaining the index code of the tile of the first target image; The first offset is determined by searching in the third data structure area according to the index code of the tile of the first target image.
34. The method according to any one of claims 24 to 33, characterized in that The first image file further includes a first data structure area, the first data structure area includes a file header of the first image file, the file header is used to indicate a file type, and the third data structure area is adjacent to the first data structure area in the first image file.
35. The method according to any one of claims 30 to 33, characterized in that The second image data in the second data structure area also includes data of the first image and / or data of a first thumbnail, and the first thumbnail includes an image obtained by resampling based on the first image data; The third data structure area also includes an offset corresponding to the data of the first image and / or the data of the first thumbnail.
36. The method according to claim 35, characterized in that The first thumbnail includes a multi-level thumbnail, and the multi-level thumbnail includes a plurality of images with different resolutions obtained by performing multiple resampling on the first image.
37. An image file generating device, characterized in that: The device comprises: A transceiver module, configured to receive data of a first image, wherein the data of the first image includes map data; A processing module, configured to segment the first image to generate a plurality of tiles; The processing module is further configured to generate a first image file according to the plurality of tiles, wherein the first image file includes: A first data structure area, used for storing a file header of the image file, wherein the file header is used for indicating a file type; A second data structure area is used to store data of a second image, wherein the data of the second image includes data of the plurality of tiles; The third data structure area is used to store the offsets of the multiple tiles in the second image data, and the offsets of the multiple tiles are used to indicate the storage locations of the data of the multiple tiles in the second image data.
38. An image processing device, characterized in that: The device comprises: a transceiver module, configured to receive a first data request from a terminal device, wherein the first data request is used to request data of a first target image in a first image file, wherein the first image file includes a second data structure area, wherein the second data structure area includes data of a second image, wherein the data of the second image includes data of a plurality of tiles, wherein the plurality of tiles includes an image obtained by segmenting the first image, wherein the first target image includes one or more tiles in the second image; A processing module, configured to obtain data of the first target image in the first image file according to the first data request; The transceiver module is further used to send data of the first target image to the terminal device.
39. An image processing device, characterized in that: The device comprises: A transceiver module is used to send a first data request to a server, wherein the first data request is used to request data of a first target image in a first image file, wherein the first image file includes a second data structure area, wherein the second data structure area includes data of a second image, wherein the second image includes a plurality of tiles, wherein the plurality of tiles include an image obtained by segmentation based on the first image data, wherein the first target image includes one or more tiles in the second image; The transceiver module is also used to receive data of the first target image from the server; A processing module is used to present the first target image according to the data of the first target image.
40. A computing device cluster, characterized in that: comprising at least one computing device, each computing device comprising a processor and a memory; The processor of the at least one computing device is used to execute instructions stored in the memory of the at least one computing device, so that the computing device cluster executes the method as described in any one of claims 1-10 or 11-23 or 24-36.
41. A computer-readable storage medium, characterized in that The method comprises computer program instructions, which, when executed by a computing device cluster, cause the computing device cluster to perform the method as claimed in any one of claims 1-10, 11-23 or 24-36.
42. A computer program product comprising instructions, characterized in that When the instructions are executed by a computing device cluster, the computing device cluster executes the method as described in any one of claims 1-10, 11-23, or 24-36.
43. A cloud-side device, characterized in that: It includes at least one processor, which is coupled to at least one memory, and the at least one processor is used to execute a computer program or instruction stored in the at least one memory, so that the cloud-side device executes the method as described in any one of claims 1-10 or 11-23.
44. A terminal side device, characterized in that: The device comprises at least one processor coupled to at least one memory, wherein the at least one processor is used to execute a computer program or instruction stored in the at least one memory, so that the energy storage device executes the method as described in any one of claims 24-36.
45. A terminal-cloud collaborative system, characterized in that: It includes a cloud-side device as described in claim 43 and an end-side device as described in claim 44.
Citation Information
Cited By
In-situ streaming replacement compression and recovery method and device in GeoTIFF image block fixing slot, and storage medium
CN122156332A
A method, device and storage medium for in-situ streaming replacement compression and recovery of GeoTIFF image tiles in fixed slots
CN122156332B
Image file generation method and apparatus, and image processing method and apparatus
EP4685663A1
Image file generation method and apparatus, and image processing method and apparatus
WO2024212707A1
