Raster image processing method, device, equipment and medium
By using technologies such as edge pixel merging, boundary fusion and central pixel merging in remote sensing image processing, the problems of image block boundary artifacts and seams in remote sensing image processing are solved, and the continuity and visual effect of the image are improved.
Patent Information
- Application Number
- CN202411478118.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-04-04
AI Technical Summary
In the large-scale raster data processing of remote sensing images, artifacts and seams are easily introduced at the boundaries of adjacent image blocks, resulting in poor continuity and visual effects of the image.
Through a raster image processing method, it includes reading and initializing a raster image, dividing it into multiple image blocks, and eliminating artifacts and seams of image block boundaries through steps such as edge pixel merging, boundary fusion and central pixel merging, improving image continuity and visual effects.
Effectively eliminate artifacts and seams on the boundaries of image blocks, improve the continuity and visual effects of remote sensing images, and is suitable for processing large-scale remote sensing image data.
Smart Images

Figure CN119762521A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of remote sensing image processing, and in particular to a raster image processing method, device, equipment and medium. Background Art
[0002] Currently, in the large-scale raster data processing of remote sensing images, it is usually necessary to divide the impact into smaller image blocks for processing in order to effectively manage memory and resource technologies. However, in the block processing of existing technologies, artifacts and seams are easily introduced at the boundaries of adjacent blocks, resulting in poor continuity and visual effects of remote sensing images. Summary of the invention
[0003] The present invention aims to solve at least one of the technical problems existing in the prior art. To this end, the present invention provides a raster image processing method, device, equipment and medium, which can improve the continuity and visual effect of remote sensing images.
[0004] In a first aspect, an embodiment of the present invention provides a raster image processing method, comprising:
[0005] Reading a raster image, performing an initialization operation on the raster image, and obtaining image information of the raster image;
[0006] Dividing the image information into a plurality of first image blocks according to a preset image block size, traversing the plurality of first image blocks, acquiring first pixel data of each of the first image blocks, and merging edge pixels of the plurality of first image blocks according to the first pixel data until all the first image blocks are merged to obtain a first result image;
[0007] Traversing the first result image, obtaining a plurality of second image blocks of the first result image, obtaining a first pixel value and a second pixel value of the second image block, and performing boundary fusion on the plurality of second image blocks according to the first pixel value and the second pixel value to obtain a second result image;
[0008] The second result image is read in blocks to obtain a plurality of third image blocks of the second result image, a pixel matrix of the plurality of third image blocks is obtained, intersection traces of the plurality of third pixel blocks are determined according to the pixel matrix, and central pixel merging of the third image blocks is performed according to the intersection traces to obtain a third result image;
[0009] The third result image is read in blocks to obtain a fourth image block of the third result image, and the edge pixels of the fourth image block are merged according to preset block traces to obtain a final result image.
[0010] In some embodiments of the present invention, the step of performing edge pixel merging on a plurality of the first image blocks according to the first pixel data includes:
[0011] determining first boundary information of the first image block, and dividing the first image block into a first image unit and a second image unit according to the first boundary information;
[0012] Determine, according to the first boundary information, a first left side, a first right side, a first top side, and a first bottom side of the first image unit, and a second left side, a second right side, a second top side, and a second bottom side of a second image unit adjacent to the first image unit;
[0013] Acquire first pixel information of the first lower side and second pixel information of the second upper side, and determine an edge trace index between the first image unit and the second image unit according to the first pixel information and the second pixel information;
[0014] Determine multiple second image units that intersect with the first image unit according to the edge trace index, obtain a first pixel value of the first image unit and a second pixel value of the second image unit, adjust the first pixel value to be equal to the second pixel value according to a first algorithm, complete the merging of edge pixels of the first image unit and the second image unit, and complete the fusion of all first image blocks.
[0015] In some embodiments of the present invention, performing boundary fusion on a plurality of second image blocks according to the first pixel value and the second pixel value includes:
[0016] Acquire second pixel data of the second image block;
[0017] Determine, according to the second pixel data, a third pixel value on the right side and a fourth pixel value on the lower side of a third image unit and a fourth image unit of the first result image;
[0018] Determine boundary areas of a plurality of the second image blocks, and obtain difference information between the third pixel value and the fourth pixel value;
[0019] Detect first continuous non-zero pixels of the adjacent second image block in the boundary area according to the difference information, and determine a first continuous non-zero pixel area of the boundary area according to the first continuous non-zero pixels.
[0020] In some embodiments of the present invention, the third image block performs central pixel merging according to the cross trace, including:
[0021] Acquire adjacent unit information of the third image block, wherein the adjacent unit information at least includes a third image unit, a fourth image unit, a fifth image unit, and a sixth image unit;
[0022] Determine a connection center point of the third image unit, the fourth image unit, the fifth image unit, and the sixth image unit, and obtain the center pixel of the connection center point.
[0023] In some embodiments of the present invention, determining the edge trace index between the first image unit and the second image unit according to the first pixel information and the second pixel information includes:
[0024] Acquire a first boundary matrix of the first image unit and a second boundary matrix of the second image unit;
[0025] The first boundary matrix and the second boundary matrix construct a non-zero pixel set according to the first boundary information;
[0026] Merging the first boundary matrix and the second boundary matrix to obtain a matrix array;
[0027] The matrix array detects the non-zero pixel set according to a preset first function to determine whether there is a non-zero element sequence in the non-zero pixel set;
[0028] When there is a non-zero element sequence in the non-zero pixel set, a length threshold of the non-zero element sequence is obtained, and the matrix array is traversed according to the length threshold to obtain the edge trace index.
[0029] In some embodiments of the present invention, after obtaining the central pixel of the connection center point, the method further includes:
[0030] Determine, according to the central pixel, a first row and column pixel value of the third image unit, a second row and column pixel value of the fourth image unit, a third row and column pixel value of the fifth image unit, and a fourth row and column pixel value of the sixth image unit;
[0031] Determine whether the first row and column pixel values are equal to the second row and column pixel values;
[0032] When the first row and column pixel value is not equal to the second row and column pixel value, finding a fifth row and column pixel value in the fourth image unit that is adjacent to the second row and column pixel value and is equal to the second row and column pixel value;
[0033] Determine whether the third row and column pixel value is equal to the fourth row and column pixel value;
[0034] When the third row and column pixel value is not equal to the fourth row and column pixel value, finding a sixth row and column pixel value adjacent to the third row and column pixel value and equal to the third row and column pixel value in the sixth image unit;
[0035] The pixel value of the sixth row and column is adjusted to be equal to the pixel value of the fourth row and column, thereby completing the merging of all the central pixels.
[0036] In a second aspect, an embodiment of the present invention provides a raster image processing device, comprising at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions executable by the at least one control processor, and the instructions are executed by the at least one control processor so that the at least one control processor can execute the raster image processing method described in the first aspect above.
[0037] In a third aspect, an embodiment of the present invention provides an electronic device, comprising the raster image processing device as described in the second aspect above.
[0038] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the raster image processing method as described in the first aspect above.
[0039] The raster image processing method according to the embodiment of the present invention has at least the following beneficial effects:
[0040] Read the raster image, perform initialization operation on the raster image, and obtain image information of the raster image; divide the image information into multiple first image blocks according to a preset image block size, traverse the multiple first image blocks, obtain the first pixel data of each first image block, merge the edge pixels of the multiple first image blocks according to the first pixel data, until all the first image blocks are merged, and obtain the first result image; traverse the first result image, obtain multiple second image blocks of the first result image, obtain the first pixel value and the second pixel value of the second image block, and perform boundary fusion on the multiple second image blocks according to the first pixel value and the second pixel value to obtain the second result image; read the second result image in blocks, obtain multiple third image blocks of the second result image, obtain the pixel matrix of the multiple third image blocks, determine the intersection traces of the multiple third pixel blocks according to the pixel matrix, and merge the center pixels of the third image block according to the intersection trace to obtain the third result image; read the third result image in blocks, obtain the fourth image block of the third result image, and merge the edge pixels of the fourth image block according to the preset block trace to obtain the final result image. According to the technical solution of this embodiment, the continuity and visual effect of the remote sensing image can be improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 is a flow chart of a raster image processing method provided by an embodiment of the present invention;
[0042] Figure 2 is a flow chart of performing edge pixel merging on a plurality of first image blocks according to first pixel data provided by the present invention;
[0043] Figure 3 is a flow chart of performing boundary fusion on a plurality of second image blocks according to a first pixel value and a second pixel value provided by the present invention;
[0044] Figure 4 is a flow chart of performing central pixel merging according to the cross traces on the third image block provided by the present invention;
[0045] Figure 5 The present invention provides a flowchart for determining an edge trace index between a first image unit and a second image unit according to first pixel information and second pixel information;
[0046] Figure 6 This is a flow chart after obtaining the central pixel of the connection center point provided by the present invention;
[0047] Figure 7 is a schematic diagram of block center pixel merging provided by the present invention;
[0048] Figure 8 It is a structural diagram of a raster image processing device provided by another embodiment of the present invention. DETAILED DESCRIPTION
[0049] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0050] In the description of the present invention, it should be understood that descriptions involving orientations, such as up, down, front, back, left, right, etc., and orientations or positional relationships indicated are based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as a limitation on the present invention.
[0051] In the description of the present invention, "several" means one or more, "more" means more than two, "greater than", "less than", "exceed" etc. are understood as not including the number itself, and "above", "below", "within" etc. are understood as including the number itself. If there is a description of "first" or "second", it is only used for the purpose of distinguishing the technical features, and cannot be understood as indicating or implying the relative importance or implicitly indicating the number of the indicated technical features or implicitly indicating the order of the indicated technical features.
[0052] In the description of the present invention, unless otherwise clearly defined, terms such as setting, installing, connecting, etc. should be understood in a broad sense, and technicians in the relevant technical field can reasonably determine the specific meanings of the above terms in the present invention based on the specific content of the technical solution.
[0053] The embodiment of the present invention provides a raster image processing method, comprising: reading a raster image, performing an initialization operation on the raster image, and obtaining image information of the raster image; dividing the image information into a plurality of first image blocks according to a preset image block size, traversing the plurality of first image blocks, obtaining first pixel data of each first image block, and performing edge pixel merging on the plurality of first image blocks according to the first pixel data until all the first image blocks are merged to obtain a first result image; traversing the first result image, obtaining a plurality of second image blocks of the first result image, obtaining a first pixel value and a second pixel value of the second image block, and performing boundary fusion on the plurality of second image blocks according to the first pixel value and the second pixel value to obtain a second result image; reading the second result image in blocks, obtaining a plurality of third image blocks of the second result image, obtaining a pixel matrix of the plurality of third image blocks, determining intersection traces of the plurality of third pixel blocks according to the pixel matrix, and performing center pixel merging on the third image block according to the intersection trace to obtain a third result image; reading the third result image in blocks, obtaining a fourth image block of the third result image, and performing edge pixel merging on the fourth image block according to a preset block division trace to obtain a final result image. According to the technical solution of this embodiment, the continuity and visual effect of remote sensing images can be improved.
[0054] The control method of the embodiment of the present invention is further described below based on the accompanying drawings.
[0055] Reference Figure 1 , Figure 1 A flowchart of a raster image processing method provided by an embodiment of the present invention, the raster image processing method includes but is not limited to the following steps:
[0056] Step S11, reading a raster image, performing an initialization operation on the raster image, and obtaining image information of the raster image;
[0057] It should be noted that the raster image in the remote sensing image is read and initialized to obtain basic information of the raster image, including but not limited to the number of rows, the number of columns, geographic transformation parameters and projection information.
[0058] Step S12, traversing the image information, dividing the image information into a plurality of first image blocks according to a preset image block size, obtaining first pixel data of each first image block, and merging edge pixels of the plurality of first image blocks according to the first pixel data until all the first image blocks are merged to obtain a first result image;
[0059] It should be noted that, first, the image information is traversed, and the raster image is divided into blocks according to the set block size to obtain multiple first image blocks. In order to process the boundaries of the first image blocks, especially the boundaries in the four directions of up, down, left and right, for the boundary area of each first image block, the first continuous non-zero pixels of the adjacent image blocks to the first image block on the boundary are detected, and the first continuous non-zero pixel values are obtained. By comparing the differences in the adjacent boundary pixel values between different first image blocks, the first continuous non-zero pixel area is identified. For the first continuous non-zero vector area, the flood filling estimation method is used to expand and merge the pixel values to eliminate the first block division traces, and then the first result image is obtained.
[0060] Step S13, traversing the first result image, obtaining multiple second image blocks of the first result image, obtaining first pixel values and second pixel values of the second image blocks, and performing boundary fusion on the multiple second image blocks according to the first pixel values and the second pixel values to obtain a second result image;
[0061] It should be noted that the first result image is traversed, the first result image is divided into blocks according to the set block size to obtain multiple second image blocks, the pixel data of each second image block is read, and the second continuous non-zero pixels in the boundary area between each second image block and the lower and right image blocks of its adjacent image blocks are obtained. By comparing the first pixel value and the second pixel value, the second continuous non-zero pixel area is identified to ensure that the second continuous non-zero pixel area can be correctly processed when the multiple second image blocks are subjected to boundary fusion, and the flood filling algorithm is used for fusion processing to eliminate the block traces for the second time. Repeat the above steps until all blocks are processed to obtain the second result image.
[0062] Step S14, reading the second result image in blocks, obtaining a plurality of third image blocks of the second result image, obtaining a pixel matrix of the plurality of third image blocks, determining intersection traces of the plurality of third pixel blocks according to the pixel matrix, merging center pixels of the third image blocks according to the intersection traces, and obtaining a third result image;
[0063] It should be noted that the second result image is traversed and read according to the set block size and step size to obtain multiple third image blocks of the second result image, and the central area between the third image blocks is detected. The central area is a 2*2 pixel matrix, and the pixel matrix is used to determine whether there are cross traces. The cross traces are used to check whether the four center points of the central area between each third image block are equal. When the four center points are equal, the third image block is merged with the central pixels according to the cross traces, and the corresponding pixel values in the third image block are updated to eliminate the cross traces in the central area of the third image block until all third image blocks are processed.
[0064] Step S15, reading the third result image in blocks to obtain a fourth image block of the third result image, merging edge pixels of the fourth image block according to preset block traces to obtain a final result image.
[0065] It should be noted that the third result image is processed in blocks, the third result image is divided into multiple fourth image blocks, the pixel data of each fourth image block is read, the upper, lower, left and right four boundaries of each fourth image block are determined, and for the boundary area of each fourth image block, the fourth image block and the third continuous non-zero pixels adjacent to the fourth image block are detected, and the third continuous non-zero pixel area is identified by comparing the values of the third continuous non-zero pixels of two adjacent fourth image blocks, so as to ensure that the third continuous non-zero pixel area can be correctly processed during boundary fusion, and the flood filling algorithm is used for fusion processing until all fourth image blocks are processed to obtain the final result image.
[0066] It should be noted that this embodiment can effectively eliminate boundary artifacts and ensure smooth transition between adjacent image blocks through detailed image block boundary processing and fusion strategy, and is suitable for processing large-scale remote sensing image data.
[0067] In addition, in one embodiment, referring to Figure 2 ,exist Figure 1 Step S11 of the illustrated embodiment also includes but is not limited to the following steps:
[0068] Step S21, determining first boundary information of a first image block, and dividing the first image block into a first image unit and a second image unit according to the first boundary information;
[0069] Step S22, determining a first left side, a first right side, a first top side, and a first bottom side of the first image unit, and a second left side, a second right side, a second top side, and a second bottom side of a second image unit adjacent to the first image unit according to the first boundary information;
[0070] Step S23, obtaining first pixel information of the first lower side and second pixel information of the second upper side, and determining an edge trace index between the first image unit and the second image unit according to the first pixel information and the second pixel information;
[0071] Step S24, determining multiple second image units intersecting with the first image unit according to the edge trace index, obtaining the first pixel value of the first image unit and the second pixel value of the second image unit, adjusting the first pixel value to be equal to the second pixel value according to the first algorithm, completing the merging of edge pixels of the first image unit and the second image unit, until the fusion of all first image blocks is completed.
[0072] It should be noted that the segmented raster image data is divided into blocks of 1024*1024, and the first image block is traversed in the order of rows and columns to determine the first boundary information of the first image block, and the first image block is divided into a first image unit and a second image unit according to the first boundary information. The size of the first image unit and the second image unit are both 1024*1024. In each traversal, the current first image unit and the second image unit adjacent to the current first image unit above, below, left and right are read. First, edge pixel merging is performed on the first image unit and the second image unit on the right side of the first image unit, the first lower side of the first image unit and the second upper side of the second image unit on the right side are checked, the first pixel information of the first lower side and the second pixel information of the second upper side are obtained, the difference between the first pixel information and the second pixel information is compared, so as to obtain the edge trace index between the first image unit and the second image unit on the right side, and the second image unit where the first image unit and the edge trace index intersect is found by using the edge trace index using a flood filling algorithm (first algorithm), and the first pixel value of the first image unit and the second pixel value of the second image unit are obtained, and the first pixel value of the first image unit is controlled to be equal to the second pixel value of the adjacent right second image unit, and the edge pixel merging of the first image unit and the second image unit is completed. When the first image unit and the adjacent right second image unit complete the pixel merging, the merging of the upper second image unit, the left second image unit and the lower second image unit is completed at one time, that is, one cycle is completed, and the edge pixel merging of the next first image unit is started until all first image units complete the four-side edge pixel merging, and the merging result is saved as a first result image, wherein the first result image can be saved in the form of a temporary file.
[0073] In addition, in one embodiment, referring to Figure 3 ,exist Figure 1 Step S13 of the illustrated embodiment also includes but is not limited to the following steps:
[0074] Step S31, obtaining second pixel data of a second image block;
[0075] Step S32, determining the third pixel value on the right side and the fourth pixel value on the lower side of the third image unit and the fourth image unit of the first result image according to the second pixel data;
[0076] Step S33, determining the boundary areas of the plurality of second image blocks, and obtaining difference information between the third pixel value and the fourth pixel value;
[0077] Step S34 , detecting first continuous non-zero pixels in the boundary area of the adjacent second image blocks according to the difference information, and determining a first continuous non-zero pixel area in the boundary area according to the first continuous non-zero pixels.
[0078] It should be noted that the first result image is read, the first result image is divided into blocks according to 1024*1024, a plurality of second image blocks are obtained, and all the second image blocks are traversed in the order of rows and columns, the size of each second image block is 1024*1024, and in each traversal, the second pixel data of the second image block is obtained, and the third image unit and the fourth image unit of the first result image are determined according to the second pixel data. The boundary area of the plurality of second image blocks is determined, and for each second image block and the continuous non-zero pixels of the lower and right blocks adjacent to the second image block in the boundary area, the first continuous non-zero pixels are identified by comparing the difference in the values of the adjacent lower and right boundary pixels, and the first continuous non-zero pixel area is identified according to the first continuous non-zero pixels, and the flood filling algorithm is used for fusion processing, and this step is repeated until all the second image blocks are processed.
[0079] In addition, in one embodiment, referring to Figure 4 ,exist Figure 1 Step S14 of the illustrated embodiment also includes but is not limited to the following steps:
[0080] Step S41, obtaining adjacent unit information of the third image block, wherein the adjacent unit information at least includes the third image unit, the fourth image unit, the fifth image unit and the sixth image unit;
[0081] The resistor S42 is changed to determine the connection center point of the third image unit, the fourth image unit, the fifth image unit and the sixth image unit, and obtain the center pixel of the connection center point.
[0082] It should be noted that the second result image is read, and the second result image is divided into blocks according to 2048*2048 to obtain multiple third image blocks, and the third image blocks are traversed in the order of rows and columns, and the size of each third image block is 2048*2048. In each traversal, the third image block is divided into a third image unit, a fourth image unit, a fifth image unit, and a sixth image unit. By determining the central area of the third image unit, the fourth image unit, the fifth image unit, and the sixth image unit, the central area is usually a 2*2 pixel matrix, which is used to determine whether there are cross traces between the multiple image units, and by obtaining the connection center point of the four image units and obtaining multiple center pixels of the multiple connection points, it is confirmed whether the multiple center pixels are equal. If they are not equal, the multiple center pixels are adjusted to equal values. After adjusting the unequal center points to equal values, the corresponding pixel values in the corresponding blocks are updated.
[0083] In addition, in one embodiment, referring to Figure 5 ,exist Figure 2 Step S23 of the illustrated embodiment also includes but is not limited to the following steps:
[0084] Step S51, obtaining a first boundary matrix of a first image unit and a second boundary matrix of a second image unit;
[0085] Step S52, the first boundary matrix and the second boundary matrix construct a non-zero pixel set according to the first boundary information;
[0086] Step S53, merging the first boundary matrix and the second boundary matrix to obtain a matrix array;
[0087] Step S54, the matrix array detects the non-zero pixel set according to a preset first function to determine whether there is a non-zero element sequence in the non-zero pixel set;
[0088] Step S55, when there is a non-zero element sequence in the non-zero pixel set, obtain a length threshold of the non-zero element sequence, and traverse the matrix array according to the length threshold to obtain an edge trace index.
[0089] It should be noted that, specifically, let the remote sensing image be I, whose size is H×β pixels. We divide it into blocks of B×B size, where B is the block size.
[0090] Assume B current is the first image unit, B other is the second image unit. At the boundary, the boundary matrix is defined as E current and E other , detect continuous non-zero pixel areas. Define the non-zero pixel set:
[0091] Z={q|Ecurrent (q)≠0 and E other (q)≠0};
[0092] Specifically, for the vertical direction (up and down), if the direction is "up", then:
[0093] E current =B current [0,:];
[0094] E other =B other [-1,:];
[0095] If the direction is "down", then:
[0096] E current =B current [-1,:];
[0097] E other =B other [0,:];
[0098] For the horizontal direction (left and right): If the direction is "left", then:
[0099] E current =B current [:,0];
[0100] E other =B other [:,-1];
[0101] If the direction is "right", then:
[0102] E current =B current [:,-1];
[0103] E other =B other [:,0];
[0104] MergeE current and E other into a new array E.
[0105] E=E current +E other
[0106] We define a function f(E, k) to detect whether there is a continuous sequence of non-zero elements of at least length k in the set E. Traverse the array E and get the index of the continuous non-zero elements.
[0107]
[0108] In addition, in one embodiment, referring to Figure 6 ,exist Figure 4 After step S42 of the illustrated embodiment, the following steps are also included but not limited to:
[0109] Step S61, determining the first row and column pixel value of the third image unit, the second row and column pixel value of the fourth image unit, the third row and column pixel value of the fifth image unit, and the fourth row and column pixel value of the sixth image unit according to the central pixel;
[0110] Step S62, determining whether the pixel value of the first row and column is equal to the pixel value of the second row and column;
[0111] Step S63, when the first row and column pixel value is not equal to the second row and column pixel value, find a fifth row and column pixel value in the fourth image unit that is adjacent to the second row and column pixel value and is equal to the second row and column pixel value;
[0112] Step S64, determining whether the pixel value of the third row and column is equal to the pixel value of the fourth row and column;
[0113] Step S65, when the third row and column pixel value is not equal to the fourth row and column pixel value, find a sixth row and column pixel value that is adjacent to the third row and column pixel value and is equal to the third row and column pixel value in the sixth image unit;
[0114] Step S66, adjusting the pixel value of the sixth row and column to be equal to the pixel value of the fourth row and column, completing the merging of all central pixels.
[0115] It should be noted that, refer to Figure 7 , a is the pixel value of the last row and last column of area 1, b is the pixel value of the last row and first column of area 2, c is the pixel value of the first row and last column of area 3, and d is the pixel value of the first row and first column of area 4. Then determine whether the four pixels at the center of the block intersection are equal, and determine whether a is equal to b. If they are not equal, find pixels in area 2 that are equal to b and adjacent to pixel b, and set these pixels equal to a. At this point, the pixel merging of area 2 is completed, and similar operations are performed on areas 3 and 4. Traverse the image and repeat the above steps until all blocks are processed and the pixel merging of the center of the blocks is completed.
[0116] like Figure 8 As shown, Figure 8 : is a structural diagram of a raster image processing device provided by an embodiment of the present invention. The present invention also provides a raster image processing device, including:
[0117] The processor 801 may be implemented by a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0118] The memory 802 may be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 802 may store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 802, and the processor 801 calls and executes the raster image processing method of the embodiment of this application;
[0119] Input / output interface 803, used to implement information input and output;
[0120] The communication interface 804 is used to realize the communication interaction between the present apparatus and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);
[0121] A bus 805 that transmits information between the various components of the device (e.g., the processor 801, the memory 802, the input / output interface 803, and the communication interface 804);
[0122] The processor 801 , the memory 802 , the input / output interface 803 and the communication interface 804 are connected to each other in communication within the device via a bus 805 .
[0123] An embodiment of the present application also provides an electronic device, comprising the raster image processing device as described above.
[0124] An embodiment of the present application further provides a storage medium, which is a computer-readable storage medium and stores a computer program. When the computer program is executed by a processor, the above-mentioned raster image processing method is implemented.
[0125] As a non-transient computer-readable storage medium, the memory can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and are implemented to be located in one place, or may also be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0126] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically include computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0127] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above-mentioned implementation mode. Technical personnel familiar with the field can also make various equivalent deformations or substitutions under the shared conditions without violating the spirit of the present invention. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present invention.
Claims
1. A raster image processing method, characterized in that: include: Reading a raster image, performing an initialization operation on the raster image, and obtaining image information of the raster image; Dividing the image information into a plurality of first image blocks according to a preset image block size, traversing the plurality of first image blocks, acquiring first pixel data of each of the first image blocks, and merging edge pixels of the plurality of first image blocks according to the first pixel data until all the first image blocks are merged to obtain a first result image; Traversing the first result image, obtaining a plurality of second image blocks of the first result image, obtaining a first pixel value and a second pixel value of the second image block, and performing boundary fusion on the plurality of second image blocks according to the first pixel value and the second pixel value to obtain a second result image; The second result image is read in blocks to obtain a plurality of third image blocks of the second result image, a pixel matrix of the plurality of third image blocks is obtained, intersection traces of the plurality of third pixel blocks are determined according to the pixel matrix, and central pixel merging of the third image blocks is performed according to the intersection traces to obtain a third result image; The third result image is read in blocks to obtain a fourth image block of the third result image, and the edge pixels of the fourth image block are merged according to preset block traces to obtain a final result image.
2. The raster image processing method according to claim 1, characterized in that: The step of merging edge pixels of the plurality of first image blocks according to the first pixel data comprises: determining first boundary information of the first image block, and dividing the first image block into a first image unit and a second image unit according to the first boundary information; Determine, according to the first boundary information, a first left side, a first right side, a first top side, and a first bottom side of the first image unit, and a second left side, a second right side, a second top side, and a second bottom side of a second image unit adjacent to the first image unit; Acquire first pixel information of the first lower side and second pixel information of the second upper side, and determine an edge trace index between the first image unit and the second image unit according to the first pixel information and the second pixel information; Determine multiple second image units that intersect with the first image unit according to the edge trace index, obtain a first pixel value of the first image unit and a second pixel value of the second image unit, adjust the first pixel value to be equal to the second pixel value according to a first algorithm, complete the merging of edge pixels of the first image unit and the second image unit, and complete the fusion of all first image blocks.
3. The raster image processing method according to claim 1, characterized in that: The step of merging edge pixels of the plurality of first image blocks according to the first pixel data comprises: Acquire second pixel data of the second image block; Determine, according to the second pixel data, a first pixel value on the right side and a second pixel value on the lower side of the first image unit and the second image unit of the first result image; Determine boundary areas of a plurality of second image blocks, and obtain difference information between the first pixel value and the second pixel value; The first continuous non-zero pixels of the first image block adjacent to the boundary area are detected according to the difference information, and the first continuous non-zero pixel area of the boundary area is determined according to the first continuous non-zero pixels.
4. The raster image processing method according to claim 1, characterized in that: The third image block performs central pixel merging according to the cross trace, including: Acquire adjacent unit information of the third image block, wherein the adjacent unit information at least includes a third image unit, a fourth image unit, a fifth image unit, and a sixth image unit; Determine a connection center point of the third image unit, the fourth image unit, the fifth image unit, and the sixth image unit, and obtain the center pixel of the connection center point.
5. The raster image processing method according to claim 2, characterized in that: The step of determining an edge trace index between the first image unit and the second image unit according to the first pixel information and the second pixel information includes: Acquire a first boundary matrix of the first image unit and a second boundary matrix of the second image unit; The first boundary matrix and the second boundary matrix construct a non-zero pixel set according to the first boundary information; Merging the first boundary matrix and the second boundary matrix to obtain a matrix array; The matrix array detects the non-zero pixel set according to a preset first function to determine whether there is a non-zero element sequence in the non-zero pixel set; When there is a non-zero element sequence in the non-zero speed limit set, a length threshold of the non-zero element sequence is obtained, and the matrix array is traversed according to the length threshold to obtain the edge trace index.
6. The raster image processing method according to claim 4, characterized in that: After obtaining the central pixel of the connection center point, the method further includes: Determine, according to the central pixel, a first row and column pixel value of the third image unit, a second row and column pixel value of the fourth image unit, a third row and column pixel value of the fifth image unit, and a fourth row and column pixel value of the sixth image unit; Determine whether the first row and column pixel values are equal to the second row and column pixel values; When the first row and column pixel value is not equal to the second row and column pixel value, finding a fifth row and column pixel value in the fourth image unit that is adjacent to the second row and column pixel value and is equal to the second row and column pixel value; Determine whether the third row and column pixel value is equal to the fourth row and column pixel value; When the third row and column pixel value is not equal to the fourth row and column pixel value, finding a sixth row and column pixel value adjacent to the third row and column pixel value and equal to the third row and column pixel value in the sixth image unit; The pixel value of the sixth row and column is adjusted to be equal to the pixel value of the fourth row and column, thereby completing the merging of all the central pixels.
7. A raster image processing device, characterized in that: It includes at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor to enable the at least one control processor to execute the raster image processing method as described in any one of claims 1 to 6.
8. An electronic device, characterized in that: Includes the raster image processing device as described in claim 7.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the raster image processing method according to any one of claims 1 to 6.