A method and system for preventing the unauthorized use of e-commerce images
By embedding watermarks in the intermediate frequency coefficient of the Y channel of the image, discrete cosine transformation and Frobenius norm sorting, the watermark distortion problem of e-commerce images under complex attacks is solved, and the robustness and concealment of anti-theft are improved.
Patent Information
- Application Number
- CN202411474090.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-22
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2044-10-22
AI Technical Summary
When existing image watermarking technology faces complex attacks, especially when image content is compressed, cropped or geometrically transformed, the watermark information is easily distorted or lost, and cannot effectively prevent e-commerce images from being stolen.
Embed the watermark into the Y-channel IF coefficient of the image, and select the IF coefficient of the target sub-image block through discrete cosine transformation and Frobenius norm sorting. Dynamically adjust the difference in a specific interval to embed bits, improving robustness.
It increases the difficulty of e-commerce images being stolen, and there is no need to know the location of the target image block and medium frequency coefficient in advance, keeping the visual effect unchanged, and improving the watermark's ability to resist attacks.
Smart Images

Figure CN119313535B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of image information processing, and specifically provides a method and system for preventing the unauthorized use of e-commerce pictures. Background Art
[0002] In recent years, e-commerce has developed rapidly. Especially with the continuous maturity of Internet technology and logistics systems, online shopping has become one of the main consumption methods for global consumers. The popularization of mobile Internet, the application of 5G technology, and the support of big data and artificial intelligence have further promoted the intelligence and personalized services of e-commerce platforms. At the same time, new models such as live e-commerce and social e-commerce have emerged, with a significant increase in user participation and a more diversified shopping experience. In the process of e-commerce development, pictures play a crucial role. High-definition and high-quality product pictures can not only intuitively display the appearance and details of products, enhancing users' shopping confidence, but also influence consumers' purchase decisions. On e-commerce platforms, consumers cannot directly touch the products, and vision has become the main way to understand the goods. In addition, high-quality pictures can also enhance the brand image, improve the user experience, and reduce after-sales disputes.
[0003] Regarding the original pictures taken by merchants with a large amount of energy and funds, some small merchants use them directly without authorization, which not only affects the interests of the original merchants but also disrupts the market order. As an effective image protection means, image watermarking technology can embed copyright information or authentication information into images, which can not only provide legal basis for the owners of images but also effectively verify the authenticity and integrity of images. Although traditional watermarking schemes have certain anti-attack capabilities, they still have certain limitations when facing various complex attacks. Especially when the image content is subjected to strong compression, cropping, or geometric transformation attacks, the watermark information is often prone to distortion or loss. Summary of the Invention
[0004] Aiming at reducing the possibility of unauthorized use of e-commerce pictures, the present invention provides a method for preventing the unauthorized use of e-commerce pictures, and the method includes the following steps:
[0005] Obtain a watermark and a carrier image to which the watermark is to be added, convert the watermark into a binary sequence, and convert the carrier image into the YCbCr color space; divide the Y channel into multiple non-overlapping image blocks of the same size, and further divide each image block into multiple non-overlapping sub-image blocks of the same size;
[0006] Perform a discrete cosine transform on the sub-image blocks to obtain the DCT coefficient matrix of the sub-image blocks, and select two target sub-image blocks from the multiple sub-image blocks based on the DCT coefficient matrix of the sub-image blocks; determine the target intermediate frequency coefficients of each target sub-image block, and adjust the two target intermediate frequency coefficients so that the difference between the two target intermediate frequency coefficients is within the interval corresponding to the bit to be embedded;
[0007] After all the bits to be embedded are embedded, perform an inverse discrete cosine transform on all the sub-image blocks to obtain the Y channel, and combine the Y channel with the original Cb and Cr channels and transform them to the RGB channel to obtain the watermarked image.
[0008] Preferably, the step of selecting two target sub-image blocks from the multiple sub-image blocks based on the DCT coefficient matrix of the sub-image blocks is specifically:
[0009] Calculate the Frobenius norm of the DCT coefficient matrix of each sub-image block of the image block or the DCT coefficient matrix without boundaries;
[0010] Sort the sub-image blocks in descending order according to the Frobenius norm;
[0011] Take the first two image blocks after sorting as the target sub-image blocks.
[0012] Preferably, the step of determining the target intermediate frequency coefficients of each target sub-image block is specifically:
[0013] Obtain the image block to which the target sub-image block belongs, and perform downsampling to obtain an image block with the same size as the target sub-image block;
[0014] Perform a discrete cosine transform on the downsampled image block to obtain the DCT coefficient matrix of the downsampled image block;
[0015] Obtain the positions of the two maximum values in the intermediate frequency region of the DCT coefficient matrix of the downsampled image block;
[0016] Take the positions of the two maximum values as the positions of the target intermediate frequency coefficients of the two target sub-image blocks.
[0017] Preferably, the determination method of the intermediate frequency region is:
[0018] Obtain the size n×n of the DCT coefficient matrix of the downsampled image block, and take the k×k element region in the central region of the DCT coefficient matrix of the downsampled image block as the intermediate frequency region, where k = n - 1 or k = n - 2.
[0019] Preferably, the step of adjusting the two intermediate frequency coefficients so that the difference between the two intermediate frequency coefficients is within the interval corresponding to the bit to be embedded is specifically:
[0020] Pre-divide 2M intervals, where the intervals with even serial numbers are the intervals corresponding to 0, and the intervals with odd serial numbers are the intervals corresponding to 0, and M is a positive integer greater than or equal to 2;
[0021] Calculate the difference between the target intermediate frequency coefficients of the two target sub-image blocks;
[0022] If the bit to be embedded is 0, find the interval with an even serial number that is closest to the difference, calculate the median of the found interval, and adjust one or both of the target intermediate frequency coefficients of the two target sub-image blocks so that the difference between them is the median;
[0023] If the bit to be embedded is 1, find the interval with an odd serial number that is closest to the difference, calculate the median of the found interval, and adjust one or both of the target intermediate frequency coefficients of the two target sub-image blocks so that the difference between them is the median.
[0024] In addition, the present invention also provides a system for preventing e-commerce pictures from being misappropriated, and the system includes the following modules:
[0025] A segmentation module, configured to obtain a watermark and a carrier image to which the watermark is to be added, convert the watermark into a binary sequence, and convert the carrier image into the YCbCr color space; divide the Y channel into a plurality of non-overlapping image blocks of the same size, and further divide each image block into a plurality of non-overlapping sub-image blocks of the same size;
[0026] A watermark addition module, configured to perform a discrete cosine transform on the sub-image blocks to obtain a DCT coefficient matrix of the sub-image blocks, select two target sub-image blocks from the plurality of sub-image blocks based on the DCT coefficient matrix of the sub-image blocks; determine the target intermediate frequency coefficients of each target sub-image block, and adjust the two target intermediate frequency coefficients so that the difference between the two target intermediate frequency coefficients is within the interval corresponding to the bit to be embedded;
[0027] An inverse transform module, configured to perform an inverse discrete cosine transform on all the sub-image blocks after all the bits to be embedded are embedded to obtain the Y channel, and combine the Y channel with the original Cb and Cr channels and then transform them into the RGB channel to obtain the image with the watermark added.
[0028] Preferably, the step of selecting two target sub-image blocks from the plurality of sub-image blocks based on the DCT coefficient matrix of the sub-image blocks is specifically:
[0029] Calculate the Frobenius norm of the DCT coefficient matrix of each sub-image block of the image block or the DCT coefficient matrix without boundaries;
[0030] Sort the sub-image blocks in descending order according to the Frobenius norm;
[0031] Take the first two image blocks after sorting as the target sub-image blocks.
[0032] Preferably, the determination of the target intermediate frequency coefficients of each target sub-image block is specifically as follows:
[0033] Obtain the image block to which the target sub-image block belongs, and perform downsampling to obtain an image block with the same size as the target sub-image block;
[0034] Perform discrete cosine transform on the downsampled image block to obtain the DCT coefficient matrix of the downsampled image block;
[0035] Obtain the positions of the two maximum values in the intermediate frequency region of the DCT coefficient matrix of the downsampled image block;
[0036] Take the positions of the two maximum values as the positions of the target intermediate frequency coefficients of the two target sub-image blocks.
[0037] Preferably, the determination method of the intermediate frequency region is as follows:
[0038] Obtain the size n×n of the DCT coefficient matrix of the downsampled image block, and take the k×k element region in the central region of the DCT coefficient matrix of the downsampled image block as the intermediate frequency region, where k = n - 1 or k = n - 2.
[0039] Preferably, the adjustment of the two intermediate frequency coefficients is such that the difference between the two intermediate frequency coefficients is within the interval corresponding to the bit to be embedded, specifically as follows:
[0040] Pre-divide 2M intervals, where the intervals with even serial numbers are the intervals corresponding to 0, and the intervals with odd serial numbers are the intervals corresponding to 0, and M is a positive integer greater than or equal to 2;
[0041] Calculate the difference between the target intermediate frequency coefficients of the two target sub-image blocks;
[0042] If the bit to be embedded is 0, find the interval with an even serial number that is closest to the difference, calculate the median of the found interval, and adjust one or both of the target intermediate frequency coefficients of the two target sub-image blocks so that the difference between them is the median;
[0043] If the bit to be embedded is 1, find the interval with an odd serial number that is closest to the difference, calculate the median of the found interval, and adjust one or both of the target intermediate frequency coefficients of the two target sub-image blocks so that the difference between them is the median.
[0044] Regarding the problem that e-commerce pictures are easily stolen, the present invention embeds the bits of the watermark to be embedded into the intermediate frequency coefficients of the Y channel of the image, and dynamically determines the target sub-image blocks and intermediate frequency coefficients, which not only increases the difficulty of being stolen, but also does not require prior knowledge of the numbers of the target image blocks and the positions of the intermediate frequency coefficients. Description of the Drawings
[0045] Figure 1 It is a flowchart of the first embodiment;
[0046] Figure 2 It shows the pseudocode of the present invention;
[0047] Figure 3 It is the process of adding the watermark;
[0048] Figure 4 It is the structural diagram of the second embodiment. Detailed Embodiments
[0049] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention. In addition, the technical features in each embodiment or individual embodiment provided by the present invention can be combined with each other arbitrarily to form a feasible technical solution. Such combination is not restricted by the order of steps and / or the pattern of structural composition, but must be based on the fact that those of ordinary skill in the art can implement it. When the combination of technical solutions results in contradictions or cannot be implemented, it should be considered that such combination of technical solutions does not exist and is not within the protection scope required by the present invention. If there are step numbers in the following embodiments, they are only set for the convenience of explanation and illustration, and no limitation is imposed on the order of steps. The execution order of each step in the embodiments can be adaptively adjusted according to the understanding of those skilled in the art.
[0050] Figure 1 The first aspect of the present invention is shown. The present invention provides a method for preventing e-commerce pictures from being stolen, and the method includes the following steps:
[0051] S1, obtain the watermark and the carrier image to which the watermark is to be added, convert the watermark into a binary sequence, and convert the carrier image into the YCbCr color space; divide the Y channel into multiple non-overlapping image blocks of the same size, and further divide each image block into multiple non-overlapping sub-image blocks of the same size;
[0052] When adding a watermark to an image, first obtain the watermark to be added and the carrier image. The watermark can be text, a string, a number, a picture, etc. Convert the watermark into a binary sequence. For example, if the watermark to be embedded is the letter 'a', its corresponding binary sequence is 01100001 00001010. The binary sequence consists of multiple 0s and 1s, and each binary digit is a bit. Convert the carrier image into the YCbCr color space. In the YCbCr color space, Y is the luminance channel, Cb is the blue component, and Cr is the red component. Specifically, it is converted by the method of rgb2ycbcr(carrier image). Then extract the Y channel, and divide the Y-channel image into multiple non-overlapping image blocks of the same size. Preferably, the size of the image block is 16×16, and each image block is further divided into multiple sub-image blocks. The sub-image blocks do not overlap with each other and have the same size. Preferably, the size of the sub-image block is 8×8.
[0053] S2. Perform a discrete cosine transform on the sub-image blocks to obtain the DCT coefficient matrix of the sub-image blocks. Select two target sub-image blocks from the multiple sub-image blocks based on the DCT coefficient matrix of the sub-image blocks; determine the target intermediate-frequency coefficients of each target sub-image block, and adjust the two target intermediate-frequency coefficients so that the difference between the two target intermediate-frequency coefficients is within the interval corresponding to the bit to be embedded;
[0054] Perform a discrete cosine transform (DCT) on each sub-image block to obtain the DCT coefficient matrix of the sub-image block. The DCT coefficient matrix of the sub-image block is the same size as the sub-image block. For example, if the size of the sub-image block is 8×8, the DCT coefficient matrix is also 8×8. In the DCT coefficient matrix, the upper left corner represents the low-frequency component, and the lower right corner represents the high-frequency component. The low-frequency component is the overall information of the sub-image block, such as the overall luminance information, and the high-frequency component is the detailed information of the sub-image block. Changing the high-frequency and low-frequency components has a greater impact on the visual effect of the image. Moreover, when an attacker changes the image brightness, blurs the image, etc., it is mainly the high-frequency and low-frequency components that are changed. In order to keep the change in the carrier image before and after watermark embedding, especially the visual effect change is not significant and to improve the robustness, the watermark is embedded into the intermediate-frequency component. For sub-image blocks with relatively small intermediate-frequency components, when changing by a certain amplitude, the impact is greater than that of sub-image blocks with larger intermediate-frequency components. For example, if the original intermediate-frequency component is 4 and it is increased by 1, the change amount is 25%, while if the original intermediate-frequency component is 20 and it is increased by 1, the change amount is 5%. An image block has multiple sub-image blocks. Select two target sub-image blocks from the multiple sub-image blocks. In one embodiment, the method of selecting two target sub-image blocks from the multiple sub-image blocks based on the DCT coefficient matrix of the sub-image blocks is specifically as follows:
[0055] Calculate the Frobenius norm of the DCT coefficient matrix of each sub-image block of the image block or the DCT coefficient matrix without boundaries;
[0056] Sort the sub-image blocks in descending order according to the Frobenius norm;
[0057] Take the first two image blocks after sorting as the target sub-image blocks.
[0058] Calculate the Frobenius norm of the DCT coefficient matrix of each sub-image block, that is, calculate the square root of the sum of the squares of each element in the DCT coefficient matrix. Since it is necessary to select the one with a larger intermediate frequency coefficient region from multiple sub-image blocks, in another embodiment, the Frobenius norm is calculated after removing the boundaries of the DCT coefficient matrix. Specifically, removing the boundaries means removing the first row, the last row, the first column, and the last column.
[0059] After calculating the Frobenius norm, sort the sub-image blocks in descending order of the norm. Suppose there are 4 sub-image blocks B1 - B4, and after sorting, they are B3, B1, B2, B4. Then take the first two image blocks B3 and B1 as the target sub-image blocks.
[0060] When embedding the bit sequence, the intermediate frequency components in the DCT coefficient matrix of the target sub-image block are changed. In the DCT coefficient matrix, there are multiple frequency components. Taking the sub-image block size of 8×8 as an example, its DCT coefficient matrix is also 8×8. For each frequency component in the DCT coefficient matrix, it is denoted as C(i, j), where 1 ≤ i, j ≤ 8. In one embodiment, the central region of the DCT coefficient matrix is used as the intermediate frequency region. In one embodiment, the determination method of the intermediate frequency region is as follows:
[0061] Obtain the size n×n of the DCT coefficient matrix of the downsampled image block, and use the k×k element region located in the central region of the DCT coefficient matrix of the downsampled image block as the intermediate frequency region, where k = n - 1 or k = n - 2. More specifically, in the DCT coefficient matrix, the region composed of {C(i, j)∣2 ≤ i, j ≤ n - 1} or {C(i, j)∣3 ≤ i, j ≤ m - 2} is used as the intermediate frequency region. Still taking the above example, n = 8, then the intermediate frequency region is the region composed of {C(i, j)∣2 ≤ i, j ≤ 7} or {C(i, j)∣3 ≤ i, j ≤ 6} in the DCT coefficient matrix.
[0062] In the obtained intermediate frequency region, the target intermediate frequency coefficients of each target sub-image block are determined from the intermediate frequency region. In one embodiment, the target intermediate frequency coefficients are pre-determined. For example, the target intermediate frequency coefficient of the first target sub-image block is the coefficient corresponding to the position C(3, 5) in the DCT coefficient matrix of the first target sub-image block. For this method, when performing watermark extraction, the positions of these two intermediate frequency coefficients need to be known in advance.
[0063] Similarly, in order to be able to keep the change of the carrier image before and after watermark embedding, especially the visual effect change is not significant, and to improve the robustness, in another embodiment, the determination of the target intermediate frequency coefficients of each target sub-image block is specifically as follows:
[0064] Obtain the image block to which the target sub-image block belongs, and perform downsampling to obtain an image block with the same size as the target sub-image block;
[0065] Perform discrete cosine transform on the downsampled image block to obtain the DCT coefficient matrix of the downsampled image block;
[0066] Obtain the positions of the two maximum values in the intermediate frequency region of the DCT coefficient matrix of the downsampled image block;
[0067] Take the positions of the two maximum values as the positions of the target intermediate frequency coefficients of the two target sub-image blocks.
[0068] The sizes of the target sub-image block and the image block to which the target sub-image block belongs are different, which results in different sizes of the DCT coefficient matrix. First, perform downsampling on the image block. The downsampling methods include but are not limited to average pooling, max pooling, or convolution. Then, perform DCT transform on the downsampled image block to obtain the DCT coefficient matrix. Find the positions of the two maximum values in the intermediate frequency region of the DCT coefficient matrix of the downsampled image block. For example, C(3, 4) and C(5, 2), then take the positions of these two maximum values as the positions of the intermediate frequency coefficients of the two determined target sub-image blocks. Then, the target intermediate frequency coefficient of the first target sub-image block is the intermediate frequency component at C(3, 4), and the target intermediate frequency coefficient of the second target sub-image block is the intermediate frequency component at C(5, 2).
[0069] After determining the positions of the intermediate-frequency coefficients, such as C(3, 4) and C(5, 2), the specific values of the intermediate-frequency coefficients can be obtained. Assume that the value of C(3, 4) in the DCT coefficient matrix of the first target sub-image block is a1, and the value of C(5, 2) in the DCT coefficient matrix of the second target sub-image block is a2. Compared with the previous embodiment, when extracting the watermark, it is not necessary to know the positions of the intermediate-frequency coefficients in the target sub-image blocks. In one embodiment, the image block ranked first after sorting the sub-image blocks in descending order according to the Frobenius norm is used as the first target image block, and the larger of the two maximum values in the intermediate-frequency region of the DCT coefficient matrix of the down-sampled image block is used as the target intermediate-frequency coefficient of the first target image block; the image block ranked second after sorting the sub-image blocks in descending order according to the Frobenius norm is used as the second target image block, and the smaller of the two maximum values in the intermediate-frequency region of the DCT coefficient matrix of the down-sampled image block is used as the target intermediate-frequency coefficient of the second target image block.
[0070] The process of bit embedding is specifically as follows:
[0071] Pre-divide 2M intervals, where the intervals with even serial numbers are the intervals corresponding to 0, and the intervals with odd serial numbers are the intervals corresponding to 0, and M is a positive integer greater than or equal to 2;
[0072] Calculate the difference between the target intermediate-frequency coefficients of the two target sub-image blocks;
[0073] If the bit to be embedded is 0, find the interval with an even serial number that is closest to the difference, calculate the middle value of the found interval, and adjust one or both of the target intermediate-frequency coefficients of the two target sub-image blocks so that the difference between them is the middle value;
[0074] If the bit to be embedded is 1, find the interval with an odd serial number that is closest to the difference, calculate the middle value of the found interval, and adjust one or both of the target intermediate-frequency coefficients of the two target sub-image blocks so that the difference between them is the middle value.
[0075] Pre-divide multiple numerical intervals, for example, divide them into 4 intervals with serial numbers 1 - 4 respectively, and the values of the multiple numerical intervals are continuous. In one embodiment, the way of pre-dividing 2M intervals is: determine the lower limit value and the upper limit value, and divide the region between the lower limit value and the upper limit value into 2M intervals. Preferably, M = 2. For example, if the lower limit value is -4 and the upper limit value is 4, the divided intervals are [-4, -2), [-2, 0), [0, 2), [2, 4]. The intervals with even serial numbers are the intervals corresponding to bit 0, and the intervals with odd serial numbers are the intervals corresponding to bit 1. Then the intervals corresponding to bit 0 are [-2, 0), [2, 4], and the intervals corresponding to bit 1 are [-4, -2), [0, 2).
[0076] Calculate the difference between the target intermediate frequency coefficients of two target sub-image blocks B3 and B1, that is, a1 - a2. Assume a1 - a2 = 1. If the bit to be embedded is 0, the interval corresponding to bit 0 is [-2, 0), [2, 4]. The difference is closest to [2, 4], and the middle value of [2, 4] is 3. Adjust a1 and a2 so that the difference between them is 3. Specifically, the adjustment method is to increase the target intermediate frequency coefficient of the first target sub-image block by d and decrease the target intermediate frequency coefficient of the second target sub-image block by d, and 2d is equal to the middle value minus the difference. For example, a1 is increased by d, a2 is decreased by d, and 2d = 2. In another adjustment method, only increase the target intermediate frequency coefficient of the first target sub-image block, or only decrease the target intermediate frequency coefficient of the second target sub-image block.
[0077] Similarly, if the bit to be embedded is 1, the interval corresponding to bit 1 is [-4, -2), [0, 2). The difference 1 is within [0, 2) and equal to the middle value of the interval, so there is no need to adjust the target intermediate frequency coefficients of the first target sub-image block and the second target sub-image block. If the difference is 1.5, since the middle value is 1, adjust the target intermediate frequency coefficients of the two target sub-image blocks so that the difference between them is the middle value. Specifically, the adjustment method is to increase the target intermediate frequency coefficient of the first target sub-image block by d and decrease the target intermediate frequency coefficient of the second target sub-image block by d, and 2d is equal to the middle value minus the difference. For example, a1 is increased by d, a2 is decreased by d, and 2d = -0.5. In another adjustment method, only increase the target intermediate frequency coefficient of the first target sub-image block, or only decrease the target intermediate frequency coefficient of the second target sub-image block.
[0078] S3. After embedding all the bits to be embedded, perform inverse discrete cosine transform on all sub-image blocks to obtain the Y channel, and then combine the Y channel with the original Cb and Cr channels and transform them to the RGB channel to obtain the watermarked image.
[0079] After embedding all the bits to be embedded, perform inverse discrete cosine transform on all sub-image blocks or target sub-image blocks to obtain the Y channel, and then combine it with the original Cb and Cr channels and transform them to the RGB channel to obtain the watermarked image.
[0080] When extracting the watermark, perform the above inverse operation, that is, first segment the watermarked image to obtain image blocks, then segment each image block to obtain sub-image blocks, and select two target sub-image blocks from the multiple sub-image blocks based on the DCT coefficient matrix of the sub-image blocks.
[0081] If the position of the target intermediate frequency coefficient is preset, extract the target intermediate frequency coefficient from the DCT coefficient matrices of the two target sub-image blocks according to the position, then calculate the difference between the target intermediate frequency coefficients of the two target sub-image blocks, and determine whether it is bit 1 or bit 0 according to the interval to which the difference belongs.
[0082] If the position of the target intermediate frequency coefficient is determined according to the image block, determine the position of the target intermediate frequency coefficient in the same way as above, further obtain the target intermediate frequency coefficient, then calculate the difference between the target intermediate frequency coefficients of the two target sub-image blocks, and determine whether it is bit 1 or bit 0 according to the interval to which the difference belongs. Figure 2 The pseudo-code of the present invention is shown. Figure 3 The process of adding watermark is shown.
[0083] Figure 4 The second aspect of the present invention is shown. The present invention also provides a system for preventing e-commerce pictures from being stolen. The system includes the following modules:
[0084] A segmentation module, configured to obtain a watermark and a carrier image to which the watermark is to be added, convert the watermark into a binary sequence, and convert the carrier image into the YCbCr color space; divide the Y channel into a plurality of non-overlapping image blocks of the same size, and further divide each image block into a plurality of non-overlapping sub-image blocks of the same size;
[0085] A watermark addition module, configured to perform discrete cosine transform on the sub-image blocks to obtain the DCT coefficient matrices of the sub-image blocks, select two target sub-image blocks from the plurality of sub-image blocks based on the DCT coefficient matrices of the sub-image blocks; determine the target intermediate frequency coefficients of each target sub-image block, and adjust the two target intermediate frequency coefficients so that the difference between the two target intermediate frequency coefficients is located in the interval corresponding to the bit to be embedded;
[0086] An inverse transform module, configured to perform inverse discrete cosine transform on all sub-image blocks to obtain the Y channel after all bits to be embedded are embedded, combine the Y channel with the original Cb and Cr channels, and transform to the RGB channel to obtain the image with the added watermark.
[0087] Preferably, the step of selecting two target sub-image blocks from the plurality of sub-image blocks based on the DCT coefficient matrices of the sub-image blocks is specifically:
[0088] Calculate the Frobenius norm of the DCT coefficient matrix of each sub-image block of the image block or the DCT coefficient matrix without boundaries;
[0089] Sort the sub-image blocks in descending order according to the Frobenius norm;
[0090] Take the first two image blocks after sorting as the target sub-image blocks.
[0091] Preferably, the determination of the target intermediate frequency coefficients of each target sub-image block is specifically as follows:
[0092] Obtain the image block to which the target sub-image block belongs, and perform downsampling to obtain an image block with the same size as the target sub-image block;
[0093] Perform discrete cosine transform on the downsampled image block to obtain the DCT coefficient matrix of the downsampled image block;
[0094] Obtain the positions of the two maximum values in the intermediate frequency region of the DCT coefficient matrix of the downsampled image block;
[0095] Take the positions of the two maximum values as the positions of the target intermediate frequency coefficients of the two target sub-image blocks.
[0096] Preferably, the determination method of the intermediate frequency region is as follows:
[0097] Obtain the size n×n of the DCT coefficient matrix of the downsampled image block, and take the k×k element region in the central region of the DCT coefficient matrix of the downsampled image block as the intermediate frequency region, where k = n - 1 or k = n - 2.
[0098] Preferably, the adjustment of the two intermediate frequency coefficients is such that the difference between the two intermediate frequency coefficients is within the interval corresponding to the bit to be embedded, specifically as follows:
[0099] Pre-divide 2M intervals, where the intervals with even serial numbers are the intervals corresponding to 0, and the intervals with odd serial numbers are the intervals corresponding to 1, and M is a positive integer greater than or equal to 2;
[0100] Calculate the difference between the target intermediate frequency coefficients of the two target sub-image blocks;
[0101] If the bit to be embedded is 0, find the interval with an even serial number that is closest to the difference, calculate the middle value of the found interval, and adjust one or both of the target intermediate frequency coefficients of the two target sub-image blocks so that the difference between them is the middle value;
[0102] If the bit to be embedded is 1, find the interval with an odd serial number that is closest to the difference, calculate the middle value of the found interval, and adjust one or both of the target intermediate frequency coefficients of the two target sub-image blocks so that the difference between them is the middle value.
[0103] It should be noted that the term "including", "comprising" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or device. Without further limitation, elements defined by the statement "including..." do not preclude the presence of additional identical elements in the process, method, article or device including said elements. For any similar expressions such as "predetermined threshold" or "preset threshold", if no specific value is indicated, a person of ordinary skill in the art can determine its specific value through simple experiments or corresponding debugging.
[0104] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions described in the foregoing embodiments or perform equivalent replacements for some of the technical features; and these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for preventing the unauthorized use of e-commerce pictures, characterized in that, The method includes the following steps: Obtain a watermark and a carrier image to which the watermark is to be added, convert the watermark into a binary sequence, and convert the carrier image into the YCbCr color space; divide the Y channel into multiple non-overlapping image blocks of the same size, and further divide each image block into multiple non-overlapping sub-image blocks of the same size; Perform a discrete cosine transform on the sub-image blocks to obtain the DCT coefficient matrix of the sub-image blocks, and select two target sub-image blocks from the multiple sub-image blocks based on the DCT coefficient matrix of the sub-image blocks; determine the target intermediate frequency coefficients of each target sub-image block, and adjust the two target intermediate frequency coefficients so that the difference between the two target intermediate frequency coefficients is within the interval corresponding to the bit to be embedded; After all the bits to be embedded are embedded, perform an inverse discrete cosine transform on all the sub-image blocks to obtain the Y channel, combine the Y channel with the original Cb and Cr channels, and transform to the RGB channel to obtain the watermark-added image; The step of selecting two target sub-image blocks from the multiple sub-image blocks based on the DCT coefficient matrix of the sub-image blocks is specifically: Calculate the Frobenius norm of the DCT coefficient matrix of each sub-image block of the image block or the DCT coefficient matrix after removing the boundary; Sort the sub-image blocks in descending order according to the Frobenius norm; Take the first two image blocks after sorting as the target sub-image blocks.
2. The method according to claim 1, characterized in that, The step of determining the target intermediate frequency coefficients of each target sub-image block is specifically: Obtain the image block to which the target sub-image block belongs, and perform downsampling to obtain an image block of the same size as the target sub-image block; Perform a discrete cosine transform on the downsampled image block to obtain the DCT coefficient matrix of the downsampled image block; Obtain the positions of the two maximum values in the intermediate frequency region of the DCT coefficient matrix of the downsampled image block; Take the positions of the two maximum values as the positions of the target intermediate frequency coefficients of the two target sub-image blocks.
3. The method according to claim 2, wherein The determination method of the intermediate frequency region is: Obtain the size n×n of the DCT coefficient matrix of the downsampled image block, and take the k×k element region in the central region of the DCT coefficient matrix of the downsampled image block as the intermediate frequency region, where k = n - 1 or k = n - 2.
4. The method according to claim 1, characterized in that The step of adjusting the two target intermediate frequency coefficients so that the difference between the two target intermediate frequency coefficients is within the interval corresponding to the bit to be embedded is specifically: Pre-divide 2M intervals, where the intervals with even serial numbers are the intervals corresponding to 0, and the intervals with odd serial numbers are the intervals corresponding to 1, and M is a positive integer greater than or equal to 2; Calculate the difference between the target intermediate frequency coefficients of the two target sub-image blocks; If the bit to be embedded is 0, find the interval closest to the difference and with an even serial number, calculate the middle value of the found interval, and adjust one or both of the target intermediate frequency coefficients of the two target sub-image blocks so that the difference between them is the middle value; If the bit to be embedded is 1, find the interval closest to the difference and with an odd serial number, calculate the middle value of the found interval, and adjust one or both of the target intermediate frequency coefficients of the two target sub-image blocks so that the difference between them is the middle value.
5. A system for preventing the unauthorized use of e-commerce pictures, characterized in that, The system includes the following modules: The segmentation module is used to obtain the watermark and the carrier image to which the watermark is to be added, convert the watermark into a binary sequence, and convert the carrier image into the YCbCr color space; divide the Y channel into multiple non-overlapping image blocks of the same size, and further divide each image block into multiple non-overlapping sub-image blocks of the same size; The watermark addition module is used to perform a discrete cosine transform on the sub-image blocks to obtain the DCT coefficient matrix of the sub-image blocks, and select two target sub-image blocks from multiple sub-image blocks based on the DCT coefficient matrix of the sub-image blocks; Determine the target intermediate frequency coefficients of each target sub-image block, and adjust the two target intermediate frequency coefficients so that the difference between the two target intermediate frequency coefficients is within the interval corresponding to the bit to be embedded; The inverse transform module is used to perform an inverse discrete cosine transform on all sub-image blocks after all bits to be embedded are embedded to obtain the Y channel, and combine the Y channel with the original Cb and Cr channels and then transform them to the RGB channel to obtain the image with the watermark added; The step of selecting two target sub-image blocks from multiple sub-image blocks based on the DCT coefficient matrix of the sub-image blocks is specifically: Calculate the Frobenius norm of the DCT coefficient matrix of each sub-image block of the image block or the DCT coefficient matrix after removing the boundary; Sort the sub-image blocks in descending order according to the Frobenius norm; Take the first two image blocks after sorting as the target sub-image blocks.
6. The system according to claim 5, wherein The step of determining the target intermediate frequency coefficients of each target sub-image block is specifically: Obtain the image block to which the target sub-image block belongs, and perform downsampling to obtain an image block of the same size as the target sub-image block; Perform a discrete cosine transform on the downsampled image block to obtain the DCT coefficient matrix of the downsampled image block; Obtain the positions of the two maximum values in the intermediate frequency region of the DCT coefficient matrix of the downsampled image block; Take the positions of the two maximum values as the positions of the target intermediate frequency coefficients of the two target sub-image blocks.
7. The system according to claim 6, wherein The determination method of the intermediate frequency region is:
8. The system according to claim 5, characterized in that, Obtain the size n×n of the DCT coefficient matrix of the downsampled image block, and take the k×k element region in the central region of the DCT coefficient matrix of the downsampled image block as the intermediate frequency region, where k = n - 1 or k = n - 2. The step of adjusting the two target intermediate frequency coefficients so that the difference between the two target intermediate frequency coefficients is within the interval corresponding to the bit to be embedded is specifically: Pre-divide 2M intervals, where the intervals with even serial numbers are the intervals corresponding to 0, and the intervals with odd serial numbers are the intervals corresponding to 1, and M is a positive integer greater than or equal to 2; Calculate the difference between the target intermediate frequency coefficients of the two target sub-image blocks; If the bit to be embedded is 0, find the interval with an even serial number that is closest to the difference, calculate the middle value of the found interval, and adjust one or both of the target intermediate frequency coefficients of the two target sub-image blocks so that the difference between them is the middle value; If the bit to be embedded is 1, find the interval with an odd serial number that is closest to the difference, calculate the middle value of the found interval, and adjust one or both of the target intermediate frequency coefficients of the two target sub-image blocks so that the difference between them is the middle value.
Citation Information
Patent Citations
Method and device for processing and extracting image watermark information
CN118379177A
Method and apparatus for detecting image copy of content base
JP2004007552A