WO2024087864A1 - 图像水印处理方法及装置 - Google Patents

图像水印处理方法及装置 Download PDF

Info

Publication number
WO2024087864A1
WO2024087864A1 PCT/CN2023/115299 CN2023115299W WO2024087864A1 WO 2024087864 A1 WO2024087864 A1 WO 2024087864A1 CN 2023115299 W CN2023115299 W CN 2023115299W WO 2024087864 A1 WO2024087864 A1 WO 2024087864A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
component data
processed
pixel
target
Prior art date
Application number
PCT/CN2023/115299
Other languages
English (en)
French (fr)
Inventor
连一汉
林浩
苏晓东
骆伟祺
郭富博
郭烽
李鸣雷
Original Assignee
抖音视界有限公司
中山大学
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 抖音视界有限公司, 中山大学 filed Critical 抖音视界有限公司
Publication of WO2024087864A1 publication Critical patent/WO2024087864A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/40Scaling of whole images or parts thereof, e.g. expanding or contracting
    • G06T3/4038Image mosaicing, e.g. composing plane images from plane sub-images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/11Region-based segmentation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N1/00Scanning, transmission or reproduction of documents or the like, e.g. facsimile transmission; Details thereof
    • H04N1/387Composing, repositioning or otherwise geometrically modifying originals

