Picture processing method and device, electronic equipment and storage medium

By performing brightness processing on the selected embedding area of ​​the QR code picture in the picture to be embedded, it makes it similar to the pixel distribution of the QR code picture, the problem of image quality degradation after QR code embedding in the prior art is solved, and a high-aesthetic QR code embedding effect is achieved.

CN119540068APending Publication Date: 2025-02-28BEIJING QIYI CENTURY SCI & TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411447332.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-16
Publication Date
2025-02-28

AI Technical Summary

Technical Problem

When embedding QR codes into high-resolution pictures, the prior art requires complex image processing algorithms and high computing resources, resulting in a large difference in the generated image quality from the original image, affecting the aesthetics of the image.

Method used

By obtaining the QR code picture and the picture to be embedded, the selected embedding area of ​​the QR code picture in the picture to be embedded, and the brightness processing of the selected embedding area is performed based on the brightness level of the pixel unit in the QR code picture and the brightness level of the pixel unit in the selected embedding area to obtain the target embedding area, so that its pixel distribution similarity to the QR code picture exceeds the preset threshold.

Benefits of technology

Without significantly affecting the image effect, the target picture containing QR code pictures is directly fused, which is suitable for QR code embedding applications that require high image aesthetics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119540068A_ABST
    Figure CN119540068A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a picture processing method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a two-dimensional code picture and a to-be-embedded picture, and determining a selected embedding region of the two-dimensional code picture in the to-be-embedded picture; binary information of pixel units in the two-dimensional code picture and binary information of pixel units in the selected embedding area are acquired; and according to the brightness level of the pixel unit in the two-dimensional code picture and the brightness level of the pixel unit in the selected embedding area, performing brightness processing on the selected embedding area to obtain a target embedding area. According to the method, the selected embedding area in the original picture is processed based on the binary information of the pixel units, the target picture containing the two-dimensional code picture is obtained through direct fusion under the condition that the picture effect is not remarkably affected, and the method is suitable for being applied to the two-dimensional code embedded picture with the high requirement for picture attractiveness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to an image processing method, an image processing device, an electronic device and a computer-readable storage medium. Background Art

[0002] QR codes are used everywhere in our daily life. However, most QR codes are mainly presented in black and white patterns. In the fields of film and television screenshots, advertising communication, etc., high requirements are placed on the aesthetics of pictures. The covering black and white QR codes have a greater impact on the overall aesthetics of the picture.

[0003] In the related technologies of embedding QR codes into images, embedding QR codes into high-resolution images requires complex image processing algorithms and high computing resources, and often results in a large difference in the quality of the generated image from the original image, which will affect the image effect and is not suitable for fields that have high requirements for image aesthetics. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide a picture processing method, a picture processing device, an electronic device and a computer-readable storage medium, which are suitable for applications where a two-dimensional code is embedded in a picture and has high requirements for the aesthetics of the picture. The specific technical solution is as follows:

[0005] In a first aspect of the present invention, a method for processing an image is provided, the method comprising:

[0006] Obtain a QR code image and a picture to be embedded, and determine a selected embedding area of ​​the QR code image in the picture to be embedded;

[0007] Obtaining binary information of pixel units in the two-dimensional code image and binary information of pixel units in the selected embedding area; the binary information is used to indicate the brightness level of the corresponding pixel unit;

[0008] According to the brightness level of the pixel units in the two-dimensional code image and the brightness level of the pixel units in the selected embedded area, the selected embedded area is subjected to brightness processing to obtain a target embedded area; the degree of similarity between the pixel distribution of the target embedded area and the two-dimensional code image exceeds a preset similarity threshold.

[0009] In a second aspect of the present invention, there is also provided a picture processing device, the device comprising:

[0010] An embedding area determination module, used to obtain a two-dimensional code image and a picture to be embedded, and determine a selected embedding area of ​​the two-dimensional code image in the picture to be embedded;

[0011] An image parsing module, used to obtain binary information of pixel units in the two-dimensional code image and binary information of pixel units in the selected embedding area; the binary information is used to indicate the brightness level of the corresponding pixel unit;

[0012] The embedded area processing module is used to perform brightness processing on the selected embedded area according to the brightness level of the pixel unit in the two-dimensional code image and the brightness level of the pixel unit in the selected embedded area to obtain a target embedded area; the similarity between the pixel distribution of the target embedded area and the two-dimensional code image exceeds a preset similarity threshold.

[0013] In another aspect of the implementation of the present invention, there is also provided an electronic device, including a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; the memory is used to store computer programs; and the processor is used to implement any of the above-mentioned image processing methods when executing the program stored in the memory.

[0014] In another aspect of the present invention, a computer-readable storage medium is provided, wherein instructions are stored in the computer-readable storage medium, and when the computer-readable storage medium is run on a computer, the computer executes any of the above-mentioned image processing methods.

[0015] In another aspect of the present invention, a computer program product comprising instructions is provided, which, when executed on a computer, enables the computer to execute any of the above-mentioned image processing methods.

[0016] The image processing method, device, electronic device and storage medium provided by the embodiments of the present invention perform brightness processing on the selected embedding area after determining the selected embedding area of ​​the two-dimensional code image in the image to be embedded, according to the brightness level of the pixel unit in the two-dimensional code image and the brightness level of the pixel unit in the selected embedding area, to obtain the target embedding area containing the two-dimensional code image, so as to directly obtain the target image containing the two-dimensional code image. Based on the binary information of the pixel unit in the two-dimensional code image and the binary information of the pixel unit in the selected embedding area, the selected embedding area in the original image is brightness processed, and the target image containing the two-dimensional code image is directly fused without significantly affecting the image effect, which is suitable for applications of two-dimensional code embedded images with high requirements for image aesthetics. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0018] Figure 1 A flowchart of a picture processing method according to an embodiment of the present invention;

[0019] Figure 2 is a flowchart of another picture processing method embodiment in an embodiment of the present invention;

[0020] Figure 3 A schematic diagram of a picture processing process provided by an embodiment of the present invention;

[0021] Figure 4A and Figure 4B A schematic diagram of a binary mode of an image provided by an embodiment of the present invention;

[0022] Figure 5A and Figure 5B A schematic diagram of various geometric regions in a preset cube provided in an embodiment of the present invention;

[0023] Figure 6 A schematic diagram of the effect of image processing provided by an embodiment of the present invention;

[0024] Figure 7 is a structural block diagram of an embodiment of a picture processing device in an embodiment of the present invention;

[0025] Figure 8 The figure is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION

[0026] The technical solutions in the embodiments of the present invention will be described below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0027] Reference Figure 1 , shows a flowchart of a picture processing method in an embodiment of the present invention, which may specifically include the following steps:

[0028] Step 101, obtaining a QR code image and a picture to be embedded, and determining a selected embedding area of ​​the QR code image in the picture to be embedded;

[0029] QR code images can usually be embedded in images to achieve information storage and transmission.

[0030] The image to be embedded is the image to be embedded in the QR code, so as to realize information storage and transmission in the image to be embedded based on the embedded QR code.

[0031] The selected embedding area refers to the embedding area of ​​the QR code image when it is embedded in the image to be embedded. The selected embedding area is one or more of the multiple selected embedding areas on the image to be embedded. Different selected embedding areas may have partial overlap of image areas.

[0032] Exemplarily, in order to ensure that the two-dimensional code image is completely embedded in the image to be embedded, the area size of the multiple selected embedding areas is at least larger than the image size of the two-dimensional code image.

