A watermark adding method and device

Through the method of word-for-word encoding and pixel color difference representation, the problem of lack of concealment and low anti-interference performance of existing watermark adding methods is solved, and a watermark effect with high concealment and high anti-interference performance is achieved.

CN113822783BActive Publication Date: 2024-10-18BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010612941.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-30
Publication Date
2024-10-18
Estimated Expiration
2040-06-30

AI Technical Summary

Technical Problem

Existing watermark adding methods lack concealment, have low anti-interference performance, and plain text watermarks are easily recognized by the human eye.

Method used

An information code with a preset number of digits is generated by encoding the watermark information word by word, and the 0 and 1 of the binary code are represented on the color difference between the reference pixels and the comparison pixels of the picture, and the watermark processing is performed to generate a picture containing the watermark information.

Benefits of technology

It provides a watermark with high concealment and high anti-interference, which is difficult to be recognized by the human eye, but the computer can recover the watermark information, and the pixel distortion is only at the watermark position, so the impact is small.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113822783B_ABST
    Figure CN113822783B_ABST
Patent Text Reader

Abstract

The present invention discloses a watermark adding method and device, and relates to the field of computer technology. A specific implementation of the method includes obtaining watermark information, encoding the watermark information word by word to obtain an information code of a preset number of bits; adding a preset start code to the head of the information code, and adding a preset stop code to the tail of the information code, thereby generating a target binary code; based on the target binary code, performing watermark processing on the received picture to obtain a picture containing the watermark information. Therefore, the implementation of the present invention can solve the problem that the existing watermark adding method lacks concealment and has low anti-interference performance.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a watermark adding method and device. Background Art

[0002] Today's society has entered the information age and the digital age. The collection, processing and display of data have great commercial value. Along with the commercial value comes new requirements for the protection of data confidentiality and ownership.

[0003] Currently, for data display interfaces with commercial value and confidentiality, watermarks are commonly added to mobile phone pictures to prevent the random spread of information and trace the source of information leakage. The watermarking method is to generate a corresponding plaintext pattern through a series of information that can identify a specific user, including but not limited to user name, user ID, account number, etc., and then superimpose it on the actual picture to generate a new picture with a watermark by synthesizing a new layer.

[0004] In the process of implementing the present invention, the inventors found that there are at least the following problems in the prior art:

[0005] The watermark added in the prior art is added in plain text, and in order to obtain clear watermark information from the image, it is generally conspicuous, extremely lacking in concealment, and has low anti-interference performance. In addition, because the watermark is added in plain text, the human eye can easily distinguish the size, position, and information contained in the watermark. Summary of the invention

[0006] In view of this, an embodiment of the present invention provides a watermark adding method and device, which can solve the problems of lack of concealment and low anti-interference performance of the existing watermark adding method.

[0007] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present invention, a watermark adding method is provided, comprising obtaining watermark information, encoding the watermark information word by word to obtain an information code of a preset number of bits; adding a preset start code to the head of the information code, and adding a preset end code to the tail of the information code, thereby generating a target binary code; based on the target binary code, performing watermark processing on the received image to obtain an image containing the watermark information.

[0008] Optionally, encoding the watermark information word by word includes:

[0009] The watermark information is encoded word by word using Unicode encoding.

[0010] Optionally, based on the target binary code, performing watermark processing on the received picture to obtain a picture containing watermark information includes:

[0011] Selecting corresponding reference pixels in the image in sequence according to the number of bits of the target binary code to obtain the coordinates and color value of each reference pixel;

[0012] Based on the coordinates of each reference pixel, a corresponding comparison pixel is selected to obtain a color value of the comparison pixel;

[0013] According to the value of the corresponding bit in the target binary code, the color value of each comparison pixel is adjusted to complete the watermark processing of the image.

[0014] Optionally, adjusting the color value of each compared pixel point according to the value of the corresponding bit in the target binary code includes:

[0015] If the value of the corresponding bit in the target binary code is 1, determine whether the color value of the corresponding reference pixel is less than the color value of the comparison pixel. If so, do not adjust the color value of the comparison pixel. Otherwise, adjust the color value of the comparison pixel so that the color value of the reference pixel is less than the color value of the comparison pixel.

[0016] If the value of the corresponding bit in the target binary code is 0, determine whether the color value of the corresponding reference pixel is greater than or equal to the color value of the comparison pixel. If so, do not adjust the color value of the comparison pixel. Otherwise, adjust the color value of the comparison pixel so that the color value of the reference pixel is greater than or equal to the color value of the comparison pixel.

