Data Processing Method and System
By determining the target macroblock in the text type image and generating the target mask image, the problem of low anti-aggression in the prior art text image is solved, and stronger robustness and anti-aggression are achieved.
Patent Information
- Application Number
- CN202010271175.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-08
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2040-04-08
AI Technical Summary
When processing text-type images, existing digital watermarking technology has severely reduced its resistance to attack and is easily destroyed, resulting in difficulty in identifying and identifying.
By determining the target macroblock in the original image, determining the target resolution and target mapping of the target mask image according to the target macroblock, generating a target mask image, and modifying the target macroblock according to the target mask image, thereby embeding the target mask into the target image.
The spatial distribution characteristics of text-type image pixels are fully utilized to identify and embed images in the airspace, which improves the resistance to attack and robustness and avoids the destruction of watermarks during attack.
Smart Images

Figure CN111612683B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of electronic information technology, and particularly to a data processing method and system. Background Art
[0002] Digital watermarking technology is to directly embed some identification information, namely digital watermarks, into digital carriers or indirectly represent them, without affecting the use value of the original carrier and being not easily detected and modified again. The indirect representation may include modifying the structure of a specific area, and digital carriers include multimedia, documents, software, etc. However, it can be recognized and identified by the producer through decoding the image. Through the information hidden in the carrier, purposes such as confirming the content creator, purchaser, transmitting secret information, or judging whether the carrier has been tampered with can be achieved. Digital watermarking is an effective method for protecting information security, realizing anti-counterfeiting traceability, and copyright protection, and is an important branch and research direction in the field of information hiding technology research.
[0003] In the prior art, digital watermarks include two types: transparent and opaque. Among them, the opaque watermark can achieve the same effect as the transparent watermark without affecting the visual effect, and has strong robustness and anti-tampering ability, so it has good security.
[0004] Transparent digital watermarking algorithms mainly focus on the spatial domain and frequency domain directions. The spatial domain algorithm embeds information into the least significant pixel bits of randomly selected image points, which can ensure that the embedded watermark is invisible. Most frequency domain algorithms embed the watermark at the middle frequency end after transforming the image into the frequency domain, which also ensures the invisibility of the watermark. Among them, the frequency domain algorithm has better robustness and anti-attack ability and is adopted by most digital watermarking schemes.
[0005] However, when dealing with text-type images, the anti-attack ability of both spatial domain and frequency domain digital watermarking technologies drops severely. Compared with images with complex spectra, text-type images can still remain visually acceptable when subjected to severe non-linear attacks. For example, binarizing the text image or performing high-pass filtering and other methods can completely destroy the watermarks embedded by these two technologies, causing difficulties in recognition and identification. Summary of the Invention
[0006] Embodiments of the present disclosure provide a data processing method and system, which can solve the problem of difficult recognition when performing watermark processing on images. The technical solution is as follows:
[0007] According to the first aspect of the embodiments of the present disclosure, a data processing method is provided, which is applied to an encoding device. The method includes:
[0008] Obtain an original image and a target macroblock in the original image, where the target macroblock includes at least one high-gradient pixel;
[0009] Based on the target macroblock, determine the target resolution and target mapping of the target mask image, where the target mapping is used to indicate the correspondence between the pixel points in the target mask image and the target macroblock in the original image;
[0010] Generate the target mask image according to the target resolution and a preset identification pattern;
[0011] After processing the target macroblock in the original image according to the target mask image and the target mapping, generate a target image.
[0012] In one embodiment, obtaining the target macroblock in the original image includes:
[0013] Obtain at least one target macroblock in the original image according to the high-gradient pixels and the preset resolution in the original image.
[0014] In one embodiment, before obtaining the target macroblock in the original image, the method further includes:
[0015] Obtain the frequency corresponding to each pixel value in the original image;
[0016] Determine whether the original image is a text type according to the frequency corresponding to each pixel value;
[0017] When the original image is a text-type image, obtain the target macroblock in the original image.
[0018] In one embodiment, generating the target image includes:
[0019] Perform binarization processing on the target mask image according to a preset rule to determine the value of each pixel point in the target mask image;
[0020] When the value of the pixel point in the target mask image is the first pixel value, modify the pixel value of the target macroblock corresponding to the pixel point in the target image;
[0021] When the value of the pixel point in the target mask image is the second pixel value, do not modify the pixel value of the pixel point in the corresponding target macroblock in the target image.
[0022] In one embodiment, modifying the pixel value of the pixel point in the corresponding target macroblock in the target image includes:
[0023] Obtain the target coordinates in the target macroblock, where the target coordinates are the coordinates corresponding to the pixel points adjacent to the high-pixel point in the target macroblock;
[0024] Modify the pixel value of the pixel point corresponding to the target coordinate point according to a preset rule.
[0025] The data processing method provided by the embodiments of the present disclosure determines a target macroblock in an original image. After determining the target macroblock, it determines the target resolution of a target mask image according to the target macroblock, and establishes a correspondence between the macroblock and the pixel points in the target mask image; generates the target mask image according to the target resolution and a preset marking pattern, and modifies the target macroblock according to the target mask image, so as to embed the target mask into the target image. The method provided by the present disclosure makes full use of the spatial distribution characteristics of the pixels of text-type images, performs identification embedding processing on the image in the spatial domain, and at the same time considers the self-preservation ability of the embedded identification in its spectrum when under attack, and has stronger robustness and anti-attack ability.
[0026] According to a second aspect of the embodiments of the present disclosure, there is provided a data processing method, which is applied to a decoding device and includes:
[0027] Obtain an original image and a target macroblock in the original image, where the target macroblock includes at least one high-gradient pixel;
[0028] According to the target macroblock, determine the target resolution and target mapping of the target mask image, where the target mapping is used to indicate the correspondence between the pixel points in the target mask image and the target macroblock in the original image;
[0029] According to the comparison result between the target mapping and the target macroblock, determine the target value of each pixel point in the target mask image corresponding to the target macroblock, where the comparison result refers to the comparison result between the target macroblock and the macroblock at the corresponding position in the target image, and the target image is the image obtained by processing the original image with the target mask image;
[0030] Generate the target mask image according to the target resolution and the target value.
[0031] In one embodiment, before determining the target value corresponding to each pixel point in the target mask image corresponding to the target macroblock, the method further includes:
[0032] Obtain a target residual matrix, where the target residual matrix is generated according to the comparison result between the target image and the original image;
[0033] According to the position information of the target macroblock, traverse the target residual matrix, find the macroblock corresponding to the target macroblock in the target residual matrix, and determine whether there is a residual in the target macroblock;
[0034] Generate the comparison result of the target macroblock according to whether there is a residual in the target macroblock.
[0035] In one embodiment, the obtaining the target residual matrix includes:
[0036] Obtain the target image corresponding to the original image;
[0037] Normalize the target image and the original image;
[0038] Perform differential processing on the target image and the original image after the normalization processing to generate a target residual matrix.
[0039] In one embodiment, generating the target residual matrix includes:
[0040] When the comparison result of the target macroblock shows that the target macroblock has changed, determine that the target value of the pixel points corresponding to the target macroblock is the first numerical value;
[0041] When the comparison result of the target macroblock shows that the target macroblock has not changed, determine that the target value of the pixel points corresponding to the target macroblock is the second numerical value.
[0042] According to the third aspect of the embodiments of the present disclosure, a data processing system is provided, and the system includes: an encoding device and a decoding device,
[0043] The encoding device is connected to the decoding device;
[0044] The encoding device is configured to obtain the original image and the target macroblock in the original image, and the target macroblock includes at least one high-gradient pixel;
[0045] According to the target macroblock, determine the target resolution and the target mapping of the target mask image, and the target mapping is used to indicate the correspondence between the pixel points in the target mask image and the target macroblock in the original image;
[0046] Generate the target mask image according to the target resolution and the preset identification pattern;
[0047] Process the target macroblock in the original image according to the target mask image and the target mapping to generate a target image;
[0048] The decoding device is configured to obtain the original image and the target macroblock in the original image, and the target macroblock includes at least one high-gradient pixel;
[0049] According to the target macroblock, determine the target resolution and the target mapping of the target mask image, and the target mapping is used to indicate the correspondence between the pixel points in the target mask image and the target macroblock in the original image;
[0050] According to the target mapping and the comparison result of the target macroblock, determine the target value of each pixel point in the target mask image corresponding to the target macroblock, and the comparison result refers to the comparison result between the target macroblock and the macroblock at the corresponding position in the target image, and the target image is the image obtained by processing the original image with the target mask image;
[0051] Generate the target mask image according to the target resolution and the target value.
[0052] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and cannot limit the present disclosure. Brief Description of the Drawings
[0053] The drawings herein are incorporated into the specification and constitute a part of this specification, showing embodiments consistent with the present disclosure, and are used together with the specification to explain the principles of the present disclosure.
[0054] Figure 1 is a flowchart of a data processing method provided by an embodiment of the present disclosure;
[0055] Figure 1a is a schematic diagram of high-gradient pixels in a data processing method provided by an embodiment of the present disclosure;
[0056] Figure 1b is an example diagram of a mask in a data processing method provided by an embodiment of the present disclosure;
[0057] Figure 2 is the process of a data processing method provided by an embodiment of the present disclosure Figure 1 ;
[0058] Figure 3 is a structural diagram of a data processing system provided by an embodiment of the present disclosure. Detailed Description of the Embodiments
[0059] Exemplary embodiments will be described in detail herein, and examples thereof are shown in the drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. On the contrary, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0060] Embodiment 1
[0061] An embodiment of the present disclosure provides a data processing method, which is applied to an encoding device, such as Figure 1 shown, the data processing method includes the following steps:
[0062] 101. Obtain the original image and the target macroblock in the original image.
[0063] The target macroblock includes at least one high-gradient pixel.
[0064] In an alternative embodiment, before performing the partitioning process on the original image, the method provided by the present disclosure further includes analyzing the original image to determine the type of the original image, which may specifically include:
[0065] Step 1: Extract the grayscale image of the original image. Specifically, the extraction method can be determined according to the format of the original image. For example, if the source image is in RGB pixel format, it needs to be converted to a grayscale image. If it is a YUV image of the video type, the luminance data Y is directly used. The extraction method of the grayscale image is not limited here.
[0066] Step 2: Quantize the grayscale image of the original image to obtain a grayscale frequency histogram.
[0067] Step 3: According to the frequency corresponding to each pixel value in the above grayscale frequency histogram, obtain the two pixel values with the most frequent occurrences. For example, the pixel with the maximum frequency can be regarded as the background color, and the pixel with the second maximum frequency can be regarded as the text color.
[0068] Step 4: According to the background color and the text color, determine whether the type of the original image is a text image type.
[0069] If the contrast ratio between the background color and the text color is greater than the threshold and the sum of their numbers is much greater than the sum of the numbers of other pixels, it is regarded as a text image.
[0070] In an alternative embodiment, after determining that the original image is a text-type image, the method provided by the present disclosure further includes high-gradient pixels in the original image, which may specifically include:
[0071] For example, the above-mentioned text color with background pixels can be regarded as high-gradient pixels. And a binary matrix is generated according to the high-gradient pixels.
[0072] As Figure 1a shown, each small grid represents a pixel. The white grid represents the background color pixel, and the gray grid represents the text color. According to the above high-gradient pixel determination rule, the pixels at points a, b, c, d, f, g, h, and i are high-gradient pixels, and the pixels corresponding to the positions of the white grids and the pixel at point e are not high-gradient pixels.
[0073] In an alternative implementation, the method provided by the present disclosure further includes partitioning the original image to obtain target macroblocks, and the steps include:
[0074] Determine at least one target macroblock in the original image according to the high-gradient pixels and the preset resolution in the original image.
[0075] For example, the preset resolution is the resolution of the target macroblock: the resolution of the target macroblock can be selected as squares such as 8x8, 16x16, 32x32, etc., or rectangles such as 16x8, 8x16, 32*8, etc.
[0076] The above preset rules may include:
[0077] Rule 1: Ensure that there are enough high-gradient pixels in the macroblock (greater than M. When too few, it will damage the visual effect or is prone to missing codes during decoding). Such macroblocks are regarded as embeddable macroblocks. The operable range can modify the red and white insertion black
[0078] Rule 2: After determining the resolution of the target macroblock, the number of macroblocks in the image that can embed the identifier is greater than the square value of a certain value X (the mask is a square with side length X, and the code length is X squared), such as 36, 49, 64, etc.
[0079] Under the conditions of meeting Rule 1 and Rule 2, generate as many target embeddable macroblocks as possible.
[0080] After determining the target macroblock, mark the target macroblock in the original image and count the number of target macroblocks
[0081] 102. According to the target macroblock, determine the target resolution and target mapping of the target mask image.
[0082] The target mapping is used to indicate the correspondence between the pixel points in the target mask image and the target macroblock in the original image
[0083] In the method provided by the present disclosure, determining the resolution of the target mask image means determining the number of pixels corresponding to the side length in the target mask image according to the number of target macroblocks.
[0084] Specifically: According to the number of target macroblocks, determine the corresponding resolution of the target mask image. The image resolution includes "horizontal pixel number × vertical pixel number", that is, it can be determined the number of pixel points included in each side of the target mask image. Specifically, the number of pixel points included in each side can be selected as the square of a certain X less than the number of target macroblocks. For example, when the number of target macroblocks is 70, then select X as 8, the mask code length is 64, which can ensure effective embedding. When the number of target macroblocks is more, a larger-sized identification mask can be selected, and a larger-sized identification mask means more accurate identification after decoding.
[0085] 103. Generate the target mask image according to the target resolution and the preset identification graphic;
[0086] The preset identification graphic is the watermark graphic to be loaded in the original image.
[0087] In generating the target mask image, it may include: binarizing a preset identification image to generate the target mask image.
[0088] For example, within a two-dimensional image with width X and height X, the entire bottom plate is set to white, and then a highly recognizable (black grid) pattern is inserted to form. Even if there are missing codes or mixed error codes after decoding, this pattern still has a high recognition rate. For example Figure 1b As shown. The mask selection is not limited to Figure 1b As shown.
[0089] 104. After processing the target macroblock in the original image according to the target mask image and the target mapping, a target image is generated.
[0090] Before processing the target macroblock, the method provided by the present disclosure includes scanning the mask of the target mask image line by line to form a code key. White is 0 and black is 1. After zigzag scanning processing, the values corresponding to the pixel points in the target mask image can be more evenly distributed.
[0091] In an alternative embodiment, in the method provided by the present disclosure, modifying the corresponding target macroblock in the original image includes:
[0092] Traversing the target mask pattern pixel by pixel according to the target mapping;
[0093] When the value of the pixel point in the target mask image is the first pixel value, modifying the pixel value of the target macroblock corresponding to the pixel point in the target image;
[0094] When the value of the pixel point in the target mask image is the second pixel value, not modifying the pixel value of the pixel point in the corresponding target macroblock in the target image.
[0095] In an alternative embodiment, in the method provided by the present disclosure, when the pixel value of the pixel point in the target mask image is 1, modifying the target macroblock corresponding to the pixel point includes:
[0096] According to the high-gradient pixels in the original image, N (N is less than or equal to M) high-gradient pixels are found in the target macroblock according to a preset rule. The larger N is, the stronger the anti-attack ability is;
[0097] After determining the high-gradient pixels in the target macroblock, obtaining the coordinates of the non-high-gradient pixels around them and marking the coordinates as target coordinates, that is, the embedding coordinates can be obtained;
[0098] Modifying the pixel value of the pixel point corresponding to the target coordinate to the high-gradient pixel value.
[0099] Furthermore, when the visual effect is damaged, high-gradient pixels after weighted multiplication can be inserted. The closer to the high-gradient value, the stronger the anti-attack ability.
[0100] In an alternative embodiment, after all the target macroblocks corresponding to the pixel points in the target mask image have been processed in the method provided by the present disclosure, a target image is generated according to the modified target macroblocks. Since the pixel points corresponding to the modified target macroblocks in the present disclosure are the pixel points around the high-gradient pixels, which can be understood as the pixel points around the text in the original image, it avoids the recognition difficulty caused by adding a watermark to the original image.
[0101] The target image is an image in which the target mask image has been embedded in the original image.
[0102] The data processing method provided by the embodiments of the present disclosure determines the target macroblocks in the original image. After determining the target macroblocks, it determines the target resolution of the target mask image according to the target macroblocks, and establishes the correspondence between the macroblocks and the pixel points in the target mask image; generates the target mask image according to the target resolution and the preset marking pattern, and modifies the target macroblocks according to the target mask image, thereby embedding the target mask into the target image. The method provided by the present disclosure makes full use of the spatial distribution characteristics of the pixels of the text type image, performs identification embedding processing on the image in the spatial domain, and at the same time considers the self-preservation ability of the embedded identification in its spectrum when under attack, and has stronger robustness and anti-attack ability.
[0103] Embodiment Two
[0104] Based on the above Figure 1 corresponding data processing method provided by the embodiment, another embodiment of the present disclosure provides a data processing method, which can be applied to a decoding device. Referring to Figure 2 as shown, the data processing method provided by this embodiment includes the following steps:
[0105] 201. Obtain the original image and the target macroblocks in the original image.
[0106] The target macroblocks include at least one high-gradient pixel.
[0107] In an alternative implementation, the method provided by the present disclosure further includes dividing the original image to obtain target macroblocks, and the steps include:
[0108] Determine at least one target macroblock in the original image according to the high-gradient pixels and the preset resolution in the original image.
[0109] For example: the preset resolution is the resolution of the target macroblock: the resolution of the target macroblock can be selected as a square such as 8x8, 16x16, 32x32, etc., or a rectangle such as 16x8, 8x16, 32*8, etc.
[0110] After determining the target macroblock in the original image, the present disclosure also marks the target macroblock and obtains the parameters of the target macroblock, where the parameters include the position of the target macroblock and the number of target macroblocks.
[0111] 202. Determine the target resolution and target mapping of the target mask image according to the target macroblock.
[0112] The target mapping is used to indicate the correspondence between the pixel points in the target mask image and the target macroblock in the original image.
[0113] In the method provided by the present disclosure, to determine the resolution of the target mask image, that is, according to the number of target macroblocks, determine the number of pixels corresponding to the side length in the target mask image.
[0114] 203. Determine the target value of each pixel point in the target mask image corresponding to the target macroblock according to the comparison result between the target mapping and the target macroblock.
[0115] Wherein, the comparison result refers to the comparison result between the target macroblock and the macroblock at the corresponding position in the target image, and the target image is the image obtained by processing the original image with the target mask image; the target residual matrix is the comparison residual matrix between the original image and the target image, and the target image is the image obtained by embedding the original image with the target mask image.
[0116] In an alternative implementation, in the method provided by the present disclosure, to determine the comparison result of the target macroblock, it may specifically include:
[0117] Obtain a target residual matrix, which is generated according to the comparison result between the target image and the original image;
[0118] Traverse the target residual matrix according to the position information of the target macroblock, find the macroblock corresponding to the target macroblock in the target residual matrix, and determine whether there is a residual in the target macroblock;
[0119] Generate the comparison result of the target macroblock according to whether there is a residual in the target macroblock.
[0120] Furthermore, for the above method of obtaining the target residual matrix, it may include:
[0121] Normalize the original image and the target image. For example, normalize the pixel range to the range of 0 to 1000
[0122] Perform a difference operation on the normalized original image and the encoded image to generate a residual matrix;
[0123] Calculate the median value in the residual matrix, and perform binarization processing on the above-mentioned residual matrix according to the median value or the weighted value of the median value to obtain a binarized residual matrix, that is, the target residual matrix.
[0124] In the method provided by the present disclosure, determining the target value corresponding to each pixel point of the target mask image includes:
[0125] Traverse the target macroblock block by block, and determine the value of the pixel point corresponding to the target macroblock according to the comparison result of the target macroblock. Specifically:
[0126] When the comparison result of the target macroblock shows that there is a residual in the target macroblock, that is, after comparing the target macroblock in the original image with the target image, the target macroblock has changed. At this time, mark the value of the pixel point corresponding to the target macroblock as the first numerical value;
[0127] When the comparison result of the target macroblock shows that there is no residual in the target macroblock, that is, after comparing the target macroblock in the original image with the target image, the target macroblock has not changed, mark the value of the pixel point corresponding to the target macroblock as the second numerical value;
[0128] Until all target macroblocks are traversed.
[0129] 204. Generate the target mask image according to the target resolution and the target value.
[0130] Specifically, after filling the target value into the pixel points at the positions corresponding to the target macroblock in the target mask image according to the target macroblock and the target mapping, the target mask image is generated. According to the generated target mask image, a preset identification graphic is obtained. The preset identification graphic is the watermark in the target image. By parsing the watermark content, the encryption device or the encrypted user corresponding to the original file when the watermark is added can be obtained, which is convenient for the user to manage the original file and also increases the security of the original file. For example, if a leakage event occurs after the original file is added with a watermark, the encrypted watermark can be obtained through the method provided by the present disclosure, so as to obtain the information of the leaking party and provide conclusive evidence for the rights protection lawsuit.
[0131] The data processing method provided by the embodiments of the present disclosure is applied to a decoding device. By determining a target macroblock in the original image, after determining the target macroblock, the target resolution of the target mask image is determined according to the target macroblock, and the correspondence between the target macroblock and the pixel points in the target mask image is established; according to the correspondence and whether the macroblock at the corresponding position in the target macroblock and the target image after adding the watermark changes, the target value of the pixel points in the target mask image is determined, and finally, according to the target resolution and the target value, the target mask image is generated. After obtaining the target mask image, the identification information added to the original image, that is, the watermark on the target image, can be obtained. The method provided by the present disclosure makes full use of the spatial distribution characteristics of the pixels of the text type image, performs identification embedding processing on the image in the spatial domain, and at the same time considers the self-preservation ability of the embedded identification in its spectrum when under attack, and has stronger robustness and anti-attack ability.
[0132] Embodiment III
[0133] Based on the above Figure 1 and Figure 2 the data processing method described in the corresponding embodiments, the following is an embodiment of the system of the present disclosure, which can be used to execute the method embodiments of the present disclosure.
[0134] The embodiments of the present disclosure provide a data processing system, as Figure 3 shown, the data processing system 30 includes: an encoding device 301 and a decoding device 302,
[0135] The encoding device 301 is connected to the decoding device 302;
[0136] The encoding device 301 is used to obtain the original image and the target macroblock in the original image, and the target macroblock includes at least one high-gradient pixel;
[0137] According to the target macroblock, determine the target resolution and target mapping of the target mask image, and the target mapping is used to indicate the correspondence between the pixel points in the target mask image and the target macroblock in the original image;
[0138] Generate the target mask image according to the target resolution and the preset identification pattern;
[0139] After processing the target macroblock in the original image according to the target mask image and the target mapping, generate a target image;
[0140] The decoding device 302 is used to obtain the original image and the target macroblock in the original image, and the target macroblock includes at least one high-gradient pixel;
[0141] Based on the target macroblock, determine the target resolution and target mapping of the target mask image, where the target mapping is used to indicate the correspondence between the pixel points in the target mask image and the target macroblock in the original image;
[0142] Based on the comparison result between the target mapping and the target macroblock, determine the target value of each pixel point in the target mask image corresponding to the target macroblock, where the comparison result refers to the comparison result between the target macroblock and the macroblock at the corresponding position in the target image, and the target image is the image obtained by processing the original image with the target mask image;
[0143] Generate the target mask image according to the target resolution and the target value.
[0144] The data processing system provided by the embodiments of the present disclosure makes full use of the spatial distribution characteristics of the pixels of text-type images, performs logo embedding processing on the image in the spatial domain, and at the same time considers the self-preservation ability of the embedded logo in its spectrum when under attack, and has stronger robustness and anti-attack ability.
[0145] Based on the above Figure 1 and Figure 2 corresponding to the data processing method described in the embodiments, the embodiments of the present disclosure also provide a computer-readable storage medium. For example, a non-temporary computer-readable storage medium may be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, and an optical data storage device, etc. Computer instructions are stored on the storage medium for executing the data processing method described in the above Figure 1 and Figure 2 corresponding to the embodiments, which will not be elaborated here.
[0146] Those skilled in the art will readily conceive of other embodiments of the present disclosure after considering the specification and practicing the disclosure herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common general knowledge or conventional technical means in the technical field not disclosed in the present disclosure. The specification and embodiments are only regarded as exemplary, and the true scope and spirit of the present disclosure are pointed out by the following claims.
Claims
1. A data processing method, characterized in that, Applied to an encoding device, the method includes: Obtain an original image and a target macroblock in the original image, where the target macroblock includes at least one high-gradient pixel; Determine a target resolution and a target mapping of a target mask image according to the target macroblock, where the target mapping is used to indicate the correspondence between pixel points in the target mask image and the target macroblock in the original image; Generate the target mask image according to the target resolution and a preset identification pattern; Process the target macroblock in the original image according to the target mask image and the target mapping to generate a target image; Before obtaining the target macroblock in the original image, the method further includes: obtaining the frequency corresponding to each pixel value in the original image; determining whether the original image is a text type according to the frequency corresponding to each pixel value; when the original image is a text-type image, obtaining the target macroblock in the original image; The obtaining the target macroblock in the original image includes: obtaining at least one target macroblock in the original image according to the high-gradient pixels and a preset resolution in the original image.
2. The method according to claim 1, characterized in that, The generating the target image includes: Perform binarization processing on the target mask image according to a preset rule to determine the value of each pixel point in the target mask image; When the value of a pixel point in the target mask image is a first pixel value, modify the pixel value of the target macroblock corresponding to the pixel point in the target image; When the value of a pixel point in the target mask image is a second pixel value, do not modify the pixel value of the pixel point in the corresponding target macroblock in the target image.
3. The method according to claim 2, characterized in that, The modifying the pixel value of the pixel point in the corresponding target macroblock in the target image includes: Obtain a target coordinate in the target macroblock, where the target coordinate is the coordinate corresponding to a pixel point adjacent to the high-gradient pixel point in the target macroblock; Modify the pixel value of the pixel point corresponding to the target coordinate point according to a preset rule.
4. A data processing method, characterized in that, Applied to a decoding device, the method includes: Obtain an original image and a target macroblock in the original image, where the target macroblock includes at least one high-gradient pixel; Determine a target resolution and a target mapping of a target mask image according to the target macroblock, where the target mapping is used to indicate the correspondence between pixel points in the target mask image and the target macroblock in the original image; Determine the target value of each pixel point in the target mask image corresponding to the target macroblock according to the comparison result between the target mapping and the target macroblock, where the comparison result refers to the comparison result between the target macroblock and the macroblock at the corresponding position in the target image, and the target image is the image obtained by processing the original image with the target mask image; Generate the target mask image according to the target resolution and the target value; Before determining the target value corresponding to each pixel point in the target mask image corresponding to the target macroblock, the method further includes: obtaining a target residual matrix, where the target residual matrix is generated according to the comparison result between the target image and the original image; traversing the target residual matrix according to the position information of the target macroblock, finding the macroblock corresponding to the target macroblock in the target residual matrix, and determining whether there is a residual in the target macroblock; generating a comparison result of the target macroblock according to whether there is a residual in the target macroblock; The obtaining of the target residual matrix includes: obtaining the target image corresponding to the original image; performing normalization processing on the target image and the original image; performing differential processing on the normalized target image and the original image to generate a target residual matrix.
5. The method according to claim 4, characterized in that, The generating of the target residual matrix includes: When the comparison result of the target macroblock shows that the target macroblock has changed, determining that the target value of the pixel point corresponding to the target macroblock is a first numerical value; When the comparison result of the target macroblock shows that the target macroblock has not changed, determining that the target value of the pixel point corresponding to the target macroblock is a second numerical value.
6. A data processing system, characterized in that, The system includes: an encoding device and a decoding device, The encoding device is connected to the decoding device; The encoding device is configured to obtain the original image and the target macroblock in the original image, where the target macroblock includes at least one high-gradient pixel; According to the target macroblock, determining the target resolution and the target mapping of the target mask image, where the target mapping is used to indicate the correspondence between the pixel points in the target mask image and the target macroblock in the original image; Generating the target mask image according to the target resolution and a preset identification pattern; After processing the target macroblock in the original image according to the target mask image and the target mapping, generating a target image; Before obtaining the target macroblock in the original image, the encoding device is further configured to obtain the frequency corresponding to each pixel value in the original image; determining whether the original image is a text type according to the frequency corresponding to each pixel value; when the original image is a text-type image, obtaining the target macroblock in the original image; The obtaining of the target macroblock in the original image includes: obtaining at least one target macroblock in the original image according to the high-gradient pixels and the preset resolution in the original image; The decoding device is configured to obtain the original image and the target macroblock in the original image, where the target macroblock includes at least one high-gradient pixel; According to the target macroblock, determining the target resolution and the target mapping of the target mask image, where the target mapping is used to indicate the correspondence between the pixel points in the target mask image and the target macroblock in the original image; Determine the target value of each pixel point corresponding to the target macroblock in the target mask image according to the comparison result between the target mapping and the target macroblock, where the comparison result refers to the comparison result between the target macroblock and the macroblock at the corresponding position in the target image, and the target image is the image obtained by processing the original image with the target mask image processing; Generate the target mask image according to the target resolution and the target value; Before determining the target value of each pixel point corresponding to the target macroblock in the target mask image, the decoding device is further configured to obtain a target residual matrix, which is generated according to the comparison result between the target image and the original image; traverse the target residual matrix according to the position information of the target macroblock, find the macroblock corresponding to the target macroblock in the target residual matrix, and determine whether there is a residual in the target macroblock; generate the comparison result of the target macroblock according to whether there is a residual in the target macroblock; The obtaining of the target residual matrix includes: obtaining the target image corresponding to the original image; performing normalization processing on the target image and the original image; performing differential processing on the normalized target image and the original image to generate a target residual matrix.
Citation Information
Patent Citations
Text image area identification method and system, and related device
CN110399867A
Image processing apparatus and image processing method
US20080232703A1