Definitions

  • the present disclosure relates to the technical field of image processing, and in particular to an image watermark processing method and device.
  • Digital watermarking technology is a technology that hides secret information in a carrier object. It can be used for copyright protection of digital products and authentication of their authenticity and integrity.
  • the source of the carrier image can be marked and a proprietary copyright identifier can be attached to the carrier image.
  • images spread very quickly on the Internet. When an image containing watermark information is leaked, the source can be traced based on the watermark information to protect the image security.
  • the present disclosure provides an image watermark processing method and device.
  • the present disclosure provides an image watermark processing method, comprising:
  • pixel format data includes brightness component data, blue chrominance component data, and red chrominance component data
  • the target brightness component data and the blue chromaticity component data and the red chromaticity component data corresponding to the image to be processed are combined to obtain a target image, where the target image is an image corresponding to the image to be processed and with the watermark information added thereto.
  • the step of modifying the brightness component data of each target pixel in the to-be-processed image based on the value of each bit in the bit sequence to obtain the target brightness component data includes:
  • the brightness component data of the target pixel point at the designated position in each of the pixel blocks is modified based on the value on the bit corresponding to each of the pixel blocks.
  • modifying the brightness component data of the target pixel point at a specified position in each of the pixel blocks based on the value of the bit corresponding to each of the pixel blocks includes:
  • the brightness component data of the target pixel point at the specified position in the pixel block is modified to a first preset value.
  • the blue chromaticity component data and the red chromaticity component data corresponding to the image to be processed to obtain the target image it also includes: embedding a synchronization block into the image to be processed, and the synchronization block is used to indicate the starting position or the ending position of the target pixel point in the target image.
  • embedding a synchronization block into the image to be processed includes:
  • the blue chromaticity component data or the red chromaticity component data corresponding to each pixel point at the position corresponding to the synchronization block is modified to a second preset value, so as to embed the synchronization block in the image to be processed.
  • converting the image to be processed to obtain pixel format data includes: converting the image to be processed in RGB format to obtain pixel format data in YCbCr format.
  • an image watermark processing method comprising:
  • the image to be processed includes target pixel points carrying watermark information, and the brightness component data of the target pixel points is determined according to the value of the matching bit in the bit sequence corresponding to the watermark information; the target pixel points are distributed in an array in the image to be processed;
  • a bit sequence corresponding to the watermark information is obtained based on the brightness component data of the target pixel and the position of the target pixel in the image to be processed.
  • obtaining the bit sequence corresponding to the watermark information based on the brightness component data of the target pixel and the position of the target pixel in the image to be processed includes:
  • the values of the bit corresponding to each of the target pixels are combined to obtain the bit sequence corresponding to the watermark information.
  • determining the target pixel based on the brightness component data of each pixel in the image to be processed includes:
  • determining the synchronization block contained in the image to be processed includes: traversing the blue chromaticity component data or the red chromaticity component data of the image to be processed, and determining that the pixel block whose blue chromaticity component data or the red chromaticity component data satisfies the second component value interval is the synchronization block.
  • obtaining the bit sequence corresponding to the watermark information based on the brightness component data of the target pixel and the position of the target pixel in the image to be processed includes:
  • Statistical analysis is performed on the multiple candidate bit sequences to determine a bit sequence corresponding to the watermark information.
  • an image watermark processing device comprising:
  • An image acquisition module is used to acquire an image to be processed, and perform format conversion on the image to be processed to obtain pixel format data, wherein the pixel format data includes brightness component data, blue chrominance component data, and red chrominance component data;
  • a watermark information acquisition module used to acquire watermark information and convert the watermark information into a bit sequence
  • a watermark processing module used to modify the brightness component data of each target pixel in the image to be processed based on the value of each bit in the bit sequence to obtain target brightness component data; wherein the target pixel is used to carry the value of the corresponding bit in the bit sequence, and the target pixel satisfies the array distribution;
  • the data merging module is used to merge the target brightness component data with the blue chromaticity component data and the red chromaticity component data corresponding to the image to be processed to obtain a target image, wherein the target image is an image corresponding to the image to be processed with the watermark information added thereto.
  • an image watermark processing device comprising:
  • An image acquisition module is used to acquire an image to be processed, and convert the format of the image to be processed to obtain brightness component data of the image to be processed; wherein the image to be processed includes target pixels carrying watermark information, and the brightness component data of the target pixels is determined according to the value of the matching bit in the bit sequence corresponding to the watermark information; the target pixels are distributed in an array in the image to be processed;
  • the watermark information extraction module is used to determine the target pixel based on the brightness component data of each pixel in the image to be processed; and obtain the bit sequence corresponding to the watermark information based on the brightness component data of the target pixel and the position of the target pixel in the image to be processed.
  • the present disclosure provides an electronic device, including: a memory and a processor;
  • the memory is configured to store computer program instructions; the processor is configured to execute the computer program instructions so that the electronic device implements the image watermark processing method as described in the first aspect and any one of the first aspect, or the second aspect and any one of the second aspect.
  • the present disclosure provides a readable storage medium, comprising: computer program instructions; at least one processor of an electronic device executes the computer program instructions, so that the electronic device implements the image watermark processing method as described in the first aspect and any one of the first aspect, or the second aspect and any one of the second aspect.
  • the present disclosure provides a computer program product, and an electronic device runs the computer program product so that the electronic device implements the image watermark processing method as described in the first aspect and any one of the first aspect, or the second aspect and any one of the second aspect.
  • the disclosed embodiment provides an image watermark processing method and device, wherein the method provides an image watermark solution with strong robustness and high security.
  • watermark information is embedded in the brightness channel of the image, wherein embedding in the brightness channel causes changes in the three color channels of red (R), green (G), and blue (B) of the image, and the amount and amplitude of the modification to the image are large, which can ensure that the image has strong robustness, and the pixel points carrying the watermark information in the image are distributed in a dot array.
  • the combination of the two makes the image with watermark information safe when it is transmitted over the network, cropped, After operations such as splicing and editing, complete and highly accurate watermark information can be extracted; in addition, if the watermark in the form of a dot array is a bright watermark, although the watermark is visually visible to the user, the content of the watermark information cannot be directly extracted, which makes the bright watermark in the form of a dot array have the characteristics of a dark watermark, thereby improving the security of the watermark information.
  • FIG1 is a schematic diagram of a flow chart of an image watermark processing method provided by some embodiments of the present disclosure
  • FIG2A is a scene diagram of embedding watermark information exemplarily shown in the present disclosure.
  • FIG2B is a scene diagram of embedding watermark information exemplarily shown in the present disclosure.
  • FIG2C is an effect diagram of a target image embedded with watermark information exemplarily shown in the present disclosure.
  • FIG3 is a schematic diagram of a flow chart of an image watermark processing method provided by some embodiments of the present disclosure.
  • 4A and 4B are schematic diagrams of positions of synchronization blocks in an image, respectively, exemplarily shown in the present disclosure
  • FIG4C is an effect diagram of a target image embedded with a synchronization block exemplarily shown in the present disclosure
  • FIG5 is a schematic diagram of a flow chart of an image watermark processing method provided by some embodiments of the present disclosure.
  • FIG6 is a schematic diagram of a flow chart of an image watermark processing method provided by some embodiments of the present disclosure.
  • FIG7A is a scene diagram of extracting watermark information from an image exemplarily shown in the present disclosure
  • FIG7B is a scene diagram of extracting watermark information from an image exemplarily shown in the present disclosure.
  • FIG8 is a schematic diagram of the structure of an image watermark processing device provided by some embodiments of the present disclosure.
  • FIG. 9 is a schematic diagram of the structure of an image watermark processing device provided in some embodiments of the present disclosure.
  • YUV It is a color encoding method.
  • YUV (YUV420p ⁇ YUV444 ⁇ YUV422), YCbCr and other formats can all be called YUV, and they overlap with each other.
  • Y represents brightness (Luminance or Luma), also known as brightness, which is the grayscale value
  • U and "V” represent chrominance (Chrominance or Chroma), which is used to describe the color and saturation of the image. It is used to specify the color of the pixel, usually using R (red) and B (blue) signals to represent the chrominance UV.
  • the YCbCr format is usually used to describe digital video signals, and is often used in digital videos and digital images.
  • Cb refers to the blue chrominance component, which represents the blue concentration offset component
  • Cr refers to the red chrominance component, which represents the red concentration offset component.
  • RGB It is a color encoding method, in which R represents red, G represents green, and B represents blue. Using this encoding method, each color can be represented by three variables R, G, and B, which represent the intensity of red, green, and blue respectively.
  • RGB and YUV can be converted to each other.
  • clear watermark Based on whether the watermark is visible, it can be divided into two types: clear watermark and dark watermark.
  • Clear watermark can achieve strong robustness because the amount and range of modification to the original carrier image are relatively large, but it will also cause a large change in the image statistical characteristics of the image embedded with the watermark information, so that the watermark information is easy to detect and the visual quality of the image is lost.
  • Dark watermark can provide higher security and ensure that the watermark information is not easy to detect, but the robustness is not high. The image embedded with watermark information is easily lost during network transmission, cutting, splicing, editing, compression and other operations.
  • the present disclosure provides an image watermarking method, which provides an image watermarking solution with strong robustness and high security.
  • watermark information is embedded in the brightness channel of the image, wherein embedding in the brightness channel causes changes in the three color channels of red (R), green (G), and blue (B) of the image, and the amount and amplitude of modification to the image are large, which can ensure that the image has strong robustness, and the pixel points carrying the watermark information in the image are distributed in a dot array.
  • the combination of the two enables the image with watermark information to extract complete and highly accurate watermark information after network transmission, cropping, splicing, editing, and other operations; in addition, if the watermark in the form of a dot array is visible in the image, the user cannot directly extract the content of the watermark information although the watermark is visually visible, so that the bright watermark in the form of a dot array has the characteristics of a dark watermark, while ensuring the security of the watermark information.
  • the image watermark processing method provided by the present invention chooses to embed watermark information in the brightness channel because the brightness channel is strongly associated with the three RGB color channels. Therefore, modifying the brightness component data of the image will change the data of the three RGB color channels. In comparison, the change of the RGB channel data has a much greater impact on the brightness component data. The influence of the change of the brightness component data on the data of the RGB channels is much smaller than that of the change of the brightness component data. Therefore, embedding the watermark information by modifying the brightness component data of the image can make the watermark information more robust.
  • the image watermark processing method provided by the present disclosure can be executed by the image watermark processing device provided by the present disclosure, and the device can be implemented by any software and/or hardware.
  • the image watermark processing device can be, but is not limited to: tablet computers, mobile phones (such as folding screen mobile phones, large screen mobile phones, etc.), wearable devices, vehicle-mounted devices, augmented reality (AR)/virtual reality (VR) devices, laptops, ultra-mobile personal computers (UMPC), netbooks, personal digital assistants (PDA), smart TVs, smart screens, high-definition TVs, 4K TVs, smart projectors and other Internet of Things (IOT) devices and other types of electronic devices.
  • the present disclosure does not impose any restrictions on the specific types of electronic devices.
  • the present disclosure will take an electronic device as an example, and combine the accompanying drawings and application scenarios to elaborate on the image watermark processing method provided by the present disclosure.
  • the image watermark processing method provided by the present disclosure can be divided into two parts: watermark information embedding and watermark information extraction, which will be introduced separately below.
  • FIG1 is a schematic diagram of a process flow of an image watermark processing method provided by an embodiment of the present disclosure.
  • the image watermark processing method provided by the present disclosure may include:
  • the image to be processed can be any type of digital image, for example, document image, web page image, color image, etc., which is not limited in the present disclosure.
  • the present disclosure does not limit other image parameters such as size, image content, storage format, etc. of the image to be processed.
  • the original image to be processed is not in RGB format, it can be converted to RGB format first to obtain the RGB data of the image to be processed. For example, if the original image to be processed to embed watermark information is a single-channel PNG image, the single-channel PNG image is first converted to a three-channel RGB format image. If the original image to be processed is in RGB format, no processing is required.
  • the image to be processed is obtained in RGB format, and the conversion matrix between RGB format and YUV format can be used to convert RGB data into YUV data.
  • YUV data includes brightness component data and chroma component data indicated by UV channels respectively.
  • the brightness component data includes brightness component data corresponding to each pixel in the image to be processed (which can also be understood as brightness component value).
  • the chroma component data corresponding to the U channel includes the chroma component value corresponding to each pixel in the image to be processed
  • the chroma component data corresponding to the V channel includes the chroma component data corresponding to each pixel in the image to be processed. value.
  • S102 Acquire watermark information, and convert the watermark information into a bit sequence.
  • the watermark information may be input by a user into the electronic device, or may be automatically generated by the electronic device, or may be pre-specified.
  • the watermark information may be, but is not limited to, a text sequence consisting of one or more types of words, numbers, symbols, and English letters.
  • the watermark information can be represented by a bit sequence, which is a binary sequence or a bit sequence.
  • the value of each bit in the bit sequence represents 1 bit of watermark information.
  • the values of all bits are combined in order to restore the content of the watermark information.
  • the length of the bit sequence i.e., the number of bits
  • the present disclosure does not limit the implementation method of converting the text sequence corresponding to the watermark information into a bit sequence, and it can be implemented using any existing method.
  • S103 modify the brightness component data of the target pixel in the image to be processed based on the value of each bit in the bit sequence to obtain target brightness component data.
  • the image to be processed can be processed into blocks to obtain multiple pixel blocks, and the target pixel block carrying the watermark information can be determined from the multiple pixel blocks based on the embedding strategy, wherein each target pixel block is used to carry the value of a bit in the bit sequence. Then, based on the value of each bit in the bit sequence and the corresponding relationship between each bit and the target pixel block, the brightness component data of the pixel point (i.e., the target pixel point) at the specified position in the target pixel block is modified, and the brightness component data of the non-target pixel point remains unchanged.
  • the number of pixel blocks included in the pixel block group can be equal to the length of the bit sequence.
  • the embedding strategy may include: the embedding direction of the watermark information, such as horizontal direction, vertical direction, diagonal direction, etc.; it may also include: information such as row interval, column interval, etc. when repeatedly embedding the watermark information, for example, embedding row by row, embedding column by column, embedding every other row, embedding every other column.
  • the "rows” and “columns” referred to here refer to pixel block rows and pixel block columns; it may also include the number of repetitions of the watermark information, etc.
  • the specified position can be any position in the target pixel block, such as the upper left corner, the upper right corner, the center position, etc., and the present disclosure does not limit the specified position.
  • the brightness component value of the target pixel point at the same specified position can be modified, so that the array formed by the target pixel points is arranged more neatly, and the watermark information is not limited to the target pixel point.
  • target pixel blocks can also modify the brightness component values of target pixel points at different positions respectively, and they can also change according to a certain rule, for example, an odd number of pixel blocks modify the target pixel point at position 1, and an even number of target pixel blocks modify the target pixel point at position 2.
  • Modifying the brightness component data of the target pixel in the target pixel block can be implemented as follows: if the value on the corresponding bit is 1, the brightness component data of the target pixel is not modified; if the value on the corresponding bit is 0, the brightness component data of the target pixel is modified to a first preset value.
  • the present disclosure does not limit the size of the first preset value. Different first preset values can be used for different images to be processed. The size of the first preset value can also be specified by the user when starting to embed watermark information into the image, or it can be pre-specified.
  • the embedding strategy can also include the processing method of such a situation. For example, when the number of pixel block groups is insufficient, incomplete watermark information can be embedded, or watermark information can be not embedded. Of course, other processing methods can also be used.
  • the size of the image to be processed is 320*320, and the pixels in the image to be processed are divided into 10*10 pixel blocks, wherein each row in the horizontal direction may include 32 pixel blocks, assuming that the watermark information is embedded in the horizontal direction, wherein the 1st pixel block and the 17th pixel block in each row may respectively correspond to the starting position of a complete watermark information, the 1st pixel block to the 16th pixel block are used to carry a complete 16-bit watermark information, and the 17th pixel block to the 32nd pixel block are used to carry a complete 16-bit watermark information.
  • FIG2A shows the correspondence between the first row of pixel blocks and the watermark information, and the other rows are similar.
  • the brightness component data of the pixel at the center of each pixel block is modified, the brightness component data of the pixel at the center of the 1st to 16th pixel blocks in the 1st row is modified based on the values of the 1st to 16th bits in the bit sequence, and the brightness component data of the pixel at the center of the 17th to 32nd pixel blocks in the 1st row is modified based on the values of the 1st to 16th bits in the bit sequence.
  • Other rows or multiple rows of pixel blocks to be embedded with watermark information can be processed in this way. Watermark information can be embedded in each row of pixel blocks, or it can be embedded across rows.
  • Watermark information can be repeatedly embedded in the image to be processed, and the watermark information in some image areas may be incomplete.
  • the size of the image to be processed is 320*320
  • the pixels in the image to be processed are divided into 15*15 pixel blocks, wherein each row in the horizontal direction may include 20 pixel blocks, i.e., embedding a watermark in the last 5 pixels in each row is not considered.
  • the watermark information is 16 bits. There are 20 pixel blocks in the horizontal direction, and the 1st to 16th pixel blocks (i.e.
  • a pixel block group can carry a complete watermark information
  • the 17th to 20th pixel blocks i.e., a pixel block group
  • the 17th to 20th pixel blocks can only embed the first 4 bits of watermark information, that is, the watermark information carried by the image area corresponding to the 17th to 20th pixel blocks is incomplete.
  • FIG2B shows the correspondence between the first row of pixel blocks and the watermark information, and the other rows are similar.
  • the other one or more rows of pixel blocks to be embedded with watermark information can be processed in this way, and the watermark information carried by the 17th to 20th pixel blocks in each row is partial watermark information.
  • step S103 the data of each pixel in the target image in the Y channel can be obtained, and then the data of each pixel in the target image in the Y channel and the component values of each pixel in the image to be processed in the U channel and the V channel are merged pixel by pixel to obtain the component values of each pixel in the target image in the Y channel, U channel and V channel, and then the conversion matrix is used to perform format conversion based on the component values of each pixel in the Y channel, U channel and V channel to obtain the pixel format data in RGB format corresponding to the target image and export and store it.
  • the target pixel points can be distributed in an array, that is, these target pixel points will form a dot array watermark, and the dot array watermark can be a bright watermark or a dark watermark; if it is a bright watermark, when the user previews the target image, although the user can observe the bright watermark in the form of a dot array, the watermark information represented by the bright watermark of the dot array cannot be directly obtained by the user, so that the bright watermark of the dot array has the characteristics of a dark watermark, which improves the security of the watermark information. If it is a dark watermark, first of all, the user cannot perceive the watermark visually, and even if the dot array is restored, it cannot easily restore the content of the watermark information, and the security is relatively high.
  • a dot array can be observed in the document image shown in FIG. 2C , and these dot arrays are clear watermarks, but the actual content of the watermark information cannot be directly obtained by the user. And it can be seen from FIG. 2C that these visible pixels will hardly affect the visual effect of the text in the document image, thereby ensuring the image quality of the document image. It should be noted that in FIG. 2C , it can be observed that some points are close to each other, and some points are far away from each other. There are target pixels carrying watermark information between the points that are actually far away. The bit values corresponding to these target pixels are 1, and the brightness component data is not modified, so they are white, which is consistent with the background color of the document image. The bit values corresponding to these visible target pixels are 0, and since the brightness component data is modified, they are visually visible.
  • the method of this embodiment embeds watermark information in the brightness channel of the image.
  • the embedding in the brightness channel causes changes in the three color channels of the image, RGB, and the amount and amplitude of the modification to the image are large, which can ensure that the image has strong robustness.
  • the pixel points carrying the watermark information in the image are distributed in a dot array. The combination of the two makes it possible to extract the complete image with watermark information after network transmission, cropping, splicing, editing, etc.
  • the watermark in the form of a dot array is a bright watermark, the watermark is visually visible to the user, but the content of the watermark information cannot be directly extracted, which makes the bright watermark in the form of a dot array have the characteristics of a dark watermark, while ensuring the security of the watermark information.
  • FIG3 is a flow chart of an image watermark processing method provided by some embodiments of the present disclosure. Referring to FIG3 , the method of this embodiment includes:
  • S302 Acquire watermark information, and convert the watermark information into a bit sequence.
  • S303 Modify the brightness component data of the target pixel in the image to be processed based on the value of each bit in the bit sequence to obtain target brightness component data.
  • Steps S301 to S303 in this embodiment are similar to steps S101 to S103 in the embodiment shown in FIG. 1 , respectively. Reference may be made to the detailed description of the embodiment shown in FIG. 1 , and for the sake of brevity, they will not be described again here.
  • the present disclosure also embeds a synchronization block when embedding the watermark information, and the synchronization block indicates the starting position and the ending position of the watermark information in the image.
  • the starting position and the ending position of the watermark information can be understood as the synchronization information corresponding to the watermark information. This can be achieved through steps S304 and S305.
  • S304 Determine the position of the corresponding synchronization block in the image to be processed based on the starting position or the ending position of the watermark information.
  • the size of the synchronization block can be preset, for example, the length of the synchronization block can be less than half the length of the pixel block divided when embedding the watermark information, and the width of the synchronization block can be less than half the width of the pixel block divided when embedding the watermark information. For example, assuming that the pixel block divided when embedding the watermark information is 10*10, the size of the synchronization block can be 1*4, 2*4, 3*4, 4*4, etc.
  • the synchronization block size can also be specified when the user starts the image watermark processing.
  • the position of the synchronization block used to indicate the starting position of the watermark information can be determined based on the pixel block corresponding to the first bit in the bit sequence.
  • the synchronization block can be located in the pixel block corresponding to the first bit, such as the center position of the synchronization block can overlap with the center position of the pixel block corresponding to the first bit, or one or more edges of the synchronization block can overlap with one or more edges of the pixel block corresponding to the first bit.
  • the position of the synchronization block used to indicate the ending position of the watermark information can be determined based on the pixel block corresponding to the last bit in the bit sequence.
  • the synchronization block can be located in the pixel block corresponding to the last bit, such as the center position of the synchronization block can overlap with the center position of the pixel block corresponding to the first bit.
  • the center position of the pixel block corresponding to the last bit overlaps, or one or more edges of the synchronization block overlap with one or more edges of the pixel block corresponding to the last bit.
  • FIG. 4A and FIG. 4B show schematic diagrams of the positions of synchronization blocks in an image.
  • the center position of the synchronization block s1 indicating the starting position overlaps with the center position of the pixel block r1 corresponding to the first bit
  • the center position of the synchronization block s2 indicating the ending position overlaps with the center position of the pixel block r2 corresponding to the last bit; referring to FIG.
  • the left edge and the upper edge of the synchronization block s1 indicating the starting position overlap with the left edge and the upper edge of the pixel block r1 corresponding to the first bit, respectively, and the right edge and the upper edge of the synchronization block s2 indicating the ending position overlap with the right edge and the upper edge of the pixel block r2 corresponding to the last bit.
  • the present disclosure does not show them one by one.
  • the synchronization block s1 and the synchronization block s2 may be understood as a synchronization block group.
  • One or more synchronization block groups may be embedded in the image to be processed, which is not limited in the present disclosure.
  • the present disclosure does not limit the size of the second preset value, which can be pre-set or specified by the user when starting the image watermark processing.
  • the blue chromaticity component value of each pixel corresponding to the synchronization block can be modified to the second preset value, and the second preset value can be but is not limited to 80.
  • the blue chromaticity component data/red chromaticity component data of all pixels in the synchronization block are modified to the second preset value, and the blue chromaticity component data/red chromaticity component data of the pixels of other non-synchronization blocks remain unchanged.
  • the component values of all pixels in the synchronization blocks s1 and s2 shown in Figures 4A and 4B in the U channel are modified to 80, thereby embedding the synchronization block.
  • the second preset value may correspond to different sizes, and the size of the second preset value may be related to the image or may be unrelated to the image itself.
  • the target image is an image corresponding to the image to be processed with watermark information and synchronization blocks added thereto.
  • the YUV data corresponding to the target image can be obtained, and then the YUV data is converted into RGB data through format conversion and exported to a storable image format. For example, using the conversion between YUV and RGB The matrix performs format conversion on the YUV data corresponding to the target image to obtain the RGB data corresponding to the target image and stores it, thereby obtaining the target image embedded with the watermark information and the synchronization block.
  • embedding synchronization blocks into the target image includes embedding one or more groups of synchronization blocks into the target image, each group of synchronization blocks includes a pair of synchronization blocks, which are respectively used to indicate the starting position and the ending position of the watermark information.
  • multiple groups of synchronization blocks can be observed in the target image shown in FIG. 4C, namely, synchronization blocks x1 to x4, wherein synchronization block x1 and synchronization block x2 form a group, and synchronization block x3 and synchronization block x4 form a group.
  • Synchronization block x1 and synchronization block x3 are used to identify the starting position of the watermark information
  • synchronization blocks x2 and x4 are used to identify the ending position of the watermark information.
  • the positions of the watermark information embedded in each row or column of the target image are aligned. In this case, only the synchronization blocks indicating the starting position and the ending position of the watermark information can be embedded in the first row and the last row or the first column and the last column. This can save the processing operations required for the synchronization block embedding.
  • watermark information is embedded in the pixel blocks of each row in the horizontal direction, and the initial position corresponding to the watermark information of each row is aligned in the vertical direction. Therefore, the area in the middle where the synchronization block is not embedded can determine the initial position and end position of the watermark information in the corresponding row according to the synchronization block above or below.
  • This embodiment embeds a synchronization block in the image to be processed to indicate the starting position and the ending position of the watermark information in the image, so as to facilitate rapid positioning of the image region where the target pixel point containing the watermark information is located when extracting the watermark information.
  • the watermark information is a 32-bit bit sequence.
  • the image M is a single-channel png image, and an example is given of embedding watermark information and synchronization blocks in the YCbCr format.
  • the process of embedding watermark information can be shown in Figure 5, which mainly includes the following steps:
  • Step a1 If the image M is a single-channel png image or other non-RGB format images, the image M needs to be converted to RGB format first, otherwise skip step a1 and directly execute step a2. Step a1 is not marked in FIG5 .
  • Step a3 obtain the data of the Y channel and the Cb channel of the image M, that is, obtain My and Mcb .
  • Step a4 modify the data of the pixel points at the upper left and upper right corners of the image M in the Cb channel to embed a 4*4 synchronization block.
  • j, k represent the coordinates of the pixel points corresponding to the synchronization block.
  • Step a5 modify the data of the Y channel of the image M according to the 32-bit watermark information, and use My to represent the pixel value of the Y channel of M.
  • each row has 32 pixel blocks.
  • watermark information can be embedded into the image M with high robustness and security.
  • synchronization block information is embedded to quickly locate the starting position and the ending position of the watermark information, thereby improving the efficiency of watermark information extraction.
  • FIG6 is a flow chart of an image watermark processing method provided by some embodiments of the present disclosure. Referring to FIG6 , the method of this embodiment includes:
  • S601 obtaining an image to be processed, and converting the format of the image to be processed to obtain brightness component data of the image to be processed; wherein the image to be processed includes target pixel points carrying watermark information, and the brightness component data of the target pixel points is determined according to the value of the matching bit in the bit sequence corresponding to the watermark information; the target pixel points are distributed in an array in the image to be processed.
  • the image to be processed may be an image obtained by embedding watermark information using the image watermark processing method shown in any of the above embodiments.
  • the image to be processed may be an original image containing watermark information, or the original image may be an image obtained after network transmission, cropping, scaling, splicing, editing, etc.
  • the image to be processed input to the electronic device is not in RGB format, it can be converted into RGB format to obtain the image to be processed. Process the RGB data of the image. For example, if the image to be processed is a single-channel PNG image, first convert the single-channel PNG image to RGB format. If the image to be processed is in RGB format, you can directly convert it to YUV format.
  • the conversion matrix between RGB and YUV can be used to convert the format of the image to be processed to obtain the YUV data of the image to be processed.
  • the YUV data includes brightness component data and chroma component data indicated by the UV channels respectively.
  • the brightness component data includes the brightness component data corresponding to each pixel in the image to be processed (which can also be understood as the brightness component value).
  • the chroma component data corresponding to the U channel includes the chroma component value corresponding to each pixel in the image to be processed
  • the chroma component data corresponding to the V channel includes the chroma component value corresponding to each pixel in the image to be processed.
  • S602 Determine the target pixel based on the brightness component data of each pixel in the image to be processed.
  • the electronic device may perform a binarization operation on the brightness component data of each pixel in the image to be processed to obtain the binarization results corresponding to the brightness component data of each pixel; then determine the starting position and the ending position of the watermark information, and project each pixel within the pixel range indicated by the starting position and the ending position to obtain the sum of the binarization results corresponding to the brightness component data of each pixel within the pixel range. If the sum of the binarization results is within the preset range, it is determined that there is a complete watermark information within the pixel range. If the sum of the binarization results is not within the preset range, it is determined that there is no complete watermark information within the pixel range.
  • the operation can be performed based on a preset first component value interval, and the first component value interval contains a first preset value used by the user when embedding the watermark information.
  • the electronic device first determines the starting position and the ending position of the watermark information, and then determines whether the brightness component data of each pixel point within the pixel range indicated by the starting position and the ending position belongs to the first component value interval; the pixel points whose brightness component data belongs to the first component value interval are projected along the specified direction to obtain the sum of the brightness component data of these pixel points; if the sum of the brightness component data is within the preset range, it is determined that there is a complete watermark information within the pixel range, and if the sum of the brightness component data is not within the preset range, it is determined that there is no complete watermark information within the pixel range. Afterwards, for the pixel range with complete watermark information, traverse from the starting position again to determine the target pixel point for carrying the watermark information.
  • the starting position and the ending position of the watermark information can be determined based on the synchronization block contained in the image to be processed.
  • the electronic device can determine the synchronization block by traversing the U channel data or V channel data of each pixel in the image to be processed, or can first perform a binarization operation on the U channel data or V channel data of each pixel in the image to be processed, and then traverse the binarization result to determine the synchronization block. Among them, if the synchronization block is determined by binarization, Then the electronic device can perform a binarization operation on the U channel data or the V channel data based on the preset second component value interval.
  • the synchronization block can be determined by directly traversing the U channel data or the V channel data of each pixel based on the second component value interval.
  • the second preset component interval includes a second preset value used by the user when embedding the synchronization block.
  • the distance d between adjacent target pixel points For a pixel range where a complete watermark information exists, traversing from the starting position to determine the target pixel point needs to rely on two parameters: the distance d between adjacent target pixel points and the point neighborhood nb. These two parameters can be determined based on the distance between the starting position and the ending position of a complete watermark information and the length of the bit sequence. Among them, the distance between the starting position and the ending position of the watermark information can be obtained according to the distance between the synchronization block indicating the starting position and the synchronization block indicating the ending position. Among them, the distance d between adjacent target pixel points is obtained by rounding the ratio between the distance between the starting position and the ending position and the length of the bit sequence.
  • the point neighborhood nb is determined according to the distance d between adjacent target pixel points.
  • the point neighborhood nb represents the radius when traversing each center position, and the value of the point neighborhood nb represents the number of pixel points contained in the radius. Among them, the length of the bit sequence can be pre-specified.
  • the pixel point corresponding to the starting position can be used as the first center position, and the brightness component data of the pixel points in the neighborhood of the corresponding point or the binarization result corresponding to the brightness component data can be traversed.
  • the pixel point is determined as the first target pixel point, and the target pixel point is used as the reference position to jump back d pixel points to determine the next center position; if there is no pixel point whose component value of the Y channel belongs to the first component value interval or the binarization result is 1, the starting position is used as the reference position to jump back d pixel points to determine the next center position. For the next center position, a similar method is used to traverse; and so on, until the end position is reached, all target pixel points corresponding to a complete watermark information can be traversed.
  • traversal is performed based on the brightness component data, if the pixel point where the brightness component data belongs to the first component value interval is traversed, the value of the corresponding bit is determined to be 0, otherwise it is 1; if traversal is performed based on the binarization result corresponding to the brightness component data, if the pixel point where the binarization result is 1 is traversed, the value of the corresponding bit is determined to be 0, otherwise it is 1.
  • the watermark information in some image areas of the image to be processed may be incomplete, such as the case shown in FIG. 2B.
  • this part of the image area can be supplemented based on other image areas with complete watermark information.
  • the data of the pixel blocks in the 5th column to the 16th column can be copied and spliced to the right of the pixel blocks in the 20th column, so that the electronic device can extract the complete watermark information from each row based on the pixel blocks in the 17th column to the 20th column and the copied and spliced data of the pixel blocks in the 5th column to the 16th column.
  • they can be supplemented based on the image area containing watermark information in a similar manner.
  • the brightness component data of the target pixel carries a corresponding bit value, and the corresponding bit value can be determined based on the brightness component data or a binarization result corresponding to the brightness component data, as described in step S602.
  • the order of each target pixel point can be determined based on the position of the target pixel point in the image to be processed, and the order of the target pixel points is consistent with the order of each bit in the bit sequence. Therefore, the values of the bits corresponding to the target pixel points are arranged according to the order of each target pixel point to obtain the bit sequence corresponding to the watermark information.
  • the channel data of some target pixels carrying watermark information in the image to be processed may have changed due to network transmission, cropping, splicing, editing and other operations, resulting in the restored watermark information being inconsistent with the actual watermark information.
  • the watermark information may be embedded repeatedly at different positions in the image to be processed, and the changes in the channel data of the target pixels corresponding to the watermark information at different positions are not completely consistent. Multiple different bit sequences may be restored through step S603. Therefore, statistical analysis can be performed on the multiple different bit sequences to select the bit sequence with the largest number of occurrences (i.e., the most votes) or the largest proportion as the bit sequence corresponding to the watermark information extracted from the image to be processed.
  • the watermark information is extracted by analyzing the brightness component data of each pixel in the image to be processed. Since the watermark information embedded in the image brightness channel has strong robustness, the accuracy of the extracted watermark information is also high.
  • the starting position and the ending position of the watermark information in the image to be processed are indicated by the synchronization block, so that the pixel range can be quickly and accurately located when the watermark information is extracted, which is conducive to improving the efficiency of watermark information extraction.
  • Image S contains watermark information and is transmitted via social software.
  • Image S is a document image in RGB format, where C, H, and W represent the number of channels, length, and width of image S, respectively.
  • C, H, and W represent the number of channels, length, and width of image S, respectively.
  • the image S is not in RGB format, it is also necessary to convert the image S to RGB format first. For example, if the image S is a single-channel png image, first convert the single-channel png image to an RGB format image.
  • Step b2 Obtain the data of each pixel in the image S in the Y channel and the Cb channel, that is, obtain Sy and S Cb .
  • Step b3 perform a binarization operation on S Cb .
  • the binarization can be expressed by the formula as follows:
  • i and j represent the coordinates of the current pixel point respectively.
  • the component value interval is set to (m1, m2) because the original image embedded with watermark information may be transmitted, and the value of the corresponding Cb channel may change. Therefore, binarization by component value interval is more accurate. It should be noted that the size of the component value interval can be set by the user or obtained based on historical test data statistics. The component value interval (m1, m2) corresponding to different types of images may be different.
  • Step b4 After obtaining the binary SCb , perform line-by-line traversal to determine the position of the synchronization block, thereby determining the starting position L and the ending position R of the embedded watermark information.
  • the starting position L and the ending position R are the center positions of the corresponding synchronization blocks, respectively.
  • Step b5 Obtain the distance d between two adjacent target pixel points carrying watermark information and the point neighborhood nb according to the starting position L, the ending position R and the length 32 of the bit sequence.
  • the distance d and point neighborhood nb can be calculated by the following formula:
  • int() represents a rounding function, which can be a floor rounding function or an ceiling rounding function.
  • Step b6 perform binarization operation on Sy .
  • the binarization can be expressed by the formula as follows:
  • i and j in formula (4) represent the coordinates of the current pixel.
  • the component value interval is set to (t1, t2) because the original image embedded with watermark information may be transmitted, and the corresponding component value of the Y channel may change. Therefore, binarization by component value interval is more accurate.
  • Step b7 extract watermark information to obtain multiple candidate bit sequences.
  • the row is determined to be a row with embedded watermark information. And extract 32-bit watermark information from the determined row with embedded watermark information.
  • the row is traversed, starting at L.
  • the pixel range of (L-nb, L+nb) if there is a pixel point with a binary pixel value Sy of 1, the watermark information embedded in this position is 0, otherwise it is 1.
  • After extracting one bit of watermark information jump back d pixels to get a new center position, and continue to traverse and extract one bit of watermark information within the pixel range corresponding to the center position until reaching the end position R, extracting a 32-bit bit sequence, that is, 32-bit watermark information.
  • the target pixel When traversing within a pixel range, if the position of the target pixel can be determined, the target pixel is used as a reference position to jump backward to determine the next center position; if the exact position of the target pixel within the pixel range cannot be determined, the current center position is used as a reference position to jump backward to determine the next center position.
  • Step b8 Voting on multiple candidate bit sequences to obtain a bit sequence corresponding to the watermark information that finally matches the image S as the final result output.
  • the watermark information in the image S can be accurately and quickly extracted.
  • Figures 1 to 7B are used to embed and extract watermark information, and the robustness and security tests are performed using 1000 document images, where the 1000 images are images with text and a white background, with different font densities, and the image size is 640*640.
  • the average ACC (by bit) represents the ratio of the number of bits from which the watermark information in each image is correctly extracted to the total number of bits
  • the ACC (by image) represents the ratio of the number of images from which 32-bit watermark information can be correctly extracted to the total number
  • Average ACC by bit
  • Average ACC by graph
  • Case 3 32-bit watermark information is embedded in these images, and the images are compressed by JPEG using bilinear interpolation, with the compression factor set to 60. The compressed images are tested, and the test results are shown in Table 3 below:
  • Average ACC by bit
  • Average ACC by graph
  • the image watermark processing method provided by the present invention is used to embed watermark information, which can ensure that the watermark information has strong robustness and security, and can solve the impact of network transmission, scaling, compression and other operations on the watermark information, thereby ensuring the security of the watermark information in the image.
  • FIG8 is a schematic diagram of the structure of an image watermark processing device provided by some embodiments of the present disclosure.
  • the image watermark processing device 800 provided by this embodiment includes:
  • the image acquisition module 801 is used to acquire an image to be processed, and perform format conversion on the image to be processed to obtain pixel format data, wherein the pixel format data includes brightness component data, blue chrominance component data, and red chrominance component data.
  • the watermark information acquisition module 802 is used to acquire watermark information and convert the watermark information into a bit sequence.
  • the watermark processing module 803 is used to modify the brightness component data of each target pixel in the image to be processed based on the value of each bit in the bit sequence to obtain target brightness component data; wherein the target pixel is used to carry the The value of the corresponding bit in the bit sequence, and the target pixel point satisfies the array distribution.
  • the data merging module 804 is used to merge the target brightness component data with the blue chromaticity component data and the red chromaticity component data corresponding to the image to be processed to obtain a target image, where the target image is an image with watermark information added corresponding to the image to be processed.
  • the watermark processing module 803 is specifically used to perform block processing on the image to be processed to obtain multiple pixel blocks; determine the bits in the bit sequence corresponding to each of the pixel blocks; and modify the brightness component data of the target pixel point at a specified position in each of the pixel blocks based on the value on the bit corresponding to each of the pixel blocks.
  • the watermark processing module 803 is specifically used to: if the value on the bit corresponding to the pixel block is 1, the brightness component data of the target pixel point at the specified position in the pixel block remains unchanged; if the value on the bit corresponding to the pixel block is 0, the brightness component data of the target pixel point at the specified position in the pixel block is modified to a first preset value.
  • it further includes: a synchronization block processing module 805, which is used to embed a synchronization block into the image to be processed, and the synchronization block is used to indicate the starting position or the ending position of the watermark information.
  • a synchronization block processing module 805 which is used to embed a synchronization block into the image to be processed, and the synchronization block is used to indicate the starting position or the ending position of the watermark information.
  • the synchronization block processing module 805 is specifically used to determine the position of the corresponding synchronization block in the image to be processed based on the starting position or the ending position of the watermark information; modify the blue chromaticity component data/red chromaticity component data corresponding to each pixel point at the position corresponding to the synchronization block to a second preset value to embed the synchronization block in the image to be processed.
  • the image acquisition module 801 is specifically used to convert the image to be processed in RGB format to obtain pixel format data in YCbCr format.
  • the device provided in this embodiment can be used to execute the image watermark processing method provided in any of the aforementioned embodiments to embed watermark information in the image. Its implementation method and technical principle are similar, and reference may be made to the detailed description of the aforementioned method embodiments. For the sake of brevity, they will not be repeated here.
  • FIG9 is a schematic diagram of the structure of an image watermark processing device provided by some embodiments of the present disclosure.
  • the image watermark processing device 900 provided by this embodiment includes:
  • the image acquisition module 901 is used to acquire the image to be processed, and convert the format of the image to be processed to obtain the brightness component data of the image to be processed; wherein the image to be processed contains target pixel points carrying watermark information, and the brightness component data of the target pixel points is determined according to the value of the matching bit in the bit sequence corresponding to the watermark information; the target pixel points are distributed in an array in the image to be processed.
  • the watermark information extraction module 902 is used to determine the target pixel based on the brightness component data of each pixel in the image to be processed; and obtain the bit sequence corresponding to the watermark information based on the brightness component data of the target pixel and the position of the target pixel in the image to be processed.
  • the watermark information extraction module 902 is specifically used to determine the value of the bit corresponding to the target pixel point based on whether the brightness component data of the target pixel point belongs to the first component value interval; determine the position of the bit corresponding to the target pixel point in the bit sequence based on the position of the target pixel point in the image to be processed; based on the position of the bit corresponding to each target pixel point in the bit sequence, arrange the value of the bit corresponding to each target pixel point to obtain the bit sequence corresponding to the watermark information.
  • the watermark information extraction module 902 is specifically used to determine the synchronization block contained in the image to be processed, and determine the starting position and the ending position of the watermark information according to the position of the synchronization block; based on the length of the bit sequence and the distance between the starting position and the ending position, determine the interval and the point neighborhood between adjacent target pixels; traverse each pixel point in the corresponding point neighborhood with the pixel point corresponding to the starting position as the center position to determine the target pixel point; update the center position based on the interval and traverse each pixel point in the corresponding point neighborhood to determine the next target pixel point, and repeat until reaching the ending position to determine the target pixel point.
  • the watermark information extraction module 902 is specifically used to traverse the blue chromaticity component data or the red chromaticity component data of the image to be processed, and determine that the pixel blocks whose blue chromaticity component data or the red chromaticity component data meet the second component value interval are synchronization blocks.
  • the watermark information extraction module 902 is specifically used to obtain multiple candidate bit sequences based on the brightness component data of the target pixel point and the position of the target pixel point in the image to be processed; and perform statistical analysis on the multiple candidate bit sequences to determine the bit sequence corresponding to the watermark information.
  • the device provided in this embodiment can be used to execute the image watermark processing method provided in any of the aforementioned embodiments to extract watermark information from the image. Its implementation method and technical principle are similar, and reference may be made to the detailed description of the aforementioned method embodiments. For the sake of brevity, they will not be repeated here.
  • the various modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be realized; in addition, the specific names of the functional modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present disclosure.
  • the image watermark processing devices 800 and 900 can be implemented in software and/or hardware.
  • the various modules of the text image watermark processing devices 800 and 900 can be implemented as software components executed on one or more general-purpose processors, and can also be implemented as hardware such as a programmable logic device and/or an application-specific integrated circuit for performing certain functions.
  • these modules may be embodied in the form of a software product, which may be stored in a non-volatile storage medium.
  • These non-volatile storage media include a computer device (e.g., a personal computer, a server, a network device, a mobile terminal, etc.) that performs the method described in the embodiments of the present disclosure.
  • the above modules may also be implemented on a single device or distributed on multiple devices. The functions of these modules may be combined with each other or further split into multiple sub-modules.
  • the present disclosure provides an electronic device, comprising: one or more processors; a memory; and one or more computer programs; wherein the one or more computer programs are stored in the memory; when the one or more processors execute the one or more computer programs, the electronic device implements the image watermark processing method of the foregoing embodiments.
  • the present disclosure provides a chip system, which is applied to an electronic device including a memory and a sensor; the chip system includes: a processor; when the processor executes the image watermark processing method of the above embodiment.
  • the present disclosure provides a computer-readable storage medium having a computer program stored thereon.
  • the computer program is executed by a processor in an electronic device, the image watermark processing method of the foregoing embodiment is implemented.
  • the present disclosure provides a computer program product.
  • the computer is enabled to execute the image watermark processing method of the foregoing embodiment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Editing Of Facsimile Originals (AREA)
  • Image Processing (AREA)

Abstract

一种图像水印处理方法及装置。该方法包括获取待处理图像,对所述待处理图像进行格式转换得到像素格式数据。像素格式数据包括亮度分量数据、蓝色色度分量数据、红色色度分量数据。该方法还包括获取水印信息,将所述水印信息转换为比特位序列。该方法还包括基于所述比特位序列中各比特位的值修改所述待处理图像中各目标像素点的亮度分量数据得到目标亮度分量数据。所述目标像素点用于承载所述比特位序列中相应比特位的值,且所述目标像素点满足阵列分布。该方法还包括将所述目标亮度分量数据和所述待处理图像对应的蓝色色度分量数据、红色色度分量数据进行合并得到目标图像,所述目标图像为所述待处理图像对应的添加所述水印信息的图像。

Description

图像水印处理方法及装置
相关申请的交叉引用
本申请是以申请号为202211305240.3、申请日为2022年10月25日的中国专利申请为基础,并主张其优先权,该中国专利申请的公开内容在此作为整体引入本申请中。
技术领域
本公开涉及图像处理技术领域,尤其涉及一种图像水印处理方法及装置。
背景技术
数字水印技术是一种将秘密信息隐藏在载体对象中的技术,可以用于数字产品的版权保护及其真实性和完整性认证。对于图像而言,通过对载体图像嵌入水印信息,可以标记载体图像来源以及为载体图像附上专有的版权标识符,随着互联网技术的快速发展,图像在互联网上传播的速度极快,当含有水印信息的图像泄露,可以根据水印信息追溯来源,保护图像安全。
发明内容
为了解决上述技术问题,本公开提供了一种图像水印处理方法及装置。
第一方面,本公开提供了一种图像水印处理方法,包括:
获取待处理图像,对所述待处理图像进行格式转换得到像素格式数据,所述像素格式数据包括亮度分量数据、蓝色色度分量数据、红色色度分量数据;
获取水印信息,将所述水印信息转换为比特位序列;
基于所述比特位序列中各比特位的值修改所述待处理图像中各目标像素点的亮度分量数据得到目标亮度分量数据;其中,所述目标像素点用于承载所述比特位序列中相应比特位的值,且所述目标像素点满足阵列分布;
将所述目标亮度分量数据和所述待处理图像对应的蓝色色度分量数据、红色色度分量数据进行合并得到目标图像,所述目标图像为所述待处理图像对应的添加所述水印信息的图像。
在一些实施例中,所述基于所述比特位序列中各比特位的值修改所述待处理图像中各目标像素点的亮度分量数据得到目标亮度分量数据,包括:
对所述待处理图像进行分块处理得到多个像素块;
确定所述比特位序列中与各所述像素块分别对应的比特位;
基于与各所述像素块相对应的所述比特位上的值修改各所述像素块中指定位置的目标像素点的亮度分量数据。
在一些实施例中,所述基于与各所述像素块相对应的所述比特位上的值修改各所述像素块中指定位置的目标像素点的亮度分量数据,包括:
若所述像素块对应的比特位上的值为1,则所述像素块中指定位置的目标像素点的亮度分量数据不变;
若所述像素块对应的比特位上的值为0,则将所述像素块中指定位置的目标像素点的亮度分量数据修改为第一预设值。
在一些实施例中,所述将所述目标亮度分量数据、所述待处理图像对应的蓝色色度分量数据、红色色度分量数据进行合并得到所述目标图像之前,还包括:向所述待处理图像中嵌入同步块,所述同步块用于指示所述目标像素点在所述目标图像中的起始位置或结束位置。
在一些实施例中,所述向所述待处理图像中嵌入同步块,包括:
基于所述目标像素点在所述目标图像中的起始位置和结束位置确定相应同步块在所述待处理图像中的位置;
修改所述同步块对应的位置的各像素点对应的蓝色色度分量数据或红色色度分量数据为第二预设值,以在所述待处理图像中嵌入所述同步块。
在一些实施例中,所述对所述待处理图像进行格式转换得到像素格式数据,包括:对RGB格式的待处理图像进行格式转换得到YCbCr格式的像素格式数据。
第二方面,本公开提供了一种图像水印处理方法,包括:
获取待处理图像,对所述待处理图像格式转换得到所述待处理图像的亮度分量数据;其中,所述待处理图像包含承载水印信息的目标像素点,所述目标像素点的亮度分量数据是根据所述水印信息对应的比特位序列中相匹配的比特位的值确定的;所述目标像素点在所述待处理图像中呈阵列分布;
基于所述待处理图像中各像素点的亮度分量数据确定所述目标像素点;
基于所述目标像素点的亮度分量数据以及所述目标像素点在所述待处理图像中的位置得到所述水印信息对应的比特位序列。
在一些实施例中,所述基于所述目标像素点的亮度分量数据以及所述目标像素点在所述待处理图像中的位置得到所述水印信息对应的比特位序列,包括:
基于所述目标像素点的亮度分量数据是否属于第一分量值区间确定所述目标像素点对应的比特位的值;
基于所述目标像素点在所述待处理图像中的位置确定所述目标像素点对应的比特位在所述比特位序列中的位置;
基于各所述目标像素点对应的比特位在所述比特位序列中的位置,将各所述目标像素点对应的比特位的值进行合并得到所述水印信息对应的比特位序列。
在一些实施例中,所述基于所述待处理图像中各像素点的亮度分量数据确定所述目标像素点,包括:
确定所述待处理图像中包含的同步块,并根据所述同步块的位置确定所述水印信息的起始位置和结束位置;
基于所述比特位序列的长度以及所述起始位置和所述结束位置之间的距离,确定相邻所述目标像素点之间的间隔和点邻域;
以所述起始位置对应的像素点为中心位置遍历相应点邻域内各像素点以确定所述目标像素点;基于所述间隔更新所述中心位置并遍历在相应点邻域内各像素点以确定下一个所述目标像素点,重复执行直至到达所述结束位置,确定所述目标像素点。
在一些实施例中,所述确定所述待处理图像中包含的同步块,包括:遍历所述待处理图像的蓝色色度分量数据或红色色度分量数据,确定蓝色色度分量数据或红色色度分量数据满足第二分量值区间的像素块为同步块。
在一些实施例中,所述基于所述目标像素点的亮度分量数据以及所述目标像素点在所述待处理图像中的位置得到所述水印信息对应的比特位序列,包括:
基于所述目标像素点的亮度分量数据以及所述目标像素点在所述待处理图像中的位置得到多个候选比特位序列;
对所述多个候选比特位序列进行统计分析确定所述水印信息对应的比特位序列。
第三方面,本公开提供了一种图像水印处理装置,包括:
图像获取模块,用于获取待处理图像,对所述待处理图像进行格式转换得到像素格式数据,所述像素格式数据包括亮度分量数据、蓝色色度分量数据、红色色度分量数据;
水印信息获取模块,用于获取水印信息,将所述水印信息转换为比特位序列;
水印处理模块,用于基于所述比特位序列中各比特位的值修改所述待处理图像中各目标像素点的亮度分量数据得到目标亮度分量数据;其中,所述目标像素点用于承载所述比特位序列中相应比特位的值,且所述目标像素点满足阵列分布;
数据合并模块,用于将所述目标亮度分量数据和所述待处理图像对应的蓝色色度分量数据、红色色度分量数据进行合并得到目标图像,所述目标图像为所述待处理图像对应的添加所述水印信息的图像。
第四方面,本公开提供了一种图像水印处理装置,包括:
图像获取模块,用于获取待处理图像,对所述待处理图像格式转换得到所述待处理图像的亮度分量数据;其中,所述待处理图像包含承载水印信息的目标像素点,所述目标像素点的亮度分量数据是根据所述水印信息对应的比特位序列中相匹配的比特位的值确定的;所述目标像素点在所述待处理图像中呈阵列分布;
水印信息提取模块,用于基于所述待处理图像中各像素点的亮度分量数据确定所述目标像素点;以及,基于所述目标像素点的亮度分量数据以及所述目标像素点在所述待处理图像中的位置得到所述水印信息对应的比特位序列。
第五方面,本公开提供了一种电子设备,包括:存储器和处理器;
所述存储器被配置为存储计算机程序指令;所述处理器被配置为执行所述计算机程序指令,使得所述电子设备实现如第一方面以及第一方面任一项,或者,第二方面以及第二方面任一项所述的图像水印处理方法。
第六方面,本公开提供了一种可读存储介质,包括:计算机程序指令;电子设备的至少一个处理器执行所述计算机程序指令,使得所述电子设备实现如第一方面以及第一方面任一项,或者,第二方面以及第二方面任一项所述的图像水印处理方法。
第七方面,本公开提供了一种计算机程序产品,电子设备运行所述计算机程序产品,使得所述电子设备实现如第一方面及第一方面任一项,或者,第二方面及第二方面任一项所述的图像水印处理方法。
本公开实施例提供一种图像水印处理方法及装置,其中,该方法提供了一个具有强鲁棒性和高安全性的图像水印解决方案。具体通过在图像的亮度通道进行水印信息嵌入,其中,在亮度通道进行嵌入使得图像在红(R)、绿(G)、蓝(B)三个色彩通道都产生变化,对图像的修改量和修改幅度较大,能够保证图像具有较强的鲁棒性,且图像中承载水印信息的像素点呈点状阵列分布,两者结合使得带有水印信息的图像在经过网络传输、裁剪、 拼接、编辑等等操作之后,能够提取出完整且准确度较高的水印信息;此外,若点状阵列形式的水印为明水印,对于用户来说水印虽然视觉可见但无法直接提取到水印信息的内容,使得呈点状阵列形式的明水印具有暗水印的特性,提升了水印信息的安全性。
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本公开的实施例,并与说明书一起用于解释本公开的原理。
为了更清楚地说明本公开实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,对于本领域普通技术人员而言,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1为本公开一些实施例提供的图像水印处理方法的流程示意图;
图2A为本公开示例性示出的嵌入水印信息的场景图;
图2B为本公开示例性示出的嵌入水印信息的场景图;
图2C为本公开示例性示出的嵌入水印信息的目标图像的效果图;
图3为本公开一些实施例提供的图像水印处理方法的流程示意图;
图4A和图4B分别为本公开示例性示出的同步块在图像中的位置示意图;
图4C为本公开示例性示出的嵌入了同步块的目标图像的效果图;
图5为本公开一些实施例提供的图像水印处理方法的流程示意图;
图6为本公开一些实施例提供的图像水印处理方法的流程示意图;
图7A为本公开示例性示出的从图像中提取水印信息的场景图;
图7B为本公开示例性示出的从图像中提取水印信息的场景图;
图8为本公开一些实施例提供的图像水印处理装置的结构示意图;
图9为本公开一些实施例提供的图像水印处理装置的结构示意图。
具体实施方式
为了能够更清楚地理解本公开的上述目的、特征和优点,下面将对本公开的方案进行进一步描述。需要说明的是,在不冲突的情况下,本公开的实施例及实施例中的特征可以相互组合。
在下面的描述中阐述了很多具体细节以便于充分理解本公开,但本公开还可以采用其他不同于在此描述的方式来实施;显然,说明书中的实施例只是本公开的一部分实施例, 而不是全部的实施例。
术语释义:
YUV:是一种颜色编码方法。YUV(YUV420p\YUV444\YUV422),YCbCr等格式都可以称为YUV,彼此有重叠。其中,“Y”表示明亮度(Luminance或Luma),也称为亮度,也就是灰阶值;“U”和“V”表示的则是色度(Chrominance或Chroma),作用是描述影像色彩及饱和度,用于指定像素的颜色,通常采用R(红色)和B(蓝色)的信号表示色度的UV。YCbCr格式通常用来描述数字的视频信号,常用于数字视频以及数字图像,其中,Cb指蓝色色度分量,表示蓝色的浓度偏移量成份,Cr指红色色度分量,表示红色的浓度偏移量成份。
RGB:是一种颜色编码方法,其中,R表示红色、G表示绿色、B表示蓝色,采用这种编码方法,每种颜色都可用R、G、B三个变量来表示,分别代表红色、绿色以及蓝色的强度。
其中,RGB与YUV之间可以互相转换。
基于水印是否可见可以分为明水印和暗水印两种。明水印由于对原始载体图像的修改量和修改幅度都比较大,能够实现较强的鲁棒性,但同时也会导致嵌入了水印信息的图像的图像统计特性发生较大变化,从而水印信息容易被检测出来,且损失了图像的视觉质量。暗水印可以提供较高的安全性,保证水印信息不易被检测出来,但鲁棒性不高,嵌入了水印信息的图像在经过网络传输、剪切、拼接、编辑、压缩等操作,极易导致水印信息丢失。
鉴于此,本公开提供一种图像水印方法,该方法提供了一个具有强鲁棒性和高安全性的图像水印解决方案。具体通过在图像的亮度通道进行水印信息嵌入,其中,在亮度通道进行嵌入使得图像在红(R)、绿(G)、蓝(B)三个色彩通道都产生变化,对图像的修改量和修改幅度较大,能够保证图像具有较强的鲁棒性,且图像中承载有水印信息的像素点呈点状阵列分布,两者结合使得带有水印信息的图像在经过网络传输、裁剪、拼接、编辑等等操作之后,能够提取出完整且准确度较高的水印信息;此外,若点状阵列形式的水印在图像中可见,对于用户来说水印虽然视觉可见但无法直接提取到水印信息的内容,使得呈点状阵列形式的明水印具有暗水印的特性,同时保证了水印信息的安全性。
其中,本公开提供的图像水印处理方法选择在亮度通道嵌入水印信息是由于亮度通道与RGB三个色彩通道的关联性较强,因此,对图像的亮度分量数据进行修改会改变RGB三个色彩通道的数据,且相比较而言,RGB通道的数据的改变对于亮度分量数据的影响远 远小于亮度分量数据的改变对于RGB通道的数据的影响,因此,通过修改图像的亮度分量数据嵌入水印信息能够使得水印信息具有较强的鲁棒性。
本公开提供的图像水印处理方法可以由本公开提供的图像水印处理装置执行,该装置可以通过任意的软件和/或硬件的方式实现。示例性地,图像水印处理装置可以但不限于为:平板电脑、手机(如折叠屏手机、大屏手机等)、可穿戴设备、车载设备、增强现实(augmented reality,AR)/虚拟现实(virtual reality,VR)设备、笔记本电脑、超级移动个人计算机(ultra-mobile personal computer,UMPC)、上网本、个人数字助理(personal digital assistant,PDA)、智能电视、智慧屏、高清电视、4K电视、智能投影仪等物联网(the internet of things,IOT)设备等各类电子设备,本公开对电子设备的具体类型不作任何限制。
基于前述描述,本公开以实施例将以电子设备为例,结合附图和应用场景,对本公开提供的图像水印处理方法进行详细阐述。其中,本公开提供的图像水印处理方法可以分为水印信息嵌入和水印信息提取两部分内容,下文中将分别进行介绍。
接下来,通过图1至图5所示实施例介绍如何嵌入水印信息。
请参阅图1,图1为本公开实施例提供的图像水印处理方法的流程示意图。如图1所示,本公开提供的图像水印处理方法可以包括:
S101、获取待处理图像,对待处理图像进行格式转换得到像素格式数据,像素格式数据包括亮度分量数据、蓝色色度分量数据以及红色色度分量数据。
待处理图像可以为任意类型的数字图像,例如,文档类图像、网页图像、彩色图像等等,本公开对此不做限定。此外,本公开对于待处理图像的尺寸、图像内容、存储格式等等其他图像参数均不做限定。
若原始的待处理图像非RGB格式,则可以先将其转换为RGB格式,得到待处理图像的RGB数据。例如,要嵌入水印信息的原始待处理图像为单通道的png图像,则先将单通道的png图像转换为三通道的RGB格式的图像。若原始的待处理图像为RGB格式,则可以不做处理。
得到RGB格式的待处理图像,可以利用RGB格式与YUV格式之间的转换矩阵将RGB数据转换为YUV数据。其中,YUV数据包括亮度分量数据以及UV通道分别指示的色度分量数据。亮度分量数据包括待处理图像中各像素点对应的亮度分量数据(也可以理解为亮度分量值),类似地,U通道对应的色度分量数据包括待处理图像中各像素点对应的色度分量值,以及V通道对应的色度分量数据包括待处理图像中各像素点对应的色度分量 值。
S102、获取水印信息,将所述水印信息转换为比特位序列。
其中,水印信息可以是用户输入至电子设备的,或者,也可以是由电子设备自动生成的,或者,还可以是预先指定的。水印信息可以但不限于由文字、数字、符号、英文字母等一种或多种组成的文本序列。
水印信息可以通过比特位序列表示,比特位序列即为二进制序列或者比特序列,比特位序列中每一个比特位上的值代表1位水印信息,所有比特位上的值按照顺序组合起来即可以还原出水印信息的内容。其中,比特位序列的长度(即比特位数)可根据水印信息的数据量而定,或者,也可以是指定的长度。
本公开对于将水印信息对应的文本序列转换为比特位序列的实现方式不作限定,可以利用任一现有方式实现。
S103、基于所述比特位序列中各比特位的值修改待处理图像中目标像素点的亮度分量数据得到目标亮度分量数据。
在一些实施例中,可以对待处理图像进行分块处理得到多个像素块,基于嵌入策略从多个像素块中确定承载水印信息的目标像素块,其中,每个目标像素块用于承载比特位序列中一比特位上的值。然后基于比特位序列中各比特位的值以及各比特位与目标像素块之间的对应关系,修改目标像素块中指定位置的像素点(即目标像素点)的亮度分量数据,非目标像素点的亮度分量数据保持不变。
也可以理解为是将像素块进行分组,在每个像素块组中都嵌入水印信息。而像素块组中承载水印信息的像素块即为目标像素块。像素块组中包含的像素块的数量可以等于比特序列的长度。
嵌入策略可以包括:水印信息的嵌入方向、如,水平方向、竖直方向、对角线方向等等;还可以包括:重复嵌入水印信息时的行间隔、列间隔等信息,例如,逐行嵌入、逐列嵌入、间隔一行嵌入、间隔一列嵌入,需要说明的是,此处所指的“行”和“列”是指像素块行、像素块列;还可以包括水印信息的重复次数等等。
修改目标像素块中指定位置的像素点(即目标像素点)在Y通道的分量值时,指定位置可以为目标像素块中的任意位置,例如,左上角、右上角、中心位置等等,本公开对于指定位置不做限定。此外,针对承载一组完整的水印信息的多个目标像素块可以修改相同指定位置的目标像素点的亮度分量值,可以使得目标像素点形成的阵列排列较为整齐,水 印为可见水印时视觉效果较好;当然,多个目标像素块也可以分别修改不同位置的目标像素点的亮度分量值,其也可以按照一定的规律变化,例如,按照奇数个像素块修改位置1的目标像素点,偶数个目标像素块修改位置2的目标像素点。
修改目标像素块中目标像素点的亮度分量数据可以按照如下方式实现:若相应比特位上的值为1,则不修改目标像素点的亮度分量数据;若相应比特位上的值为0,则将目标像素点的亮度分量数据修改为第一预设值。本公开对于第一预设值的大小不做限定。针对不同的待处理图像可以采用不同的第一预设值。第一预设值的大小也可以由用户在启动对图像嵌入水印信息时指定,也可以是预先指定的。
在嵌入水印信息时,可能存在一些像素块组中的像素块数量小于比特位序列的长度,则无法嵌入完整的水印信息,嵌入策略中还可以包括这样的情况的处理方式。例如,在像素块分组的数量不足时,可以嵌入不完整的水印信息,或者,可以不嵌入水印信息,当然,还可以采用其他方式处理。
示例性地,参照图2A所示,假设要向待处理图像中嵌入16位水印信息,待处理图像的尺寸为320*320,将待处理图像中的像素点划分为10*10的像素块,其中,沿水平方向上每行可以包括32个像素块,假设沿水平方向嵌入水印信息,其中,每行的第1个像素块和第17个像素块可以分别对应一完整水印信息的起始位置,第1个像素块至第16个像素块用于承载一完整的16位水印信息,第17个像素块至第32个像素块用于承载一完整的16位水印信息。图2A中示出了第一行像素块与水印信息之间的对应关系,其他行类似。
在图2A所示实施例的基础上,假设修改每个像素块中心位置的像素点的亮度分量数据,基于比特位序列中第1至第16比特位的值修改第1行中第1至第16个像素块的中心位置的像素点的亮度分量数据,以及,基于比特位序列中第1至第16比特位的值修改第1行中第17至第32个像素块的中心位置的像素点的亮度分量数据。其他要嵌入水印信息的一行或多行像素块都可以按照这样的方式处理。可以每行像素块中都嵌入水印信息,也可以跨行嵌入水印信息。
向待处理图像中可以重复嵌入水印信息,且一些图像区域中的水印信息可能不完整。示例性地,参照图2B所示,假设要向待处理图像中嵌入16位水印信息,待处理图像的尺寸为320*320,将待处理图像中的像素点划分为15*15的像素块,其中,沿水平方向上每行可以包括20个像素块,即不考虑在每行最后5个像素点中嵌入水印。假设按照水平方向嵌入16位水印信息,水印信息为16位。水平方向为20个像素块,第1至16像素块(即 一个像素块组)可以承载一完整的水印信息,第17至第20个像素块(即一个像素块组)仅能够嵌入前4位水印信息,即第17至第20个像素块对应的图像区域承载的水印信息是不完整的。图2B中示出了第一行像素块与水印信息之间的对应关系,其他行类似。其他要嵌入水印信息的一行或多行像素块都可以按照这样的方式处理,每行的第17至第20个像素块所承载的水印信息都是部分水印信息。
S104、将目标亮度分量数据、所述待处理图像对应的蓝色色度分量数据、红色色度分量数据进行合并得到目标图像,目标图像为待处理图像对应的添加水印信息的图像。
通过执行步骤S103可以得到目标图像中各像素点在Y通道的数据,再将目标图像中各像素点在Y通道的数据和待处理图像中各像素点分别在U通道和V通道的分量值按像素点进行合并,可以得到目标图像中各像素点分别在Y通道、U通道以及V通道的分量值,再利用转换矩阵基于各像素点分别在Y通道U通道以及V通道的分量值进行格式转换得到目标图像对应的RGB格式的像素格式数据并导出存储。
本公开的图像水印处理方法中目标像素点可以呈阵列分布,即这些目标像素点会形成点状阵列的水印,点状阵列水印可以是明水印,也可以是暗水印;若为明水印,用户在预览目标图像时,虽然可以观察到点状阵列形式的明水印,但点状阵列的明水印所表示的水印信息是无法被用户直接获取的,使得点状阵列的明水印具有暗水印的特性,提升了水印信息的安全性。若为暗水印,首先用户从视觉上是无法感知到水印的,即使还原出点状阵列,其也无法轻易还原出水印信息的内容,安全性较高。
示例性地,如图2C所示的文档图像中可以观察到点状阵列,这些点状阵列即明水印,但实际水印信息的内容是无法被用户直接获取的。且观察图2C可知,这些可见的像素点几乎不会影响文档图像中的文字的视觉效果,保证了文档图像的图像质量。需要说明的是,在图2C中可以观察到一些点之间距离较近,一些点之间的距离较远,实际距离较远的点之间是存在承载水印信息的目标像素点,这些目标像素点对应的比特位的值为1,未修改亮度分量数据,因此为白色,与文档图像的背景颜色一致。可见的这些目标像素点对应的比特位的值为0,由于修改了亮度分量数据,因此能够视觉可见。
本实施例的方法通过在图像的亮度通道进行水印信息嵌入,其中,在亮度通道进行嵌入使得图像在RGB三个色彩通道都产生变化,对图像的修改量和修改幅度较大,能够保证图像具有较强的鲁棒性,且图像中承载水印信息的像素点呈点状阵列分布,两者结合使得带有水印信息的图像在经过网络传输、裁剪、拼接、编辑等等操作之后,能够提取出完 整且准确度较高的水印信息;此外,若点状阵列形式的水印为明水印,对于用户来说水印虽然视觉可见但无法直接提取到水印信息的内容,使得呈点状阵列形式的明水印具有暗水印的特性,同时保证了水印信息的安全性。
图3为本公开一些实施例提供的图像水印处理方法的流程示意图。请参阅图3所示,本实施例的方法包括:
S301、获取待处理图像,对待处理图像进行格式转换得到像素格式数据,像素格式数据包括亮度分量数据、蓝色色度分量数据以及红色色度分量数据。
S302、获取水印信息,将所述水印信息转换为比特位序列。
S303、基于所述比特位序列中各比特位的值修改待处理图像中目标像素点的亮度分量数据得到目标亮度分量数据。
本实施例中步骤S301至步骤S303分别与图1所示实施例中步骤S101至步骤S103类似,可参照图1所示实施例的详细描述,简明起见,此处不再赘述。
本公开为了保证能够快速定位一完整的水印信息在图像中的起始位置以及结束位置,因此,嵌入水印信息时还嵌入同步块,通过同步块指示水印信息在图像中的起始位置和结束位置,水印信息的起始位置和结束位置可以理解为水印信息对应的同步信息。可通过步骤S304和步骤S305实现。
S304、基于所述水印信息的起始位置或结束位置确定相应同步块在所述待处理图像中的位置。
同步块的大小可以预先设定,如,同步块的长度可以小于嵌入水印信息时划分的像素块的长度的二分之一,同步块的宽度可以小于嵌入水印信息时划分的像素块的宽度的二分之一。示例性地,假设嵌入水印信息时划分的像素块为10*10,同步块大小可以为1*4、2*4、3*4、4*4等等。也可以在用户启动图像水印处理时指定同步块大小。
用于指示水印信息的起始位置的同步块的位置可以基于比特位序列中第一个比特位对应的像素块确定,例如,同步块可以位于第一个比特位对应的像素块中,如,该同步块的中心位置可以与第一个比特位对应的像素块的中心位置重叠,或者,该同步块的一个或多个边缘与第一个比特位对应的像素块的一个或多个边缘重叠。类似地,用于指示水印信息的结束位置的同步块的位置可以基于比特位序列中最后一个比特位对应的像素块确定,例如,同步块可以位于最后一个比特位对应的像素块中,如,该同步块的中心位置可以与 最后一个比特位对应的像素块的中心位置重叠,或者,该同步块的一个或多个边缘与最后一个比特位对应的像素块的一个或多个边缘重叠。
示例性地,图4A和图4B示出了将同步块在图像中的位置示意图。请参阅图4A所示,指示起始位置的同步块s1的中心位置与第一个比特位对应的像素块r1的中心位置重叠,指示结束位置的同步块s2的中心位置与最后一个比特位对应的像素块r2的中心位置重叠;请参阅图4B所示,指示起始位置的同步块s1的左侧边缘和上边缘分别与第一个比特位对应的像素块r1的左侧边缘和上边缘的重叠,指示结束位置的同步块s2的右侧边缘和上边缘分别与最后一个比特位对应的像素块r2的右侧边缘和上边缘的重叠。当然,还可以为其他方式,本公开不一一示出。
其中,同步块s1和同步块s2可以理解为一同步块组,在待处理图像中可以嵌入一个或多个同步块组,本公开对此不作限定。
S305、修改同步块对应的位置的各像素点对应的蓝色色度分量数据/红色色度分量数据为第二预设值,得到目标蓝色色度分量数据/目标红色色度分量数据。
本公开对于第二预设值的大小不作限定,可以是预先设定的,也可以是由用户在启动图像水印处理时指定的。例如,待处理图像为文档类图像时,可以修改同步块对应的各像素点的蓝色色度分量值为第二预设值,第二预设值可以但不限于为80。
修改同步块内所有像素点的蓝色色度分量数据/红色色度分量数据为第二预设值,其他非同步块的像素点的蓝色色度分量数据/红色色度分量数据保持不变。例如,修改图4A和图4B中所示的同步块s1、s2内所有像素点的在U通道的分量值为80,从而嵌入同步块。
需要说明的是,修改不同通道的色度分量值时,第二预设值可以对应不同大小,且第二预设值的大小可以与图像有关,也可以与图像本身无关。
S306、将目标亮度分量数据、目标蓝色色度分量数据以及待处理图像对应的红色色度分量数据进行合并,或者,将目标亮度分量数据、目标红色色度分量数据以及待处理图像对应的蓝色色度分量数据进行合并,得到目标图像,此时目标图像为待处理图像对应的添加了水印信息和同步块的图像。
将目标亮度分量数据、目标蓝色色度分量数据以及待处理图像对应的红色色度分量数据进行合并,或者,将目标亮度分量数据、目标红色色度分量数据以及待处理图像对应的蓝色色度分量数据进行合并,可以得到目标图像对应的YUV数据,再通过格式转换将YUV数据转换RGB数据并导出为能够存储的图像格式。例如,利用YUV与RGB之间的转换 矩阵对目标图像对应的YUV数据进行格式转换得到目标图像对应的RGB数据并存储,得到嵌入了水印信息以及同步块的目标图像。
在一些实施例中,向目标图像嵌入同步块包括向目标图像嵌入一组或多组同步块,每组同步块包括一对同步块,分别用于指示水印信息的起始位置和结束位置。示例性地,如图4C所示的目标图像中可以观察到多组同步块,分别为同步块x1至x4,其中,同步块x1和同步块x2为一组,同步块x3和同步块x4为一组。同步块x1和同步块x3用于标识水印信息的起始位置,同步块x2和x4用于标识水印信息的结束位置。在一些实施例中,目标图像的各行或各列嵌入的水印信息位置是对齐的,在这种情况下,可以只用向第一行和最后一行或者第一列和最后一列嵌入指示水印信息的起始位置和结束位置的同步块。由此可以节省同步块嵌入所需要的处理操作。示例性地,图4C所示的目标图像中针对每行的像素块都沿水平方向嵌入水印信息,且每行的水印信息对应的初始位置沿竖直方向是对齐的,因此,中间未嵌入同步块的区域可以按照上方或下方的同步块确定相应行中水印信息的初始位置和结束位置。
本实施例通过在待处理图像中嵌入同步块指示水印信息在图像中的起始位置和结束位置,方便在提取水印信息时能够快速定位包含水印信息的目标像素点所在的图像区域。
在一个具体的实施例中,假设需要向一张图像M中嵌入水印信息,其中,C、H、W分别表示原始图像M的通道数量、长度以及宽度,假设图像M为320*320,即H=320,W=320。水印信息为32位的比特序列。且本实施例中,以图像M为单通道png图像为例,在YCbCr格式下嵌入水印信息和同步块为例进行示例。嵌入水印信息的流程可以如图5所示,主要包括以下步骤:
步骤a1、如图像M是单通道的png图像或者其他非RGB格式的图像,则需要先将图像M转换为RGB格式,否则跳过步骤a1直接执行步骤a2。步骤a1在图5中未标记。
步骤a2、通过YUV与RGB之间的变换矩阵,将图像M由RGB格式转换为YCbCr格式。即M=YCbCr(M)。
步骤a3、获取图像M在Y通道的数据以及Cb通道的数据。即得到My和MCb
需要说明的是,通过转换也得到了图像M在Cr通道的数据。
步骤a4、修改图像M左上角和右上角位置像素点在Cb通道的数据,以嵌入4*4的同步块。可通过公式表示如下:
MCb(j,k)=v;j,k=1,2,3,4,317,318,319,320    公式(1)
v表示同步块中各像素点在Cb通道的分量值大小,例如v=80。j,k表示同步块对应的像素点的坐标。
步骤a5、根据32位水印信息修改图像M的Y通道的数据,采用My表示M的Y通道的像素值。
假设,将M划分成10*10的像素块,可以得到32行像素块,每行有32个像素块。在每行的像素块的中心位置嵌入1位水印信息。以第1行的32个像素块为例嵌入32位水印信息,后面第2至第32行的操作与此类似。其中,第一行的32个像素块的中心位置为(6,6)、(6,16)、(6,26)……(6,316),根据水印信息修改这些位置的像素点的值,其中,若要嵌入的信息为1,则不修改;如果要嵌入的信息为0,则修改Y通道的值为120,即My(j,k)=120。剩余每行嵌入水印信息的方式与此类似。
步骤a6、当所有像素块行都嵌入了水印信息,再将图像M由YCbCr格式转换为RGB格式,即得到目标图像M'=RGB(M)。
通过图5所示实施例能够向图像M嵌入水印信息,且鲁棒性以及安全性均较高。此外,还嵌入了同步块信息用于快速定位水印信息的起始位置和结束位置,提升水印信息提取效率。
接下来,将通过图6至图7B详细介绍如何从图像中提取水印信息。本实施例以电子设备为例进行详细介绍。
图6为本公开一些实施例提供的图像水印处理方法的流程图。请参阅图6所示,本实施例的方法包括:
S601、获取待处理图像,对待处理图像格式转换得到待处理图像的亮度分量数据;其中,待处理图像包含承载有水印信息的目标像素点,目标像素点的亮度分量数据是根据水印信息对应的比特位序列中相匹配的比特位的值确定的;目标像素点在待处理图像中呈阵列分布。
其中,待处理图像可以是采用如前述任一实施例所示的图像水印处理方法嵌入水印信息得到的图像。待处理图像可以是包含水印信息的原始图像,也可以原始图像是经过网络传输、裁剪、缩放、拼接、编辑等操作之后得到的图像。
若输入至电子设备的待处理图像非RGB格式,则可以先将其转换为RGB格式得到待 处理图像的RGB数据。例如,待处理图像为单通道的png图像,则先将单通道的png图像转换为RGB格式。若待处理图像为RGB格式,则可以直接将其转换为YUV格式。
针对RGB格式的待处理图像,可以利用RGB与YUV之间的转换矩阵对待处理图像进行格式转换得到待处理图像的YUV数据。其中,YUV数据包括亮度分量数据以及UV通道分别指示的色度分量数据。亮度分量数据包括待处理图像中各像素点对应的亮度分量数据(也可以理解为亮度分量值),类似地,U通道对应的色度分量数据包括待处理图像中各像素点对应的色度分量值,以及V通道对应的色度分量数据包括待处理图像中各像素点对应的色度分量值。
S602、基于所述待处理图像中各像素点的亮度分量数据确定所述目标像素点。
一些实施例中,电子设备可以对待处理图像中各像素点的亮度分量数据进行二值化操作得到各像素点的亮度分量数据分别对应的二值化结果;再确定水印信息的起始位置和结束位置,并对起始位置和结束位置所指示的像素范围之内的各像素点进行投影,得到像素范围内各像素点的亮度分量数据所对应的二值化结果之和,若二值化结果之和在预设范围之内,则确定该像素范围内存在一完整的水印信息,若二值化结果之和不在预设范围之内,则确定该像素范围内不存在完整的水印信息。之后,针对存在完整水印信息的像素范围,从起始位置开始遍历,确定该像素范围内用于承载水印信息的目标像素点。其中,对亮度分量数据进行二值化时,可以基于预先设定的第一分量值区间进行操作,第一分量值区间包含用户在嵌入水印信息时采用的第一预设值。
另一些实施例中,电子设备先确定水印信息的起始位置和结束位置,再判断起始位置和结束位置所指示的像素范围之内的各像素点的亮度分量数据是否属于第一分量值区间;将亮度分量数据属于第一分量值区间的像素点沿指定方向进行投影得到这些像素点的亮度分量数据之和;若亮度分量数据之和在预设范围之内,则确定该像素范围内存在一完整的水印信息,若亮度分量数据之和不在预设范围之内,则确定该像素范围内不存在完整的水印信息。之后,针对存在完整水印信息的像素范围,再从起始位置开始遍历,确定用于承载水印信息的目标像素点。
在上述任一实现方式中,水印信息的起始位置和结束位置可以基于待处理图像中包含的同步块确定。电子设备可以通过遍历待处理图像中各像素点的U通道数据或者V通道数据确定同步块,或者,也可以先对待处理图像中各像素点的U通道数据或者V通道数据进行二值化操作,再遍历二值化结果确定同步块。其中,若通过二值化的方式确定同步块, 则电子设备可以基于预设的第二分量值区间对U通道数据或者V通道数据进行二值化操作。或者,也可以直接基于第二分量值区间遍历各像素点的U通道数据或者V通道数据确定同步块。第二预设分量区间包含用户在嵌入同步块时采用的第二预设值。
在上述任一实现方式中,针对存在一完整水印信息的像素范围,从起始位置开始遍历确定目标像素点,需要依赖相邻目标像素点之间的距离d以及点邻域nb两个参数实现。这两个参数可以基于一完整水印信息的起始位置和结束位置之间的距离以及比特位序列的长度确定。其中,水印信息的起始位置和结束位置之间的距离可根据指示起始位置的同步块和指示结束位置的同步块之间的距离得到。其中,对起始位置和结束位置之间的距离与比特位序列的长度之间的比值取整得到相邻目标像素点之间的距离d。根据相邻目标像素点之间的距离d确定点邻域nb,点邻域nb即表示针对每个中心位置进行遍历时的半径,点邻域nb的值表示半径内包含的像素点个数。其中,比特位序列的长度可以是预先指定。
此外,在遍历确定目标像素点时,可以起始位置对应的像素点为第一个中心位置,遍历相应点邻域内的像素点的亮度分量数据或者亮度分量数据对应的二值化结果,若存在亮度分量数据属于第一分量值区间或者二值化结果为1的像素点,则确定该像素点为第一个目标像素点,并以该目标像素点为参考位置向后跳跃d个像素点,确定下一个中心位置;若不存在Y通道的分量值属于第一分量值区间或者二值化结果为1的像素点,则以起始位置为参考位置向后跳跃d个像素点,确定下一个中心位置。针对下一个中心位置,采用类似的方式遍历;以此类推,直至达到结束位置,则可以一完整水印信息对应的所有目标像素点。其中,若基于亮度分量数据进行遍历,若遍历到亮度分量数据属于第一分量值区间的像素点,则确定相应比特位的值为0,反之为1;若基于亮度分量数据对应的二值化结果进行遍历,若遍历到二值化结果为1的像素点,则确定相应比特位的值为0,反之为1。
需要说明的是,在一些情况下,待处理图像中一些图像区域中的水印信息可能不完整,例如图2B所示的情况,为了能够提取到这部分图像区域中的水印信息,可以基于其他存在完整水印信息的图像区域对这部分图像区域进行补全,例如图2B所示的情况,可以将第5列像素块至第16列像素块的数据复制拼接在第20列像素块的右侧,使得电子设备基于第17至第20列的像素块以及复制拼接的第5列像素块至第16列像素块的数据,从每行都能够提取到完整的水印信息。若待处理图像中存在其他水印信息不完整的图像区域,可以采用类似的方式基于包含水印信息的图像区域对其进行补全。
S603、基于所述目标像素点的亮度分量数据以及所述目标像素点在所述待处理图像中 的位置得到所述水印信息对应的比特位序列。
其中,目标像素点的亮度分量数据承载一对应的比特位的值。可基于亮度分量数据或者亮度分量数据对应的二值化结果确定相对应的比特位的值,如步骤S602中的描述。
其中,基于目标像素点在待处理图像中的位置能够确定各目标像素点的先后顺序,而目标像素点的先后顺序与比特位序列中各比特位的先后顺序一致,因此,按照各目标像素点的顺序将目标像素点分别对应的比特位的值进行排列,从而得到水印信息对应的比特位序列。
在一些实施例中,待处理图像中一些承载水印信息的目标像素点的通道数据可能由于经过网络传输、裁剪、拼接、编辑等操作发生了变化,导致还原的水印信息与实际水印信息不一致,且待处理图像中可能重复多次在不同位置嵌入了水印信息,不同位置的水印信息对应的目标像素点的通道数据变化也不完全一致,通过步骤步骤S603可能会还原得到多种不同的比特位序列,因此,可通过对多种不同的比特位序列进行统计分析,从中选择出现次数最多(即投票最多)或者占比最大的比特位序列作为从待处理图像中提取的水印信息对应的比特位序列。
本实施例,通过对待处理图像中各像素点的亮度分量数据进行分析,提取水印信息,由于在图像亮度这个通道嵌入的水印信息具有较强的鲁棒性,因此,提取的水印信息的准确也较高。此外,通过同步块指示水印信息在待处理图像中的起始位置和结束位置,保证提取水印信息时,能够快速、准确地定位像素范围,有利于提高水印信息提取效率。
在一个具体的实施例中,假设一张包含有水印信息且经过社交软件传输后的图像S,图像S为文档图像,且为RGB格式,其中,C、H、W分别表示图像S的通道数量、长度以及宽度。现在需要图像S中提取32位比特序列(比特位序列的长度可以预先指定)。提取水印信息的流程可以如图7A所示,主要包括以下步骤:
步骤b1、通过RGB与YCbCr之间的转换矩阵,将图像S由RGB格式转换YCbCr格式,即得到S=YCbCr(S)。
若图像S非RGB格式,则还需要先将图像S转换为RGB格式。例如,图像S为单通道的png图像,则先将单通道png图像转换为RGB格式的图像。
步骤b2、获取到图像S中各像素点在Y通道以及Cb通道的数据,即得到Sy和SCb
步骤b3、对SCb进行二值化操作。
其中,二值化可以通过公式表示如下:
其中,i和j分别表示当前像素点的坐标。对SCb进行二值化时,设置分量值区间为(m1,m2)是考虑到嵌入水印信息的原始图像可能会经过传输,相应的Cb通道的值会发生改变,因此通过分量值区间进行二值化,较为准确。需要说明的是,分量值区间的大小可由用户设定,也可以根据历史的测试数据统计得到,不同类型的图像对应的分量值区间(m1,m2)可以不同。
例如,针对图像S,(m1,m2)=(70,90)。
步骤b4、得到二值化的SCb后,进行逐行遍历,确定同步块的位置,从而确定嵌入水印信息的起始位置L和结束位置R。其中,起始位置L和结束位置R分别为相应同步块的中心位置。
步骤b5、根据起始位置L、结束位置R和比特序列的长度32得到承载水印信息的相邻两个目标像素点之间的距离d和点邻域nb。
可通过如下公式计算得到距离d和点邻域nb:
在公式(3)中,int()表示取整函数,可以为向下取整函数,也可以为向上取整函数。且计算点邻域nb时常数z1和z2的取值可以根据需求设定,例如,z1=1,z2=0,当然也可以为其他值。
步骤b6、对Sy进行二值化操作。
其中,二值化可以通过公式表示如下:
其中,公式(4)中i和j分别表示当前像素点的坐标。对Sy进行二值化时,设置分量值区间为(t1,t2)是考虑到嵌入水印信息的原始图像可能会经过传输,相应的Y通道的分量值会发生改变,因此通过分量值区间进行二值化,较为准确。需要说明的是,分量值区间的大小可由用户设定,也可以根据历史的测试数据统计得到,不同类型的图像对应的 分量值区间(t1,t2)可以不同。例如,针对图像S,(t1,t2)=(100,250)。
步骤b7、提取水印信息得到多个候选比特位序列。
对二值化后的Sy进行行投影得到每一行的像素和。若某一行的像素和满足预设像素和区间(10,32),则确定该行是嵌入了水印信息的行。并从确定的嵌入了水印信息的行中提取32位的水印信息。
假设,存在水印信息的行号为k,则对该行进行遍历,起始位置为L,在(L-nb,L+nb)的像素范围内,若存在二值化的像素值Sy为1的像素点,则该位置所嵌入的水印信息为0,反之则为1。提取到一位水印信息之后,向后跳跃d个像素点得到一个新的中心位置,在该中心位置对应的像素范围内继续进行遍历提取一位水印信息,直至达到结束位置R,提取到32位的比特位序列,即32位的水印信息。
在一像素范围内遍历时,若能够确定目标像素点的位置,则以目标像素点为参考位置向后跳跃确定下一个中心位置,若无法确定目标像素点在像素范围内的准确位置,则以当前的中心位置为参考位置向后跳跃确定下一个中心位置。示例性地,参照图7B所示,以起始位置L为第一个中心位置进行遍历时,若在(L-nb,L+nb)的像素范围内遍历到二值化的像素值Sy为1的像素点,则以二值化的像素值Sy为1的像素点为参考位置向后跳跃d个像素点;若未遍历到二值化的像素值Sy为1的像素点,则以L为参考位置向后跳跃d个像素点,以此类推,直至到达结束位置R。
通过对所有存在水印信息的行进行遍历,可以得到多个32位水印信息。
步骤b8、对多个候选比特位序列进行投票得到最终与图像S匹配的水印信息对应的比特位序列作为最终结果输出。
通过图7A所示的可以准确并快速地提取到图像S中的水印信息。
采用图1至图7B所示实施例进行水印信息嵌入以及提取,并通过1000张文档类图像进行鲁棒性以及安全性测试。其中,1000张图像为带有文字且背景色为白色的图像,分别带有不同大小的字体密度,且图像大小均为640*640。
情形1、在这些图像中嵌入32位的水印信息并经过社交软件传输压缩,测试结果如表1所示:
表1

其中,平均ACC(按位)表示每张图像中的水印信息提取正确的比特位数与总位数的比值ACC(按图)表示能正确提取32位水印信息的图像的数量与总数量的比值。
情形2、在这些图像中嵌入32位的水印信息,并采用双线性差值对图像按照随机的缩放因子(0.8,1.5)进行缩放,再将缩放后的图像进行过社交软件传输,测试结果如下表2所示:
表2
平均ACC(按位)和平均ACC(按图)的含义与情形1中的解释相同,此处不再赘述。
情形3、在这些图像中嵌入32位的水印信息,并采用双线性差值对图像进行JPEG压缩,压缩因子设为60,对压缩后的图像进行测试,测试结果如下表3所示:
表3
平均ACC(按位)和平均ACC(按图)的含义与情形1中的解释相同,此处不再赘述。
结合上述情形1至情形3所示的测试数据,采用本公开提供的图像水印处理方法嵌入水印信息,能够保证水印信息具有较强的鲁棒性和安全性,能够解决网络传输、缩放、压缩等操作对于水印信息的影响,保证图像中水印信息的安全性。
图8为本公开一些实施例提供的图像水印处理装置的结构示意图。请参阅图8所示,本实施例提供的图像水印装置800包括:
图像获取模块801,用于获取待处理图像,对所述待处理图像进行格式转换得到像素格式数据,所述像素格式数据包括亮度分量数据、蓝色色度分量数据、红色色度分量数据。
水印信息获取模块802,用于获取水印信息,将所述水印信息转换为比特位序列。
水印处理模块803,用于基于所述比特位序列中各比特位的值修改所述待处理图像中各目标像素点的亮度分量数据得到目标亮度分量数据;其中,所述目标像素点用于承载所 述比特位序列中相应比特位的值,且所述目标像素点满足阵列分布。
数据合并模块804,用于将所述目标亮度分量数据和所述待处理图像对应的蓝色色度分量数据、红色色度分量数据进行合并得到目标图像,所述目标图像为所述待处理图像对应的添加水印信息的图像。
在一些实施例中,水印处理模块803,具体用于对所述待处理图像进行分块处理得到多个像素块;确定所述比特位序列中与各所述像素块分别对应的比特位;基于与各所述像素块相对应的所述比特位上的值修改各所述像素块中指定位置的目标像素点的亮度分量数据。
在一些实施例中,水印处理模块803,具体用于:若所述像素块对应的比特位上的值为1,则所述像素块中指定位置的目标像素点的亮度分量数据不变;若所述像素块对应的比特位上的值为0,则将所述像素块中指定位置的目标像素点的亮度分量数据修改为第一预设值。
在一些实施例中,还包括:同步块处理模块805,用于向所述待处理图像中嵌入同步块,所述同步块用于指示所述水印信息的起始位置或结束位置。
在一些实施例中,同步块处理模块805,具体用于基于所述水印信息的起始位置或结束位置确定相应同步块在所述待处理图像中的位置;修改所述同步块对应的位置的各像素点对应的蓝色色度分量数据/红色色度分量数据为第二预设值,以在所述待处理图像中嵌入所述同步块。
图像获取模块801,具体用于对RGB格式的待处理图像进行格式转换得到YCbCr格式的像素格式数据。
本实施例提供的装置可以用于执行前述任一实施例提供的图像水印处理方法,以在图像中嵌入水印信息,其实现方式以及技术原理类似,可参照前述方法实施例的详细描述,简明起见,此处不再赘述。
图9为本公开一些实施例提供的图像水印处理装置的结构示意图。请参阅图9所示,本实施例提供的图像水印装置900包括:
图像获取模块901,用于获取待处理图像,对所述待处理图像格式转换得到所述待处理图像的亮度分量数据;其中,所述待处理图像包含承载有水印信息的目标像素点,所述目标像素点的亮度分量数据是根据所述水印信息对应的比特位序列中相匹配的比特位的值确定的;所述目标像素点在所述待处理图像中呈阵列分布。
水印信息提取模块902,用于基于所述待处理图像中各像素点的亮度分量数据确定所述目标像素点;以及,基于所述目标像素点的亮度分量数据以及所述目标像素点在所述待处理图像中的位置得到所述水印信息对应的比特位序列。
在一些实施例中,水印信息提取模块902,具体用于基于所述目标像素点的亮度分量数据是否属于第一分量值区间确定所述目标像素点对应的比特位的值;基于所述目标像素点在所述待处理图像中的位置确定所述目标像素点对应的比特位在所述比特位序列中的位置;基于各所述目标像素点对应的比特位在所述比特位序列中的位置,将各所述目标像素点对应的比特位的值进行排列得到所述水印信息对应的比特位序列。
在一些实施例中,水印信息提取模块902,具体用于确定所述待处理图像中包含的同步块,并根据所述同步块的位置确定所述水印信息的起始位置和结束位置;基于所述比特位序列的长度以及所述起始位置和所述结束位置之间的距离,确定相邻所述目标像素点之间的间隔和点邻域;以所述起始位置对应的像素点为中心位置遍历相应点邻域内的各像素点以确定所述目标像素点;基于所述间隔更新所述中心位置并遍历在相应点邻域内各像素点以确定下一个所述目标像素点,重复执行直至到达所述结束位置,确定所述目标像素点。
在一些实施例中,水印信息提取模块902,具体用于遍历所述待处理图像的蓝色色度分量数据或红色色度分量数据,确定蓝色色度分量数据或红色色度分量数据满足第二分量值区间的像素块为同步块。
在一些实施例中,水印信息提取模块902,具体用于基于所述目标像素点的亮度分量数据以及所述目标像素点在所述待处理图像中的位置得到多个候选比特位序列;对所述多个候选比特位序列进行统计分析确定所述水印信息对应的比特位序列。
本实施例提供的装置可以用于执行前述任一实施例提供的图像水印处理方法,以提取图像中的水印信息,其实现方式以及技术原理类似,可参照前述方法实施例的详细描述,简明起见,此处不再赘述。
值得注意的是,上述图像水印处理装置800和900的实施例中,所包括的各个模块只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能模块的具体名称也只是为了便于相互区分,并不用于限制本公开的保护范围。图像水印处理装置800和900可以采用软件和/或硬件来实现。具体来说,文本图像水印处理装置800和900的各个模块可以被实现为在一个或多个通用处理器上执行的软件组件,也可以被实现为诸如用于执行某些功能的硬件,诸如可编程逻辑器件和/或专用集成电路。 在一些实施例中,这些模块可以体现为软件产品的形式,该软件产品可以存储在非易失性存储介质中。这些非易失性存储介质中包括使得计算机设备(例如个人计算机、服务器、网络设备、移动终端等)执行本公开实施例中描述的方法。在一些实施例中,上述模块还可以在单个设备上实现,也可以分布在多个设备上。这些模块的功能可以相互合并,也可以进一步拆分为多个子模块。
示例性地,本公开提供一种电子设备,包括:一个或多个处理器;存储器;以及一个或多个计算机程序;其中一个或多个计算机程序被存储在存储器中;一个或多个处理器在执行一个或多个计算机程序时,使得电子设备实现前文实施例的图像水印处理方法。
示例性地,本公开提供一种芯片系统,芯片系统应用于包括存储器和传感器的电子设备;芯片系统包括:处理器;当处理器执行前文实施例的图像水印处理方法。
示例性地,本公开提供一种计算机可读存储介质,其上存储有计算机程序,计算机程序被处理器使得电子设备执行时实现前文实施例的图像水印处理方法。
示例性地,本公开提供一种计算机程序产品,当计算机程序产品中的计算机程序在计算机上运行时,使得计算机执行前文实施例的图像水印处理方法。
需要说明的是,在本文中,诸如“第一”和“第二”等之类的关系术语仅仅用来将一个实体或者操作与另一个实体或操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括所述要素的过程、方法、物品或者设备中还存在另外的相同要素。
以上所述仅是本公开的具体实施方式,使本领域技术人员能够理解或实现本公开。对这些实施例的多种修改对本领域的技术人员来说将是显而易见的,本文中所定义的一般原理可以在不脱离本公开的精神或范围的情况下,在其它实施例中实现。因此,本公开将不会被限制于本文所述的这些实施例,而是要符合与本文所公开的原理和新颖特点相一致的最宽的范围。

Claims (16)

  1. 一种图像水印处理方法,包括:
    获取待处理图像,对所述待处理图像进行格式转换得到像素格式数据,所述像素格式数据包括亮度分量数据、蓝色色度分量数据、红色色度分量数据;
    获取水印信息,将所述水印信息转换为比特位序列;
    基于所述比特位序列中各比特位的值修改所述待处理图像中各目标像素点的亮度分量数据得到目标亮度分量数据;其中,所述目标像素点用于承载所述比特位序列中相应比特位的值,且所述目标像素点满足阵列分布;以及
    将所述目标亮度分量数据和所述待处理图像对应的蓝色色度分量数据、红色色度分量数据进行合并得到目标图像,所述目标图像为所述待处理图像对应的添加所述水印信息的图像。
  2. 根据权利要求1所述的方法,其中,所述基于所述比特位序列中各比特位的值修改所述待处理图像中各目标像素点的亮度分量数据得到目标亮度分量数据,包括:
    对所述待处理图像进行分块处理得到多个像素块;
    确定所述比特位序列中与各所述像素块分别对应的比特位;以及
    基于与各所述像素块相对应的所述比特位的值修改各所述像素块中指定位置的目标像素点的亮度分量数据。
  3. 根据权利要求2所述的方法,其中,所述基于与各所述像素块相对应的所述比特位上的值修改各所述像素块中指定位置的目标像素点的亮度分量数据,包括:
    若所述像素块对应的比特位上的值为1,则所述像素块中指定位置的目标像素点的亮度分量数据不变;
    若所述像素块对应的比特位上的值为0,则将所述像素块中指定位置的目标像素点的亮度分量数据修改为第一预设值。
  4. 根据权利要求1至3任一项所述的方法,其中,所述将所述目标亮度分量数据、所述待处理图像对应的蓝色色度分量数据、红色色度分量数据进行合并得到所述目标图像之前,还包括:
    向所述待处理图像中嵌入同步块,所述同步块用于指示所述水印信息的起始位置或结束位置。
  5. 根据权利要求4所述的方法,其中,所述向所述待处理图像中嵌入同步块,包括:
    基于所述水印信息的起始位置或结束位置确定相应同步块在所述待处理图像中的位置;以及
    修改所述同步块对应的位置的各像素点对应的蓝色色度分量数据或红色色度分量数据为第二预设值,以在所述待处理图像中嵌入所述同步块。
  6. 根据权利要求1至5中任一项所述的方法,其中,所述对所述待处理图像进行格式转换得到像素格式数据,包括:
    对RGB格式的待处理图像进行格式转换得到YCbCr格式的像素格式数据。
  7. 一种图像水印处理方法,包括:
    获取待处理图像,对所述待处理图像格式转换得到所述待处理图像的亮度分量数据;其中,所述待处理图像包含承载有水印信息的目标像素点,所述目标像素点的亮度分量数据是根据所述水印信息对应的比特位序列中相匹配的比特位的值确定的;所述目标像素点在所述待处理图像中呈阵列分布;
    基于所述待处理图像中各像素点的亮度分量数据确定所述目标像素点;以及
    基于所述目标像素点的亮度分量数据以及所述目标像素点在所述待处理图像中的位置得到所述水印信息对应的比特位序列。
  8. 根据权利要求7所述的方法,其中,所述基于所述目标像素点的亮度分量数据以及所述目标像素点在所述待处理图像中的位置得到所述水印信息对应的比特位序列,包括:
    基于所述目标像素点的亮度分量数据是否属于第一分量值区间确定所述目标像素点对应的比特位的值;
    基于所述目标像素点在所述待处理图像中的位置确定所述目标像素点对应的比特位在所述比特位序列中的位置;以及
    基于各所述目标像素点对应的比特位在所述比特位序列中的位置,将各所述目标像素点对应的比特位的值进行排列得到所述水印信息对应的比特位序列。
  9. 根据权利要求7所述的方法,其中,所述基于所述待处理图像中各像素点的亮度分量数据确定所述目标像素点,包括:
    确定所述待处理图像中包含的同步块,并根据所述同步块的位置确定所述水印信息的起始位置和结束位置;
    基于所述比特位序列的长度以及所述起始位置和所述结束位置之间的距离,确定相邻 所述目标像素点之间的间隔和点邻域;
    以所述起始位置对应的像素点为中心位置遍历相应点邻域内各像素点以确定所述目标像素点;基于所述间隔更新所述中心位置并遍历在相应点邻域内的各像素点以确定下一个所述目标像素点,重复执行直至到达所述结束位置,确定所述目标像素点。
  10. 根据权利要求9所述的方法,其中,所述确定所述待处理图像中包含的同步块,包括:
    遍历所述待处理图像的蓝色色度分量数据或红色色度分量数据,确定蓝色色度分量数据或红色色度分量数据满足第二分量值区间的像素块为同步块。
  11. 根据权利要求7所述的方法,其中,所述基于所述目标像素点的亮度分量数据以及所述目标像素点在所述待处理图像中的位置得到所述水印信息对应的比特位序列,包括:
    基于所述目标像素点的亮度分量数据以及所述目标像素点在所述待处理图像中的位置得到多个候选比特位序列;以及
    对所述多个候选比特位序列进行统计分析确定所述水印信息对应的比特位序列。
  12. 一种图像水印处理装置,包括:
    图像获取模块,用于获取待处理图像,对所述待处理图像进行格式转换得到像素格式数据,所述像素格式数据包括亮度分量数据、蓝色色度分量数据、红色色度分量数据;
    水印信息获取模块,用于获取水印信息,将所述水印信息转换为比特位序列;
    水印处理模块,用于基于所述比特位序列中各比特位的值修改所述待处理图像中各目标像素点的亮度分量数据得到目标亮度分量数据;其中,所述目标像素点用于承载所述比特位序列中相应比特位的值,且所述目标像素点满足阵列分布;
    数据合并模块,用于将所述目标亮度分量数据和所述待处理图像对应的蓝色色度分量数据、红色色度分量数据进行合并得到目标图像,所述目标图像为所述待处理图像对应的添加所述水印信息的图像。
  13. 一种图像水印处理装置,包括:
    图像获取模块,用于获取待处理图像,对所述待处理图像格式转换得到所述待处理图像的亮度分量数据;其中,所述待处理图像包含承载水印信息的目标像素点,所述目标像素点的亮度分量数据是根据所述水印信息对应的比特位序列中相匹配的比特位的值确定的;所述目标像素点在所述待处理图像中呈阵列分布;
    水印信息提取模块,用于基于所述待处理图像中各像素点的亮度分量数据确定所述目 标像素点;以及,基于所述目标像素点的亮度分量数据以及所述目标像素点在所述待处理图像中的位置得到所述水印信息对应的比特位序列。
  14. 一种电子设备,包括:存储器和处理器;
    所述存储器被配置为存储计算机程序指令;
    所述处理器被配置为执行所述计算机程序指令,使得所述电子设备实现如权利要求1至11任一项所述的图像水印处理方法。
  15. 一种可读存储介质,包括:计算机程序指令;
    电子设备的至少一个处理器执行所述计算机程序指令,使得所述电子设备实现如权利要求1至11任一项所述的图像水印处理方法。
  16. 一种计算机程序产品,电子设备运行所述计算机程序产品中的计算机程序,使得所述电子设备实现如权利要求1至11任一项所述的图像水印处理方法。
PCT/CN2023/115299 2022-10-24 2023-08-28 图像水印处理方法及装置 WO2024087864A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211305240.3A CN117974408A (zh) 2022-10-24 2022-10-24 图像水印处理方法及装置
CN202211305240.3 2022-10-24

Publications (1)

Publication Number Publication Date
WO2024087864A1 true WO2024087864A1 (zh) 2024-05-02

Family

ID=90829913

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/115299 WO2024087864A1 (zh) 2022-10-24 2023-08-28 图像水印处理方法及装置

Country Status (2)

Country Link
CN (1) CN117974408A (zh)
WO (1) WO2024087864A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20030094498A (ko) * 2002-06-04 2003-12-12 주식회사 마크애니 비트블록의 위치정보를 이용하는 워터마크 삽입 및 검출방법
JP2008067233A (ja) * 2006-09-08 2008-03-21 C4 Technology Inc 電子透かし埋め込み方法、プログラムおよびコンピュータ読み取り可能な記録媒体
US20130259294A1 (en) * 2012-03-27 2013-10-03 Infosys Limited Method, system, and computer-readable medium for embedding and extracting a watermark in a video
WO2020244474A1 (zh) * 2019-06-03 2020-12-10 中兴通讯股份有限公司 视频水印添加、提取的方法、装置和设备
US20200404309A1 (en) * 2018-09-30 2020-12-24 Beijing Microlive Vision Technology Co., Ltd Video watermark adding method and apparatus, and electronic device and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20030094498A (ko) * 2002-06-04 2003-12-12 주식회사 마크애니 비트블록의 위치정보를 이용하는 워터마크 삽입 및 검출방법
JP2008067233A (ja) * 2006-09-08 2008-03-21 C4 Technology Inc 電子透かし埋め込み方法、プログラムおよびコンピュータ読み取り可能な記録媒体
US20130259294A1 (en) * 2012-03-27 2013-10-03 Infosys Limited Method, system, and computer-readable medium for embedding and extracting a watermark in a video
US20200404309A1 (en) * 2018-09-30 2020-12-24 Beijing Microlive Vision Technology Co., Ltd Video watermark adding method and apparatus, and electronic device and storage medium
WO2020244474A1 (zh) * 2019-06-03 2020-12-10 中兴通讯股份有限公司 视频水印添加、提取的方法、装置和设备

Also Published As

Publication number Publication date
CN117974408A (zh) 2024-05-03

Similar Documents

Publication Publication Date Title
JP4557866B2 (ja) 混合コード、及び、混合コードの生成方法と装置、記録媒体
EP3410685B1 (en) Image processing device, image processing method, and program
Murali et al. Comparision and analysis of photo image forgery detection techniques
US10332262B2 (en) Removal of background information from digital images
CN108921266B (zh) 一种基于图像分割的静态二维码加密显示方法及装置
US9305603B2 (en) Method and apparatus for indexing a video stream
US9813762B2 (en) Creating hash values indicative of differences in images
WO2024087864A1 (zh) 图像水印处理方法及装置
CN107392833A (zh) 一种基于智能设备的图片水印的添加方法及添加装置
CN115410191B (zh) 文本图像识别方法、装置、设备和存储介质
US20080310715A1 (en) Applying a segmentation engine to different mappings of a digital image
CN117011114A (zh) 虚拟桌面的水印嵌入方法、装置、电子设备及存储介质
US7907747B2 (en) Device, method, and recording medium for embedding/detecting a digital watermark
US20050134601A1 (en) Method and system to combine a digital graphics object and a digital picture
US6480622B1 (en) Image processing method for eliminating color shifts generated in contour region in image obtained from image input apparatus
CN112581403A (zh) 一种鱼眼图像校正方法、系统及介质
CN111127288A (zh) 可逆图像水印处理方法、装置及计算机可读存储介质
US20180048817A1 (en) Systems and methods for reduced power consumption via multi-stage static region detection
CN114820547B (zh) 车道线检测方法、装置、计算机设备、存储介质
CN117095418B (zh) 基于图片像素差异的表格对比方法及装置
CN112861960B (zh) 一种图像篡改检测方法、系统及存储介质
US20230388437A1 (en) Color enhancement method, image-forming apparatus, and storage medium
WO2024040474A1 (zh) 加密图像水印处理方法及装置、显示设备
CN110826033B (zh) 水印嵌入和水印提取方法、装置及设备和数据处理方法
CN112884631A (zh) 水印处理方法、装置、设备及存储介质