[0033] Optionally, after determining the selected embedding area of ​​the QR code image in the image to be embedded, the selected embedding area is used to fuse the QR code image, so that subsequent pixel adjustments can be adjustments performed on the image to be embedded containing the QR code image, thereby facilitating direct generation of a target image that fuses the QR code image.

[0034] Step 102, obtaining binary information of pixel units in the two-dimensional code image and binary information of pixel units in the selected embedding area;

[0035] The picture is composed of pixel units, and the binary information of the picture is obtained by parsing the picture. The parsed information includes the binary information of the pixel units in the picture. The binary information is used to indicate the relevant picture information of the QR code picture in the binary mode. In the binary mode, the relevant information of the picture can be specifically indicated and stored by the binary information. For example, the binary information can be used to indicate the pixel data, image format, compression algorithm, metadata, transparency and layer information, color table, etc. in the picture. Taking the pixel data therein as an example, the color and brightness information of each pixel can be obtained based on the binary information, that is, the color and brightness information of each pixel unit in the picture can be represented by a binary number. This is not limited by the embodiments of the present invention.

[0036] The two-dimensional code image is composed of pixel units. The two-dimensional code image is parsed to obtain binary information of the pixel units in the two-dimensional code image. The binary information is used to indicate the relevant image information of the two-dimensional code image in binary mode, and specifically can be used to indicate the pixel data of each pixel unit in the two-dimensional code image, so as to be used subsequently to implement the image processing process based on pixel units.

[0037] The image to be embedded is composed of pixel units. The image to be embedded is parsed to obtain binary information of the pixel units in the image to be embedded. The binary information is used to indicate relevant image information of the image to be embedded in binary mode, and can be specifically used to indicate pixel data of each pixel unit in the image to be embedded, so as to be used subsequently to implement an image processing process based on pixel units.

[0038] In practical applications, when parsing the image to be embedded, only the selected embedding area in the image to be embedded may be parsed, that is, only the binary information of the selected embedding area in the image to be embedded may be obtained to reduce the amount of data processing.

[0039] Step 103, performing brightness processing on the selected embedding area according to the brightness level of the pixel unit in the two-dimensional code image and the brightness level of the pixel unit in the selected embedding area to obtain the target embedding area.

[0040] The binary information of the pixel units in the QR code image can be used to indicate the pixel data of each pixel unit in the QR code image, and the binary information of the selected embedding area can be used to indicate the pixel data of each pixel unit in the selected embedding area. At this time, the selected embedding area can be processed based on the pixel unit to obtain the target embedding area for embedding the QR code image in the image to be embedded.

[0041] Optionally, the binary information is used to indicate the brightness level of the corresponding pixel unit.

[0042] The processing of the selected embedding area based on the pixel unit can be specifically performed by adjusting the pixel unit of the selected embedding area based on the brightness level of the pixel unit, thereby adjusting the image to be embedded including the two-dimensional code image.

[0043] In one embodiment of the present invention, brightness processing can be performed on the selected embedded area according to the brightness level of the pixel unit in the two-dimensional code image and the brightness level of the pixel unit in the selected embedded area to obtain a target embedded area containing the two-dimensional code image, and then obtain a target image that fuses the two-dimensional code image.

[0044] Among them, the target embedded area obtained after brightness processing will have a similarity with the pixel distribution of the QR code image that exceeds the preset similarity threshold, making the fusion of the QR code image and the target embedded area natural, and ensuring that the embedding of the QR code image does not affect the image effect.

[0045] In an embodiment of the present invention, after determining the selected embedding area of ​​the two-dimensional code image in the image to be embedded, brightness processing is performed on the selected embedding area according to the brightness level of the pixel unit in the two-dimensional code image and the brightness level of the pixel unit in the selected embedding area, so as to obtain a target embedding area containing the two-dimensional code image, so as to directly obtain a target image containing the two-dimensional code image. Based on the binary information of the pixel unit in the two-dimensional code image and the binary information of the pixel unit in the selected embedding area, the brightness processing is performed on the selected embedding area in the original image, and the target image containing the two-dimensional code image is directly fused without significantly affecting the image effect, which is suitable for applications of two-dimensional code embedded images with high requirements for image aesthetics.

[0046] Reference Figure 2 , shows a flowchart of another picture processing method embodiment in an embodiment of the present invention, which may specifically include the following steps:

[0047] Step 201, generate a QR code image;

[0048] QR code images can usually be embedded in images to achieve information storage and transmission.

[0049] In an embodiment of the present invention, a QR code image is embedded invisibly into any image, such as Figure 3 As shown, the process may include QR code analysis, image analysis, and image processing.

[0050] In the process of generating the QR code image, based on the implementation principle of the QR code, the generated QR code image has requirements on fault tolerance and color blocks, etc.

[0051] As an example, the generated QR code image has a certain degree of fault tolerance, which can be dynamically calculated and adjusted according to the complexity of the image to be embedded. The fault tolerance is achieved by setting the fault tolerance rate of the QR code. The fault tolerance rate is the damage resistance of the QR code. The fault tolerance rate is positively correlated with the damage resistance, that is, the higher the value of the fault tolerance rate, the stronger the damage resistance; the fault tolerance rate is positively correlated with the redundant information contained in the QR code, that is, the higher the value of the fault tolerance rate, the more redundant information the QR code contains, that is, there are more dark and light color blocks, which is not conducive to the later image processing. Therefore, the fault tolerance rate of the QR code is not set to the highest, but is dynamically adjusted based on the calculated complexity of the image to be embedded.

[0052] Specifically, it can be expressed as dynamically adjusting the fault tolerance of the QR code based on the calculation result of the image entropy value of the image to be embedded. If the calculated image entropy value is larger, it means that there are more pixel colors in the image to be embedded. In this case, a high-level fault tolerance QR code image can be used for embedding, that is, the fault tolerance of the generated QR code image can be set to a high-level fault tolerance to ensure the fault tolerance of the generated QR code image. Among them, the fault tolerance of the QR code is set to four levels: L-low fault tolerance, M-medium fault tolerance, Q-higher fault tolerance, H-high fault tolerance, and the entropy value interval can be selected to correspond to several different fault tolerance levels, such as high entropy value corresponding to H, low entropy value corresponding to L, etc., and this is not limited by the embodiment of the present invention.

[0053] As another example, the color block lines of the generated QR code image are as soft as possible. Softness means avoiding right-angled dark and light color blocks, and rounded or more rounded dark and light color blocks can be used. The generated QR code image can choose a style with a more even distribution of color blocks to avoid dense or sparse areas.

[0054] Optional, such as Figure 3 As shown, after the QR code image is generated, the QR code image can be processed. For example, in the generated QR code image, the QR code rotation process can be performed to rotate the positioning block in the QR code image downward to facilitate hiding the QR code.

[0055] Step 202, parsing the two-dimensional code image to obtain binary information of pixel units in the two-dimensional code image;

[0056] The QR code image is composed of pixel units. The binary information of the pixel units in the QR code image is obtained by parsing the QR code image. Figure 3 As shown, the two-dimensional code image can be parsed into a binary mode to obtain binary information of pixel units in the two-dimensional code image.

[0057] The binary information is used to indicate relevant image information of the two-dimensional code image in the binary mode, and can be specifically used to indicate the pixel data of each pixel unit in the two-dimensional code image, so as to be subsequently used to implement the image processing process based on the pixel unit.