[0017] Optionally, obtaining the color value of a reference pixel includes:

[0018] Selecting a color value of one of the three colors of the reference pixel as the color value of the reference pixel; and

[0019] Get the color value of the contrast pixel, including:

[0020] A color value corresponding to the color type of the reference pixel is selected as the color value of the comparison pixel.

[0021] Optionally, based on the coordinates of each reference pixel point, a corresponding comparison pixel point is selected, including:

[0022] According to the coordinates of the reference pixel point, a corresponding comparison pixel point is selected in the same column and adjacent row of the coordinates.

[0023] Optionally, adjust the color value of each contrast pixel, including:

[0024] The color value of the comparison pixel is adjusted so that the color value of the reference pixel differs from the color value of the comparison pixel by a preset number of numerical scales.

[0025] In addition, the present invention also provides a watermark adding device, comprising an acquisition module, for acquiring watermark information, encoding the watermark information word by word to obtain an information code of a preset number of bits;

[0026] The processing module is used to add a preset start code to the head of the information code and add a preset stop code to the tail of the information code, thereby generating a target binary code; based on the target binary code, the received picture is watermarked to obtain a picture containing watermark information.

[0027] An embodiment of the above invention has the following advantages or beneficial effects: the present invention does not generate a watermark pattern first, but only extracts and saves the watermark information first, then encodes the watermark information into a binary representation, and uses the color difference between the reference pixel and the comparison pixel to represent the 0 and 1 of the binary code, thereby providing a watermark with high concealment and high anti-interference.

[0028] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific implementation examples. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The accompanying drawings are used to better understand the present invention and do not constitute an improper limitation of the present invention.

[0030] Figure 1 is a schematic diagram of the main process of a watermark adding method according to an embodiment of the present invention;

[0031] Figure 2 is a schematic diagram of the main process of a watermark adding method according to another embodiment of the present invention;

[0032] Figure 3 is a schematic diagram of main modules of a watermark adding device according to an embodiment of the present invention;

[0033] Figure 4 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0034] Figure 5 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0035] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0036] Figure 1 FIG. 1 is a schematic diagram of the main process of a watermark adding method according to an embodiment of the present invention. Figure 1 As shown, the watermark adding method includes:

[0037] Step S101, obtaining watermark information, and encoding the watermark information word by word to obtain an information code with a preset number of bits.

[0038] In some embodiments, the watermark information is encoded word by word using Unicode encoding to obtain a binary code of a certain number of bits, which includes all the watermark information, for example, the binary code is "10110101". Unicode, also known as the unified code or the universal code, is an industry standard in the field of computer science.

[0039] Step S102, adding a preset start code to the head of the information code, and adding a preset end code to the tail of the information code, thereby generating a target binary code.

[0040] For example, adding the start code 0011 and the end code 1100 obtains the target binary code (0011101101011100).

[0041] It is worth noting that the start code and the end code can be any form of information, and any form of information can be converted into binary information before use. For example, the start code and the end code can be a piece of text.

[0042] Step S103: Based on the target binary code, watermark processing is performed on the received image to obtain an image containing watermark information.

[0043] In some embodiments, based on the target binary code, watermarking is performed on the received picture to obtain a picture containing watermark information, including:

[0044] According to the number of bits of the target binary code, corresponding reference pixels are selected in the image in turn to obtain the coordinates and color value of each reference pixel; based on the coordinates of each reference pixel, corresponding comparison pixels are selected to obtain the color value of the comparison pixel; according to the value of the corresponding bit in the target binary code, the color value of each comparison pixel is adjusted to complete the watermark processing of the image.

[0045] In a preferred embodiment, the color value of one of the three colors of the reference pixel is selected as the color value of the reference pixel, and the color value corresponding to the color type of the reference pixel is selected as the color value of the comparison pixel. The pictures are composed of pixels, and each pixel has its own coordinates. For example, the coordinates of the first pixel in the upper left corner of the picture are (0,0), then the coordinates of the next pixel to its right are (0,1), and the coordinates of the next pixel below it are (1,0). Each pixel has its own color value. If expressed in RGB color representation, the color of each pixel can be decomposed into three values, red (R), green (G), and blue (B). The value range of each value is generally 0 to 255 in the computer.

[0046] In addition, preferably, when selecting the corresponding comparison pixel point based on the coordinates of each reference pixel point, the corresponding comparison pixel point is selected in the same column and adjacent row of the coordinate according to the coordinate of the reference pixel point. For example: for an image consisting of 10 rows and 10 columns with a total of 100 pixels, ten pixels in the 5th row are selected as reference points, and ten pixels in the 4th row or the 6th row are selected as comparison pixels.

[0047] For example: select the first reference pixel on the image (e.g., the pixel with coordinates (0,0)), and get the color value of red (R) among the three colors of this pixel after selecting the reference pixel. Then select a pixel below the first reference pixel (e.g., the pixel with coordinates (2,0)) as the first comparison pixel, and also select the color value representing red (R) among the comparison pixels. If there is only a small difference in the red color value between the two pixel colors, then the color difference seen by the human eye is relatively small, and the color difference seen by the human eye for other colors will be larger.

[0048] In a further embodiment, adjusting the color value of each comparison pixel point according to the value of the corresponding bit in the target binary code includes:

[0049] If the value of the corresponding bit in the target binary code is 1, determine whether the color value of the corresponding reference pixel is smaller than the color value of the comparison pixel. If so, do not adjust the color value of the comparison pixel. Otherwise, adjust the color value of the comparison pixel so that the color value of the reference pixel is smaller than the color value of the comparison pixel (for example, modify the value representing red (R) in the first comparison pixel).

[0050] If the value of the corresponding bit in the target binary code is 0, determine whether the color value of the corresponding reference pixel is greater than or equal to the color value of the comparison pixel. If so, do not adjust the color value of the comparison pixel. Otherwise, adjust the color value of the comparison pixel so that the color value of the reference pixel is greater than or equal to the color value of the comparison pixel.

[0051] It is worth noting that by adjusting the color value of each comparison pixel, the color value of the comparison pixel can be adjusted so that the color value of the reference pixel differs from the color value of the comparison pixel by a preset number of numerical scales. Preferably, the difference of 2 to 3 numerical scales is used as a standard to ensure that the color difference between the modified comparison pixel and the reference pixel is small. For example: the RGB of the reference pixel is expressed as (100, 100, 100), and the RGB of the comparison pixel is expressed as (98, 100, 100).

[0052] In summary, the present invention creatively proposes a new watermark adding method, that is, the watermark pattern is not generated first, but the watermark information is extracted and saved first, and then the watermark information is encoded into a binary representation, and the color difference between the reference pixel and the comparison pixel is used to represent the 0 and 1 of the binary code, thereby providing a watermark with high concealment and high anti-interference, which is difficult to be recognized by the human eye, but the computer can scan all the reference pixels and comparison pixels on the picture to restore the target binary code and obtain the watermark information. In addition, the pixel distortion of the present invention only occurs at the watermark position, which only occupies a small part of the entire picture, and the difference between the modified comparison pixel and the reference pixel value is small, and the color difference of the pixel is also small, which is difficult for the human eye to distinguish, so it does not affect the use of the overall picture and the expression of information.

[0053] Figure 2 is a schematic diagram of the main process of a watermark adding method according to another embodiment of the present invention. The watermark adding method may include:

[0054] Step S201, obtaining watermark information, and encoding the watermark information word by word to obtain an information code with a preset number of bits.

[0055] Step S202, adding a preset start code to the head of the information code, and adding a preset end code to the tail of the information code, thereby generating a target binary code.

[0056] Step S203 , selecting corresponding reference pixel points in the image in sequence according to the number of bits of the target binary code, so as to obtain the coordinates and color value of each reference pixel point.

[0057] Step S204: based on the coordinates of each reference pixel, select a corresponding comparison pixel to obtain a color value of the comparison pixel.

[0058] Step S205, determining whether the value of the corresponding bit in the target binary code is 1, if so, proceeding to step S206, otherwise, proceeding to step S207.

[0059] Step S206, determining whether the color value of the corresponding reference pixel is less than the color value of the comparison pixel, if so, proceeding to step S208, otherwise, proceeding to step S209.

[0060] Step S207, if the value of the corresponding bit in the target binary code is 0, determine whether the color value of the corresponding reference pixel is greater than or equal to the color value of the comparison pixel, if so, proceed to step S208, otherwise proceed to step S210.

[0061] Step S208: do not adjust the color value of the compared pixel, and proceed to step S211.

[0062] Step S209, adjust the color value of the comparison pixel so that the color value of the reference pixel differs from the color value of the comparison pixel by a preset number of numerical scales and the color value of the reference pixel is smaller than the color value of the comparison pixel, and proceed to step S211.

[0063] Step S210, adjust the color value of the comparison pixel point so that the color value of the reference pixel point differs from the color value of the comparison pixel point by a preset number of numerical scales and whether the color value of the reference pixel point is greater than or equal to the color value of the comparison pixel point, proceed to step S211.