[0058] The QR code image can be composed of pixel units of different color levels, which are usually represented by a first color level for indicating a dark block and a second color level for indicating a light block. Correspondingly, binary information can be used to indicate the brightness level of the corresponding pixel unit, wherein the brightness level is inversely correlated with the color level, specifically, the higher the color level, the lower the brightness level, and the corresponding pixel unit usually needs to be brightened; the lower the color level, the higher the brightness level, and the corresponding pixel unit usually needs to be dimmed.

[0059] Specifically, the color of each pixel can be known based on binary information, that is, the color of each pixel unit in the image can be represented by a binary number.

[0060] In a specific implementation, a first identifier can be used to mark pixel units in a QR code image whose color level is a first color level; and / or a second identifier can be used to mark pixel units in a QR code image whose color level is a second color level to obtain the brightness level of each pixel unit in the QR code image.

[0061] For example, in a two-dimensional code image in binary mode, the first identifier may be 1, which may represent a first color level for indicating a dark block, and the second identifier may be 0, which may represent a second color level for indicating a light block. That is, the binary information representation result of the two-dimensional code image may be as follows: Figure 4AAs shown, 1 is used to mark a dark pixel unit (i.e., a dark block), and 0 is used to mark a light pixel unit (i.e., a light block). The first color level is greater than the second color level, and accordingly, the brightness level of the second color level used to indicate the light block may be the first brightness level, and the brightness level of the first color level used to indicate the dark block may be the second brightness level. The first brightness level is greater than the second brightness level, and there is a need to dim the brightness of the pixel unit of the first brightness level, and there is a need to increase the brightness of the pixel unit of the second brightness level.

[0062] Step 203, obtaining the image to be embedded, determining at least one selected embedding area of ​​the two-dimensional code image in the image to be embedded, and parsing the image to be embedded to obtain binary information of pixel units in the at least one selected embedding area;

[0063] The image to be embedded is the image to be embedded in the QR code, so as to realize information storage and transmission in the image to be embedded based on the embedded QR code.

[0064] For example, in fields that require high aesthetics of images, the acquired images to be embedded are usually not pure-color images, but images with different textures and contrasts, such as advertising posters or movie screenshots.

[0065] The selected embedding area refers to the embedding area of ​​the QR code image when it is embedded in the image to be embedded. The selected embedding area is one or more of the multiple selected embedding areas on the image to be embedded. Different selected embedding areas may have partial overlap of image areas.

[0066] Exemplarily, in order to ensure that the two-dimensional code image is completely embedded in the image to be embedded, the area size of the multiple selected embedding areas is at least larger than the image size of the two-dimensional code image.

[0067] In practical applications, in order to facilitate the processing of images from the pixel dimension and improve the contrast between different color blocks of the two-dimensional code, the selected embedding area, that is, the selected embedding area is usually an area with a more complex texture or a higher contrast in the image to be embedded. Optionally, the selected embedding area may also refer to an area where the pixel values ​​of the pixels contained in the image to be embedded vary greatly, which is not limited by the embodiments of the present invention.

[0068] Specifically, image information of each preset area in the image to be embedded can be obtained. The obtained image information may include at least one of texture information and contrast information. At this time, the selected embedding area can be obtained from each preset area based on the texture information and / or contrast information meeting the preset conditions.

[0069] It should be noted that the size of the QR code has no direct relationship with its recognition success rate. The area size of each preset area and the image size of the QR code image can be the same or different, that is, the original ratio of the QR code image is not necessarily used for fusion.

[0070] As an example, in order to reduce the subsequent processing scope of the embedded image and thus reduce the processing amount, the area size of multiple preset areas is the same as the image size of the QR code image, that is, the area size of the selected embedded area obtained from multiple preset areas is the same as the image size of the QR code image.

[0071] As another example, after determining the selected embedding area suitable for embedding the QR code in the image to be embedded, the QR code image may be proportionally corrected according to the size of the determined selected embedding area, and then the pixel adjustment operation of the selected embedding area may be performed. That is, in the case where the area size of the preset area is different from the image size of the QR code image, after obtaining the selected embedding area, the size information of the selected embedding area may be obtained, and the QR code image may be proportionally corrected according to the size information, so that the original ratio of the QR code image does not need to be used for image fusion.

[0072] The preset condition may be at least one of the complexity of the texture information exceeding a preset degree and / or the contrast information exceeding a preset contrast.

[0073] Exemplarily, the complexity of texture information can be quantified by texture features of pixel units in a preset area. Commonly used texture features include Gray-Level Co-occurrence Matrix (GLCM), Local Binary Pattern (LBP), etc. As an example, a gray level co-occurrence matrix is ​​a commonly used texture analysis method, which can be used to describe the spatial relationship between gray levels in pixel units within a preset area. It can mainly calculate the gray level co-occurrence matrix of pixel units in a preset area, extract texture features such as contrast, correlation, energy, homogeneity, etc., and then calculate the texture complexity, for example, using energy or entropy as a measure of complexity. In this example, the preset degree can be set according to the specific application scenario. For example, the preset degree of energy can be set to 0.1, and the preset degree of entropy can be set to 3.0. The embodiments of the present invention are not limited to this. As another example, a local binary pattern is a method for describing local texture features of pixel units in a preset area. It can mainly calculate the LBP features of pixel units in a preset area and count the histogram of the LBP features to calculate the texture complexity, such as using the entropy of the LBP histogram as a measure of complexity. In this example, the preset degree can be set according to the specific application scenario. For example, the preset degree of entropy of the LBP histogram can be set to 2.5. The embodiments of the present invention are not limited to this.

[0074] Contrast information can be quantified by calculating the contrast of pixel units in a preset area. Common contrast measurement methods include local contrast, global contrast, etc. As an example, local contrast can be quantified by calculating the grayscale difference between each pixel in a preset area and its neighboring pixels. It can mainly calculate the grayscale difference between each pixel in a preset area and its neighboring pixels to calculate the local contrast, such as using the standard deviation or mean square error as a measure of contrast. In this example, the preset contrast can be set according to a specific application scenario. For example, the preset value of the local contrast can be set to 30, which is not limited by the embodiment of the present invention. As another example, global contrast can be quantified by calculating the overall grayscale distribution of pixel units in a preset area. It can mainly calculate the grayscale histogram in a preset area to calculate the global contrast, such as using the variance of the grayscale histogram as a measure of contrast. In this example, the preset contrast can be set according to a specific application scenario. For example, the preset value of the global contrast can be set to 100, which is not limited by the embodiment of the present invention.

[0075] It should be noted that the recognition of texture complexity and contrast in the image to be embedded can also be achieved with the help of the AI ​​capabilities of the large model. For example, the complexity of each area of ​​the image can be identified based on the image recognition algorithm supplemented by the AI ​​large model capabilities to select areas with higher contrast. The embodiments of the present invention are not limited to this.

[0076] Optionally, when there are multiple selected embedding areas in a certain image to be embedded whose complexity of texture information exceeds a preset level, and / or whose contrast information exceeds a preset contrast, subsequent binary analysis and similarity calculation can be performed on the aforementioned multiple selected embedding areas; when brightness processing is subsequently performed on the selected embedding areas, one target selected embedding area can be arbitrarily selected from the aforementioned multiple selected embedding areas for brightness processing, or based on the calculated similarity information of each selected embedding area, the target selected embedding area with the highest similarity can be selected from the multiple selected embedding areas for brightness processing, and the embodiments of the present invention are not limited to this.

[0077] In one embodiment of the present invention, the selected embedding area in the image to be embedded is composed of pixel units, and the selected embedding area in the image to be embedded is parsed to obtain binary information of pixel units in the selected embedding area. Figure 3 As shown, the picture to be embedded, especially the selected embedding area in the picture to be embedded, can be parsed into a binary pattern to obtain binary information of pixel units in the picture to be embedded.

[0078] The binary information is used to indicate the relevant image information of the selected embedding area in the to-be-embedded image in binary mode, and can specifically be used to indicate the pixel data of each pixel unit of the selected embedding area in the to-be-embedded image, so as to be subsequently used to implement the image processing process based on pixel units.

[0079] Optionally, the selected embedding area may contain more than two colors. The division of dark and light colors of multiple colors can be achieved by geometric area division based on three-dimensional coordinate information.

[0080] Specifically, the color information of the pixel units in the selected embedded area can be obtained, and the color information can be normalized to obtain three-dimensional coordinate information. The aforementioned three-dimensional coordinate information can be mainly used to indicate the relative position relationship between the pixel points corresponding to the pixel units and the preset brightness area in the preset three-dimensional coordinate system. At this time, the brightness level of each pixel unit in the selected embedded area can be obtained based on the relative position relationship between each pixel point and the preset brightness area.

[0081] In a specific implementation, the target brightness area in which each pixel is located can be determined based on the relative position relationship between each pixel and the preset brightness area, and then different identifiers can be used to mark the pixel units corresponding to the pixel points located in different target brightness areas in the selected embedded area, thereby obtaining the brightness level of each pixel unit in the selected embedded area.

[0082] Optionally, the brightness area may be embodied as different geometric areas in a preset cube, and different geometric areas may be used to indicate different color levels.

[0083] Among them, the first geometric area can be a geometric area used to indicate that the color level is the first color level, the first color level can represent a dark block, the first identifier can be 1, and if the pixel point is in the first geometric area in the preset cube, the first identifier can be used to mark the pixel unit corresponding to the pixel point in the first geometric area in the selected embedded area.

[0084] The second geometric area can be a geometric area used to indicate that the color level is a second color level. The second color level can represent a light-colored block. The second identifier can be 0. If the pixel point is in the second geometric area in the preset cube, the second identifier can be used to mark the pixel unit corresponding to the pixel point in the second geometric area in the selected embedded area.

[0085] The third geometric area and the fourth geometric area may be geometric areas for indicating that the color level is between the first color level and the second color level, and the color level between the first color level and the second color level may represent a color block of either light or dark color.

[0086] As an example, different geometric regions in the preset cube may be represented as multiple region cubes in the preset cube, that is, each region cube in the preset cube corresponds to each geometric region one by one.

[0087] Optional, such as Figure 5A As shown, the preset cube can be an RGB color value cube, and multiple cubes can be nested in the preset cube (in Figure 5A Only one cube is shown in the figure, and the other cubes are not shown), the nested multiple cubes are regional cubes, and among the nested multiple regional cubes, the regional cubes can be marked according to their distribution positions in the preset cube.

[0088] Exemplarily, the marking can be performed based on the distribution position of the regional cube in the xy axis plane. For example, the regional cube located in the 1 / 3 part of the xy two-dimensional plane close to the y axis in the preset cube is marked as a dark cube, that is, as the first geometric area, and the corresponding pixel unit can be marked as 1 when marking it later; the regional cube located in the 1 / 3 part of the xy two-dimensional plane away from the y axis in the preset cube is marked as a light cube, that is, as the second geometric area, and the corresponding pixel unit can be marked as 0 when marking it later; the regional cube located in the middle part of the xy two-dimensional plane is marked as either dark or light, wherein the 1 / 2 cube part of the aforementioned regional cube away from the y axis can be used as the third geometric area, and the corresponding pixel unit can be marked as 1 / 0 when marking it later, and the 1 / 2 cube part close to the y axis can be used as the fourth geometric area, and the corresponding pixel unit can be marked as 0 / 1 when marking it later. It should be noted that there are other strategies for the division of geometric areas in the preset cube, and the number of cube nesting in the preset cube can be set based on actual needs, and the embodiments of the present invention do not limit this.

[0089] In practical applications, the color information of each pixel unit, that is, the RGB value, can be calculated, and a pixel point can be generated in a preset cube based on the aforementioned RGB value. Then, the straight-line distance between the generated pixel point and each cube nested in the preset cube can be calculated. The calculation method can be implemented using the distance algorithm between points and faces in the coordinate system. The specific identifier of the pixel unit corresponding to the pixel point in the selected embedded area can be determined by the area cube to which the pixel point has the shortest straight-line distance.

[0090] As another example, different geometric areas in a preset cube may be represented by dividing the preset cube based on RGB boundaries.

[0091] In practical applications, RGB values ​​are usually used to represent the pixel color of the image to be embedded, which is usually expressed as black (0,0,0) and white (255,255,255) in RGB. The three R, B, and G values ​​can correspond to the coordinate values ​​of the three coordinate axes in the three-dimensional coordinate system, or they can be imagined as a preset cube placed on the x, y, and z axes in the preset three-dimensional coordinate system.

[0092] Optional, such as Figure 5B As shown, the preset cube may include 8 vertices, for example, A(0,0,0), B(255,0,0), C(255,255,0), D(255,255,0), E(0,0,255), F(255,0,255), G(0,255,255), and H(255,255,255).

[0093] In the preset cube, assume that it is divided into 4 geometric areas, of which the first geometric area occupies 1 / 3, and the second, third and fourth geometric areas occupy 2 / 3 of the volume. The boundary of each geometric area can be defined. The first geometric area is expressed as 0≤R<85, 0≤G<85, 0≤B<85, defined as a dark block area, which is within 1 / 3 of the volume of the cube; in order to ensure the 2 / 3 volume of the cube, the second, third and fourth geometric areas can be divided, and the second geometric area is expressed as 85≤R<128, 0≤G<85, 0≤B<85, defined as a light block area.

[0094] Assuming that the color level indicated by the third geometric area is greater than the color level indicated by the fourth geometric area, the third geometric area can represent a color block closer to the dark area, and the boundary of its geometric area can be expressed as 128≤R≤170, 0≤G<85, 0≤B<85; the third identifier can be 1 / 0 to represent that the dark block can be processed into a light block. If the pixel point is in the third geometric area in the preset cube, the third identifier can be used to mark the pixel unit corresponding to the pixel point in the third geometric area in the selected embedded area.

[0095] The fourth geometric area can represent a color block that is closer to the light-colored area, and the boundary of its geometric area can be expressed as 170≤R<255, 0≤G<85, 0≤B<85; the fourth identifier can be 0 / 1, which is used to represent that the light-colored block can be processed into a dark-colored block. If the pixel point is in the fourth geometric area in the preset cube, the fourth identifier can be used to mark the pixel point located in the fourth geometric area and the corresponding pixel unit in the selected embedded area to obtain the binary information of the selected embedded area.

[0096] To convert RGB values ​​into corresponding binary expressions, the RGB normalization algorithm can be used, which can be specifically expressed as: r = R / (R+G+B). For example, after normalization, RGB (30, 60, 90) can be obtained as: r = (1 / 6, 1 / 3, 2 / 3). Its distribution point in the cube is close to the dark area and can be defined as 1 / 0, with dark colors preferred and light colors optional. For example, based on the above rules, the binary information of the selected embedding area to be embedded in the image can be as follows: Figure 4B shown.