[0064] Step S211, determining whether all corresponding bits of the target binary code have been traversed, if so, proceeding to step S212, otherwise returning to step S205.

[0065] Step S212, obtaining a picture containing watermark information.

[0066] Figure 3 Schematic diagram of main modules of a watermark adding device according to an embodiment of the present invention. Figure 3 As shown, the watermark adding device 300 includes an acquisition module 301 and a processing module 302. The acquisition module 301 acquires watermark information, and encodes the watermark information word by word to obtain an information code with a preset number of bits; the processing module 302 adds a preset start code to the head of the information code, and adds a preset stop code to the tail of the information code, thereby generating a target binary code; based on the target binary code, the received picture is watermarked to obtain a picture containing watermark information.

[0067] In some embodiments, the acquisition module 301 encodes the watermark information word by word, including:

[0068] The watermark information is encoded word by word using Unicode encoding.

[0069] In some embodiments, the processing module 302 performs watermark processing on the received picture based on the target binary code to obtain a picture containing watermark information, including:

[0070] Selecting corresponding reference pixels in the image in sequence according to the number of bits of the target binary code to obtain the coordinates and color value of each reference pixel;

[0071] Based on the coordinates of each reference pixel, a corresponding comparison pixel is selected to obtain a color value of the comparison pixel;

[0072] According to the value of the corresponding bit in the target binary code, the color value of each comparison pixel is adjusted to complete the watermark processing of the image.

[0073] In some embodiments, the processing module 302 adjusts the color value of each compared pixel according to the value of the corresponding bit in the target binary code, including:

[0074] If the value of the corresponding bit in the target binary code is 1, determine whether the color value of the corresponding reference pixel is less than the color value of the comparison pixel. If so, do not adjust the color value of the comparison pixel. Otherwise, adjust the color value of the comparison pixel so that the color value of the reference pixel is less than the color value of the comparison pixel.

[0075] If the value of the corresponding bit in the target binary code is 0, determine whether the color value of the corresponding reference pixel is greater than or equal to the color value of the comparison pixel. If so, do not adjust the color value of the comparison pixel. Otherwise, adjust the color value of the comparison pixel so that the color value of the reference pixel is greater than or equal to the color value of the comparison pixel.

[0076] In some embodiments, the processing module 302 obtains the color value of the reference pixel, including:

[0077] Selecting a color value of one of the three colors of the reference pixel as the color value of the reference pixel; and

[0078] Get the color value of the contrast pixel, including:

[0079] A color value corresponding to the color type of the reference pixel is selected as the color value of the comparison pixel.

[0080] In some embodiments, the processing module 302 selects a corresponding comparison pixel point based on the coordinates of each reference pixel point, including:

[0081] According to the coordinates of the reference pixel point, a corresponding comparison pixel point is selected in the same column and adjacent row of the coordinates.

[0082] In some embodiments, the processing module 302 adjusts the color value of each compared pixel, including:

[0083] The color value of the comparison pixel is adjusted so that the color value of the reference pixel differs from the color value of the comparison pixel by a preset number of numerical scales.

[0084] It should be noted that the watermark adding method and the watermark adding device of the present invention have a corresponding relationship in terms of specific implementation contents, so the repeated contents will not be described again.

[0085] Figure 4 An exemplary system architecture 400 is shown to which the watermark adding method or watermark adding apparatus, watermark adding determination or watermark adding determination apparatus according to the embodiments of the present invention can be applied.

[0086] like Figure 4 As shown, system architecture 400 may include terminal devices 401, 402, 403, network 404 and server 405. Network 404 is used to provide a medium for communication links between terminal devices 401, 402, 403 and server 405. Network 404 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0087] Users can use terminal devices 401, 402, 403 to interact with server 405 through network 404 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 401, 402, 403, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only as examples).

[0088] The terminal devices 401, 402, 403 may be various electronic devices having a watermark adding screen or a watermark adding identification screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0089] The server 405 may be a server that provides various services, such as a backend management server (only an example) that provides support for shopping websites browsed by users using the terminal devices 401, 402, and 403. The backend management server may analyze and process the received data such as product information query requests, and feed back the processing results (such as target push information, product information - only an example) to the terminal device.

[0090] It should be noted that the watermark adding method or watermark adding determination method provided in the embodiment of the present invention is generally executed by the server 405 , and accordingly, the computing device is generally arranged in the server 405 .

[0091] It should be understood that Figure 4 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to the implementation requirements.