[0097] In the embodiment of the present invention, the brightness level is inversely correlated with the color level, which is specifically manifested in that the higher the color level, the lower the brightness level, and the corresponding pixel unit usually has a need to brighten the brightness; the lower the color level, the higher the brightness level, and the corresponding pixel unit usually has a need to lower the brightness. For the pixel units corresponding to the pixel points located in the first geometric area, there is a need to increase the brightness; for the pixel units corresponding to the pixel points located in the second geometric area, there is a need to dim the brightness; for the pixel units corresponding to the pixel points located in the third geometric area, since their dark blocks can be processed into light blocks, there is a need to increase the brightness; for the pixel units corresponding to the pixel points located in the fourth geometric area, since their light blocks can be processed into dark blocks, there is a need to dim the brightness.

[0098] Step 204, performing brightness processing on the target selected embedding area in the image to be embedded according to the brightness level of the pixel unit in the two-dimensional code image and the brightness level of the pixel unit in the selected embedding area, to obtain a target image containing the two-dimensional code image.

[0099] The target image refers to the image to be embedded that contains the QR code image.

[0100] The binary information of the pixel units in the QR code image can be used to indicate the pixel data of each pixel unit in the QR code image, and the binary information of the selected embedded area can be used to indicate the pixel data of each pixel unit in the selected embedded area. At this time, the selected embedded area can be processed based on the pixel unit to obtain the target embedded area containing the QR code image, so as to directly generate the target image of the fused QR code image.

[0101] The processing of the selected embedding area based on the pixel unit can be specifically expressed as adjusting the pixel unit of the selected embedding area based on the pixel unit adjustment, thereby realizing the fusion of the two-dimensional code image in the image to be embedded.

[0102] like Figure 3 As shown, the image binary bitmap matching algorithm can be specifically used to perform similarity matching on the binary information of the pixel units in the two-dimensional code image and the binary information of the selected embedding area, which is specifically manifested in performing similarity matching on the brightness level of the pixel units in the two-dimensional code image and the brightness level of the pixel units in the selected embedding area to obtain similarity information, and based on the similarity information, the image to be embedded, especially the pixel points of the selected embedding area in the image to be embedded, are processed to generate the target image.

[0103] Binary similarity matching, as an example, can be performed by traversing the binary information of each pixel unit in the two-dimensional code image and the binary information of each pixel unit in the selected embedded area row by row and column by column, obtaining the number of first pixel units in the corresponding cell of the selected embedded area that are the same as the binary information of the pixel unit of the two-dimensional code image, and obtaining the number of second pixel units in the corresponding cell of the selected embedded area that are different from the binary information of the pixel unit of the two-dimensional code image, and then using the ratio of the first pixel unit number to the second pixel unit number as the similarity information to be embedded in the image and the binary pattern of the two-dimensional code image row by row and column by column, and for the ratio of the number of color blocks with the same matching result in the total number of color blocks and the ratio of the number of color blocks with inconsistent matching result in the total number of color blocks is greater than the preset similarity threshold, it can be determined that the binary pattern is similar. Among them, consistent binary bits refer to the same binary values ​​(i.e., identifications) of the pixel units of the two images at the same position, i.e., the corresponding cells, and inconsistent binary bits refer to different binary values ​​(i.e., identifications).

[0104] As Figure 4A The binary information of the QR code image shown is as follows Figure 4B Taking the binary information of the selected area in the picture to be embedded as an example, the ratio of the number of color blocks with consistent matching results can be 2 / 9, and the ratio of the number of color blocks with inconsistent matching results can be 7 / 9. Assuming that the preset similarity threshold is 1 / 3, it can be determined that the binary patterns of the two are not similar. At this time, the selected embedding area can be reselected from multiple candidate embedding areas to perform corresponding processing again.

[0105] As another example, the binary information of each pixel unit in the QR code image and the binary information of each pixel unit in the selected embedded area can be traversed row by row and column by column to obtain the number of first pixel units in the corresponding cells of the selected embedded area that are the same as the binary information of the pixel units of the QR code image, and the number of second pixel units in the corresponding cells of the selected embedded area that are different from the binary information of the pixel units of the QR code image, and then the ratio of the first pixel unit number to the second pixel unit number is used as the similarity information.

[0106] Specifically, the similarity information can be responded to exceeding a preset similarity threshold, that is, the similarity between the binary pattern of the QR code and the binary pattern of the image area exceeds a certain threshold, indicating that the QR code image can be embedded in the corresponding area of ​​the image to be embedded, and the brightness of the pixel unit of the selected embedding area can be adjusted.

[0107] In some embodiments of the present invention, when there are multiple selected embedding areas whose similarity information exceeds a preset similarity threshold, the target selected embedding area can be determined based on the similarity information of each selected embedding area, and the brightness of the pixel units of the target selected embedding area can be adjusted to obtain the target embedding area.

[0108] In a specific implementation, the similarity information includes a ratio value. At this time, the ratio values ​​of each selected embedding area can be arranged in order from large to small, and the selected embedding area at the first position is used as the target selected embedding area to adjust the brightness of the pixel units in the target selected area.

[0109] Among them, for brightness adjustment, the method of brightening the dark blocks and darkening the light blocks can be adopted. For example, the color of the QR code is not limited to black and white. This example takes the dark blocks as black and the light blocks as white. If the position of the QR code corresponding to a certain pixel unit in the selected embedded area is a black block, then the color of the corresponding pixel point in the selected embedded area can be darkened; if the position of the QR code corresponding to a certain pixel unit in the selected embedded area is a white block, then the color of the corresponding pixel point in the selected embedded area can be brightened; and for some areas that can be dark or light, that is, pixels marked as 1 / 0, 0 / 1 in the binary information of the selected embedded area, the depth of the pixel units in the selected embedded area can be processed according to the binary information of the QR code.

[0110] In practical applications, when specifically adjusting the brightness of the pixel units in the target selected embedded area, in order to avoid destroying the natural look and feel of the image, it is not necessarily necessary to adjust the brightness to be completely consistent with the brightness level of the pixels in the QR code image, and there is a range of adjustment. The specific brightness adjustment strategy can be implemented by combining the first brightness level of the pixel units currently to be adjusted in the target selected embedded area and the second brightness level of the pixel units in the cell corresponding to the pixel units currently to be adjusted in the QR code image, that is, the brightness of each pixel unit currently to be adjusted can be adjusted based on the first brightness level and the second brightness level to obtain the target embedded area.

[0111] Optionally, a brightness adjustment amplitude value can be obtained, and the obtained brightness adjustment amplitude value can be mainly used to reflect the brightness difference between the target selected embedded area and the two-dimensional code image. When the first brightness level is greater than the second brightness level, the difference between the brightness value of the current pixel unit to be adjusted and the brightness adjustment amplitude value can be calculated, and the brightness of the current pixel unit to be adjusted is adjusted according to the difference, that is, the difference is used as the brightness value of the current pixel unit to be adjusted after the brightness adjustment, so as to dim the brightness of the current pixel unit to be adjusted; when the first brightness level is less than the second brightness level, the sum of the brightness value of the current pixel unit to be adjusted and the brightness adjustment amplitude value can be calculated, and the brightness of the current pixel unit to be adjusted is adjusted according to the sum, that is, the sum is used as the brightness value of the current pixel point unit to be adjusted after the brightness adjustment, so as to brighten the brightness of the current pixel unit to be adjusted.

[0112] Exemplarily, the setting of the adjustment amplitude range can be achieved by setting a minimum adjustment amplitude △min and a maximum adjustment amplitude △max. The aforementioned adjustment amplitude range can be determined by experiments. For example, the minimum adjustment amplitude △min is 5 and the maximum adjustment amplitude △max is 10, so as to ensure that the image quality is not significantly affected but the two-dimensional code can still be recognized. The embodiment of the present invention does not limit this. Depending on the error correction level of the two-dimensional code unit and the texture complexity of the image, the brightness adjustment amplitude value △ can be calculated by the following formula:

[0113] △=△min+(△max-△min)*f(brightness difference)

[0114] Wherein, f (brightness difference) may be a function for mapping the brightness difference to the adjustment range. The embodiment of the present invention does not limit the specific function, as long as it is a function that can realize mapping the brightness difference to the adjustment range.

[0115] For a specific adjustment scheme, assume that the first brightness level of the pixel unit to be adjusted currently in the target selected embedding area is A1, and the second brightness level of the pixel unit in the cell corresponding to the pixel unit to be adjusted currently in the QR code image is A2. If A1 > A2, at this time, the pixel unit to be adjusted currently can be dimmed. Specifically, the brightness value a1 of the pixel unit to be adjusted currently can be obtained. The brightness value is specifically expressed as the gray value calculated based on the RGB values. At this time, the adjusted brightness value can be calculated through the following formula: a1_new = a1 - △; if A1 < A2, at this time, the pixel unit to be adjusted currently can be brightened. Specifically, the brightness value a1 of the pixel unit to be adjusted currently can be obtained. The brightness value is specifically expressed as the gray value calculated based on the RGB values. At this time, the adjusted brightness value can be calculated through the following formula: a1_new = a1 + △. It should be noted that when the first brightness level is equal to the second brightness level, whether it is brightening the dark block or dimming the light block, at this time, a strategy of not performing brightness adjustment can be adopted to quickly generate the target embedding area.

[0116] In a preferred embodiment of the present invention, when the similarity degree information exceeds the preset similarity degree threshold, in addition to performing brightness adjustment processing on the pixel units in the target selected embedding area, the pixel area edges of the pixel units with mismatched brightness levels in the selected embedding area can also be smoothed. That is, for the pixel points with mismatched pixel bits, a form of weakening the pixel area edge can be selected to make the pixel color closer to the pixel color of the pixel points in the picture to be embedded.

[0117] Among them, the brightness level is identified based on binary information. The pixel unit with mismatched brightness levels specifically refers to the pixel unit with inconsistent binary information. Specifically, the first pixel unit with different binary information from the pixel unit of the QR code image in the corresponding cell of the target selected embedding area can be obtained, and the second pixel unit with different binary information from the first pixel unit in the QR code image can be obtained. Then, the interpolation of the pixel color value of the first pixel unit and the pixel color value of the second pixel unit is calculated, and the interpolation is used as the pixel color value of the first pixel unit after smoothing processing to smooth the pixel area edge of the first pixel unit.

[0118] To ensure the transitional nature between the picture processing area and the non-processing area, that is, the edge pixels of the processing area should be naturally connected to the non-processing area. At this time, the pixel area edge can be weakened so that the pixel color difference is as small as possible.

[0119] Among them, the weakening of the edge of the pixel area is to achieve a smooth transition in the non-matching pixel area and reduce visual mutations. Usually, interpolation, smoothing or edge preservation methods can be used to make the pixel values ​​in the non-matching area smoother and reduce visual discontinuity, so that the processed image is closer to the original image. Exemplarily, the interpolation method used can be bilinear interpolation or bicubic interpolation; the smoothing method used can be Gaussian blur or mean filtering; the edge preservation method used can be bilateral filtering or guided filtering, which is not limited by the embodiments of the present invention.

[0120] It should be noted that the above-mentioned image processing is aimed at the selected embedding area in the image to be embedded, and other areas in the image are kept unchanged as much as possible, that is, the selected embedding area is the processing area, and other areas except the selected embedding area are non-processing areas.

[0121] In the embodiment of the present invention, the pixel of the target selected embedding area embedded with the two-dimensional code image can be adjusted, wherein other areas in the image to be embedded are kept unchanged as much as possible, and only the two-dimensional code image is used to replace the target embedding area, and the following is obtained: Figure 6 The final effect is shown in the figure.

[0122] Optionally, in order to ensure the recognizability of the QR code, the generated target image is saved in a format with as high quality as possible (eg, PNG format) to reduce distortion of the image QR code caused by compression.

[0123] In a preferred embodiment of the present invention, after obtaining the target image, image verification can also be performed, such as Figure 3 As shown, it can be manifested as using a QR code recognition algorithm to recognize the target image containing the QR code image after generation, and judging whether the QR code is recognized successfully. If the recognition is successful, that is, the extracted QR code information is consistent with the original information, then it can be indicated that the generated target image is the final image to be obtained; if the recognition fails, it is necessary to reselect the selected embedding area from multiple candidate embedding areas to perform the above-mentioned image parsing, binary bitmap matching, pixel processing and other processing again, wherein the QR code recognition algorithm can also be combined to optimize the range of the unrecognized area, and the pixels of this part of the area are adjusted and optimized, and the generation and recognition are repeated until a target image with a higher recognition degree is generated. This is not limited in this embodiment of the present invention.

[0124] In the field where the aesthetics of pictures are required to be high, different QR codes can be embedded, such as embedding QR code information in movie and TV program posters, so that the pictures or movie clips carry more information without affecting the visual effects of the pictures, and the gameplay is more diverse, which is more conducive to marketing and promotion. Optionally, different QR codes can also be embedded in different areas of the picture, such as different QR code information for different star areas in movie and TV program posters, and the picture to be embedded can also be a picture obtained by using a screenshot operation, which is not limited by the embodiments of the present invention.

[0125] In an embodiment of the present invention, after determining the selected embedding area of ​​the two-dimensional code image in the image to be embedded, brightness processing is performed on the selected embedding area according to the brightness level of the pixel unit in the two-dimensional code image and the brightness level of the pixel unit in the selected embedding area, so as to obtain a target embedding area containing the two-dimensional code image, so as to directly obtain a target image containing the two-dimensional code image. Based on the binary information of the pixel unit in the two-dimensional code image and the binary information of the pixel unit in the selected embedding area, the brightness processing is performed on the selected embedding area in the original image, and the target image containing the two-dimensional code image is directly fused without significantly affecting the image effect, which is suitable for applications of two-dimensional code embedded images with high requirements for image aesthetics.

[0126] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0127] Reference Figure 7 , shows a structural block diagram of an embodiment of a picture processing device in an embodiment of the present invention, which may specifically include the following modules:

[0128] The embedding area determination module 701 is used to obtain a two-dimensional code image and a picture to be embedded, and determine a selected embedding area of ​​the two-dimensional code image in the picture to be embedded;

[0129] An image parsing module 702 is used to obtain binary information of pixel units in the two-dimensional code image and binary information of pixel units in the selected embedding area; the binary information is used to indicate the brightness level of the corresponding pixel unit;

[0130] The embedded area processing module 703 is used to perform brightness processing on the selected embedded area according to the brightness level of the pixel unit in the two-dimensional code image and the brightness level of the pixel unit in the selected embedded area to obtain a target embedded area; the similarity between the pixel distribution of the target embedded area and the two-dimensional code image exceeds a preset similarity threshold.

[0131] In one embodiment of the present invention, the embedding area determination module 701 may include the following submodules:

[0132] A selected embedding area determination submodule is used to obtain image information of each preset area in the image to be embedded; the image information includes at least one of texture information and contrast information; based on the texture information and / or the contrast information satisfying preset conditions, at least one selected embedding area is obtained from each preset area.