[0092] Reference below Figure 5 , which shows a schematic diagram of the structure of a computer system 500 of a terminal device suitable for implementing an embodiment of the present invention. Figure 5 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0093] like Figure 5 As shown, the computer system 500 includes a central processing unit (CPU) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage part 508 into a random access memory (RAM) 503. In the RAM 503, various programs and data required for the operation of the computer system 500 are also stored. The CPU 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An input / output (I / O) interface 505 is also connected to the bus 504.

[0094] The following components are connected to the I / O interface 505: an input section 806 including a keyboard, a mouse, etc.; an output section 507 including a cathode ray tube (CRT), a liquid crystal watermark adder (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage section 508 as needed.

[0095] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the central processing unit (CPU) 501, the above-mentioned functions defined in the system of the present invention are executed.

[0096] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0097] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0098] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor. For example, it may be described as follows: a processor includes an acquisition module and a processing module. The names of these modules do not, in some cases, limit the modules themselves.

[0099] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device includes obtaining watermark information, encoding the watermark information word by word to obtain an information code of a preset number of bits; adding a preset start code to the head of the information code, and adding a preset stop code to the tail of the information code, thereby generating a target binary code; based on the target binary code, watermarking the received image to obtain an image containing the watermark information.

[0100] The technical solution according to the embodiment of the present invention can solve the problems of lack of concealment and low anti-interference performance of the existing watermark adding method.

[0101] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A watermark adding method, characterized in that: include: Acquire watermark information, and encode the watermark information word by word to obtain an information code with a preset number of bits; Adding a preset start code to the head of the information code and adding a preset stop code to the tail of the information code, thereby generating a target binary code; Based on the target binary code, a received image is watermarked to obtain an image containing watermark information, including: selecting corresponding reference pixels in the image in sequence according to the number of bits of the target binary code to obtain the coordinates and color value of each reference pixel; selecting corresponding comparison pixels based on the coordinates of each reference pixel to obtain the color value of the comparison pixel; adjusting the color value of each comparison pixel according to the value of the corresponding bit in the target binary code, thereby completing the watermarking of the image.

2. The method according to claim 1, characterized in that Encoding the watermark information word by word, comprising: The watermark information is encoded word by word using Unicode encoding.

3. The method according to claim 1, characterized in that According to the value of the corresponding bit in the target binary code, adjust the color value of each comparison pixel, including: If the value of the corresponding bit in the target binary code is 1, determine whether the color value of the corresponding reference pixel is less than the color value of the comparison pixel. If so, do not adjust the color value of the comparison pixel. Otherwise, adjust the color value of the comparison pixel so that the color value of the reference pixel is less than the color value of the comparison pixel. If the value of the corresponding bit in the target binary code is 0, determine whether the color value of the corresponding reference pixel is greater than or equal to the color value of the comparison pixel. If so, do not adjust the color value of the comparison pixel. Otherwise, adjust the color value of the comparison pixel so that the color value of the reference pixel is greater than or equal to the color value of the comparison pixel.

4. The method according to claim 1, characterized in that Get the color value of the reference pixel, including: Selecting a color value of one of the three colors of the reference pixel as the color value of the reference pixel; and Get the color value of the contrast pixel, including: A color value corresponding to the color type of the reference pixel is selected as the color value of the comparison pixel.

5. The method according to claim 1, characterized in that Based on the coordinates of each reference pixel, select the corresponding comparison pixel, including: According to the coordinates of the reference pixel point, a corresponding comparison pixel point is selected in the same column and adjacent row of the coordinates.

6. The method according to any one of claims 1 to 5, characterized in that: Adjust the color value of each contrast pixel, including: The color value of the comparison pixel is adjusted so that the color value of the reference pixel differs from the color value of the comparison pixel by a preset number of numerical scales.

7. A watermark adding device, characterized in that: include: An acquisition module, used for acquiring watermark information, and encoding the watermark information word by word to obtain an information code of a preset number of bits; A processing module, used for adding a preset start code to the head of the information code and adding a preset stop code to the tail of the information code, thereby generating a target binary code; Based on the target binary code, a received image is watermarked to obtain an image containing watermark information, including: selecting corresponding reference pixels in the image in sequence according to the number of bits of the target binary code to obtain the coordinates and color value of each reference pixel; selecting corresponding comparison pixels based on the coordinates of each reference pixel to obtain the color value of the comparison pixel; adjusting the color value of each comparison pixel according to the value of the corresponding bit in the target binary code, thereby completing the watermarking of the image.

8. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 6.

9. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Anti-counterfeiting method and system for coupon receiving interface screenshot, electronic equipment and medium

    CN110942322A