[0133] In an embodiment of the present invention, the embedding area determination module 701 may further include the following submodules:

[0134] The two-dimensional code image correction submodule is used to obtain the size information of the selected embedding area; and to correct the proportion of the two-dimensional code image according to the size information.

[0135] In one embodiment of the present invention, the two-dimensional code image is composed of pixel units of different color levels; the image parsing module 702 may include the following submodules:

[0136] The first image parsing submodule is used to use a first identifier to mark pixel units in the two-dimensional code image whose color level is a first color level; and / or, use a second identifier to mark pixel units in the two-dimensional code image whose color level is a second color level, to obtain the brightness level of each pixel unit in the two-dimensional code image; the brightness level is inversely correlated with the color level.

[0137] In one embodiment of the present invention, the image parsing module 702 may include the following submodules:

[0138] The second image parsing submodule is used to obtain color information of pixel units in the selected embedded area; normalize the color information to obtain three-dimensional coordinate information; the three-dimensional coordinate information is used to indicate the relative position relationship between the pixel point corresponding to the pixel unit and the preset brightness area in the preset three-dimensional coordinate system; based on the relative position relationship between each pixel point and the preset brightness area, the brightness level of each pixel unit in the selected embedded area is obtained.

[0139] In one embodiment of the present invention, the second image parsing submodule may include the following units:

[0140] The brightness level determination unit is used to determine the target brightness area where each pixel point is located based on the relative position relationship between the each pixel point and the preset brightness area; and use different identifiers to mark the pixel units corresponding to the pixel points located in different target brightness areas in the selected embedded area.

[0141] In one embodiment of the present invention, the embedded region processing module 703 may include the following submodules:

[0142] The embedded area processing submodule is used to perform similarity matching on the brightness level of the pixel unit in the two-dimensional code image and the brightness level of the pixel unit in the selected embedded area to obtain similarity information; in response to the similarity information exceeding a preset similarity threshold, the brightness of the pixel unit in the selected embedded area is adjusted to obtain the target embedded area.

[0143] In one embodiment of the present invention, the embedded region processing submodule may include the following units:

[0144] A target embedding area acquisition unit is used to respond to the number of selected embedding areas whose similarity information exceeds a preset similarity threshold, determine a target selected embedding area based on the similarity information of each of the selected embedding areas; and adjust the brightness of the pixel units of the target selected embedding area to obtain the target embedding area.

[0145] In one embodiment of the present invention, the target embedding area acquisition unit may include the following subunits:

[0146] The target embedding area acquisition subunit is used to arrange the proportion values ​​of each of the selected embedding areas in order from large to small, and take the selected embedding area at the first position as the target selected embedding area.

[0147] In one embodiment of the present invention, the embedded region processing submodule may include the following units:

[0148] The embedded area processing unit is used to obtain the first brightness level of the pixel unit currently to be adjusted in the target selected embedded area, and to obtain the second brightness level of the pixel unit of the cell corresponding to the pixel unit currently to be adjusted in the QR code image; based on the first brightness level and the second brightness level, the brightness of each pixel unit currently to be adjusted is adjusted to obtain the target embedded area.

[0149] In one embodiment of the present invention, the embedded region processing unit may include the following sub-units:

[0150] The embedded area processing subunit is used to obtain a brightness adjustment amplitude value, and the brightness adjustment amplitude value is used to reflect the brightness difference between the target selected embedded area and the two-dimensional code image; if the first brightness level is greater than the second brightness level, the difference between the brightness value of the pixel unit to be adjusted and the brightness adjustment amplitude value is calculated, and the difference is used as the brightness value of the pixel unit to be adjusted after the brightness adjustment, so as to dim the brightness of the pixel unit to be adjusted; and / or, if the first brightness level is less than the second brightness level, the sum of the brightness value of the pixel unit to be adjusted and the brightness adjustment amplitude value is calculated, and the sum is used as the brightness value of the pixel point unit to be adjusted after the brightness adjustment, so as to brighten the brightness of the pixel unit to be adjusted.

[0151] In one embodiment of the present invention, the embedded region processing submodule may further include the following units:

[0152] The smoothing processing unit is used to smooth the edge of the pixel area of ​​the pixel unit with mismatched brightness level in the target selected embedding area when the similarity information exceeds a preset similarity threshold.

[0153] In an embodiment of the present invention, the brightness level is identified based on the binary information; the smoothing processing unit may include the following subunits:

[0154] A smoothing subunit is used to obtain a first pixel unit whose binary information is different from that of a pixel unit of the two-dimensional code image in a corresponding cell of the target selected embedded area, and a second pixel unit whose binary information is different from that of the first pixel unit in the two-dimensional code image; calculate an interpolation of a pixel color value of the first pixel unit and a pixel color value of the second pixel unit, and use the interpolation as the pixel color value of the first pixel unit after smoothing, so as to smooth the edge of the pixel area of ​​the first pixel unit.

[0155] In an embodiment of the present invention, the image processing device provided by the embodiment of the present invention performs brightness processing on the selected embedding area after determining the selected embedding area of ​​the two-dimensional code image in the image to be embedded, according to the brightness level of the pixel unit in the two-dimensional code image and the brightness level of the pixel unit in the selected embedding area, to obtain a target embedding area containing the two-dimensional code image, so as to directly obtain a target image containing the two-dimensional code image. Based on the binary information of the pixel unit in the two-dimensional code image and the binary information of the pixel unit in the selected embedding area, the brightness processing is performed on the selected embedding area in the original image, and the target image containing the two-dimensional code image is directly fused without significantly affecting the image effect, which is suitable for applications of two-dimensional code embedded images with high requirements for image aesthetics.

[0156] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0157] The embodiment of the present invention further provides an electronic device, such as Figure 8 As shown, it includes a processor 801, a communication interface 802, a memory 803 and a communication bus 804, wherein the processor 801, the communication interface 802, and the memory 803 communicate with each other through the communication bus 804.

[0158] Memory 803, used for storing computer programs;

[0159] The processor 801 is used to execute the program stored in the memory 803, and implements the following steps:

[0160] Obtain a QR code image and a picture to be embedded, and determine a selected embedding area of ​​the QR code image in the picture to be embedded;

[0161] Obtaining binary information of pixel units in the two-dimensional code image and binary information of pixel units in the selected embedding area; the binary information is used to indicate the brightness level of the corresponding pixel unit;

[0162] According to the brightness level of the pixel units in the two-dimensional code image and the brightness level of the pixel units in the selected embedded area, the selected embedded area is subjected to brightness processing to obtain a target embedded area; the degree of similarity between the pixel distribution of the target embedded area and the two-dimensional code image exceeds a preset similarity threshold.

[0163] In an embodiment of the present invention, the electronic device provided by the embodiment of the present invention performs brightness processing on the selected embedding area after determining the selected embedding area of ​​the two-dimensional code image in the image to be embedded, according to the brightness level of the pixel unit in the two-dimensional code image and the brightness level of the pixel unit in the selected embedding area, to obtain a target embedding area containing the two-dimensional code image, so as to directly obtain a target image containing the two-dimensional code image. Based on the binary information of the pixel unit in the two-dimensional code image and the binary information of the pixel unit in the selected embedding area, the selected embedding area in the original image is brightness processed, and the target image containing the two-dimensional code image is directly fused without significantly affecting the image effect, which is suitable for applications of two-dimensional code embedded images with high requirements for image aesthetics.

[0164] The communication bus mentioned in the above terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0165] The communication interface is used for communication between the above terminal and other devices.

[0166] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0167] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0168] In another embodiment of the present invention, a computer-readable storage medium is provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the image processing method described in any one of the above embodiments.

[0169] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the image processing method described in any one of the above embodiments.

[0170] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented by software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present invention is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center to another website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk Solid State Disk (SSD)), etc.

[0171] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0172] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0173] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A method for processing an image, characterized in that: The method comprises: Obtain a QR code image and a picture to be embedded, and determine a selected embedding area of ​​the QR code image in the picture to be embedded; Obtaining binary information of pixel units in the two-dimensional code image and binary information of pixel units in the selected embedding area; the binary information is used to indicate the brightness level of the corresponding pixel unit; According to the brightness level of the pixel units in the two-dimensional code image and the brightness level of the pixel units in the selected embedded area, the selected embedded area is subjected to brightness processing to obtain a target embedded area; the degree of similarity between the pixel distribution of the target embedded area and the two-dimensional code image exceeds a preset similarity threshold.

2. The method according to claim 1, characterized in that The determining of the selected embedding area of ​​the two-dimensional code image in the image to be embedded includes: Acquire image information of each preset area in the image to be embedded; the image information includes at least one of texture information and contrast information; Based on the texture information and / or the contrast information satisfying a preset condition, at least one selected embedding area is obtained from each of the preset areas.

3. The method according to claim 2, characterized in that After getting the selected embedding area, also include: Obtaining size information of the selected embedding area; The proportion of the two-dimensional code image is corrected according to the size information.

4. The method according to claim 1, characterized in that: The two-dimensional code image is composed of pixel units based on different color levels; obtaining binary information of the pixel units in the two-dimensional code image includes: A first identifier is used to mark pixel units in the two-dimensional code image whose color level is a first color level; and / or a second identifier is used to mark pixel units in the two-dimensional code image whose color level is a second color level, to obtain the brightness level of each pixel unit in the two-dimensional code image; the brightness level is inversely correlated with the color level.

5. The method according to claim 1, characterized in that Obtaining binary information of pixel units in the selected embedding area includes: Acquire color information of pixel units in the selected embedding area; Normalizing the color information to obtain three-dimensional coordinate information; the three-dimensional coordinate information is used to indicate the relative position relationship between the pixel point corresponding to the pixel unit and the preset brightness area in a preset three-dimensional coordinate system; Based on the relative position relationship between each pixel point and the preset brightness area, the brightness level of each pixel unit in the selected embedding area is obtained.

6. The method according to claim 5, characterized in that The step of obtaining the brightness level of each pixel unit in the selected embedding area based on the relative position relationship between each pixel point and the preset brightness area includes: Based on the relative position relationship between each pixel point and the preset brightness area, determining the target brightness area where each pixel point is located; Different identifiers are used to mark the pixel units corresponding to the pixel points located in different target brightness areas in the selected embedding area.

7. The method according to claim 1, characterized in that The step of performing brightness processing on the selected embedding area according to the brightness level of the pixel unit in the two-dimensional code image and the brightness level of the pixel unit in the selected embedding area to obtain the target embedding area includes: Performing similarity matching on the brightness level of the pixel unit in the two-dimensional code image and the brightness level of the pixel unit in the selected embedding area to obtain similarity information; In response to the similarity information exceeding a preset similarity threshold, brightness is adjusted for the pixel units of the selected embedding area to obtain a target embedding area.

8. The method according to claim 7, characterized in that In response to the similarity information exceeding a preset similarity threshold, brightness adjustment is performed on the pixel unit of the selected embedding area to obtain the target embedding area, including: In response to the number of selected embedding regions whose similarity information exceeds a preset similarity threshold being multiple, determining a target selected embedding region based on the similarity information of each of the selected embedding regions; The brightness of the pixel unit of the target selected embedding area is adjusted to obtain the target embedding area.

9. The method according to claim 8, characterized in that The similarity information includes a ratio value, and determining the target selected embedding area based on the similarity information of each selected embedding area includes: The proportion values ​​of the selected embedding areas are arranged in order from large to small, and the selected embedding area at the first position is used as the target selected embedding area.

10. The method according to claim 8, characterized in that The step of adjusting the brightness of the pixel unit of the target selected embedding area to obtain the target embedding area includes: Obtaining a first brightness level of a pixel unit to be adjusted currently in the target selected embedding area, and obtaining a second brightness level of a pixel unit in a cell corresponding to the pixel unit to be adjusted currently in the two-dimensional code image; Based on the first brightness level and the second brightness level, brightness of each pixel unit to be adjusted is adjusted to obtain a target embedding area.

11. The method according to claim 10, characterized in that The step of adjusting the brightness of each pixel unit to be adjusted based on the first brightness level and the second brightness level includes: Acquire a brightness adjustment amplitude value, where the brightness adjustment amplitude value is used to reflect the brightness difference between the target selected embedding area and the two-dimensional code image; If the first brightness level is greater than the second brightness level, the difference between the brightness value of the pixel unit to be adjusted and the brightness adjustment amplitude value is calculated, and the difference is used as the brightness value of the pixel unit to be adjusted after the brightness adjustment, so as to dim the brightness of the pixel unit to be adjusted; And / or, if the first brightness level is less than the second brightness level, the sum of the brightness value of the pixel unit to be adjusted and the brightness adjustment amplitude value is calculated, and the sum is used as the brightness value of the pixel unit to be adjusted after brightness adjustment, so as to brighten the brightness of the pixel unit to be adjusted.

12. The method according to claim 10 or 11, characterized in that: The method further comprises: adjusting the brightness of each pixel unit to be adjusted based on the first brightness level and the second brightness level to obtain a target embedding area; When the similarity information exceeds a preset similarity threshold, a smoothing process is performed on the edge of the pixel area of ​​the pixel units with mismatched brightness levels in the target selected embedding area.

13. The method according to claim 12, characterized in that The brightness level is identified based on the binary information; and the pixel area edge of the pixel unit with mismatched brightness level in the target selected embedding area is smoothed, comprising: Acquire a first pixel unit having binary information different from that of a pixel unit of the two-dimensional code image in a corresponding cell of the target selected embedding area, and a second pixel unit having binary information different from that of the first pixel unit in the two-dimensional code image; An interpolation value of a pixel color value of the first pixel unit and a pixel color value of the second pixel unit is calculated, and the interpolation value is used as the pixel color value of the first pixel unit after smoothing, so as to smooth an edge of a pixel region of the first pixel unit.

14. A picture processing device, characterized in that: The device comprises: An embedding area determination module, used to obtain a two-dimensional code image and a picture to be embedded, and determine a selected embedding area of ​​the two-dimensional code image in the picture to be embedded; An image parsing module, used to obtain binary information of pixel units in the two-dimensional code image and binary information of pixel units in the selected embedding area; the binary information is used to indicate the brightness level of the corresponding pixel unit; The embedded area processing module is used to perform brightness processing on the selected embedded area according to the brightness level of the pixel unit in the two-dimensional code image and the brightness level of the pixel unit in the selected embedded area to obtain a target embedded area; the similarity between the pixel distribution of the target embedded area and the two-dimensional code image exceeds a preset similarity threshold.

15. An electronic device, characterized in that: It includes a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other through the communication bus; Memory, used to store computer programs; The processor is used to implement the image processing method described in any one of claims 1-13 when executing the program stored in the memory.

16. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the image processing method as described in any one of claims 1 to 13 is implemented.