CN113487473A - Method and device for adding image watermark, electronic equipment and storage medium - Google Patents

Method and device for adding image watermark, electronic equipment and storage medium Download PDF

Info

Publication number
CN113487473A
CN113487473A CN202110887835.3A CN202110887835A CN113487473A CN 113487473 A CN113487473 A CN 113487473A CN 202110887835 A CN202110887835 A CN 202110887835A CN 113487473 A CN113487473 A CN 113487473A
Authority
CN
China
Prior art keywords
image
content
watermark
contour
mask
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN202110887835.3A
Other languages
Chinese (zh)
Other versions
CN113487473B (en
Inventor
徐�明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202110887835.3A priority Critical patent/CN113487473B/en
Publication of CN113487473A publication Critical patent/CN113487473A/en
Application granted granted Critical
Publication of CN113487473B publication Critical patent/CN113487473B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T1/00General purpose image data processing
    • G06T1/0021Image watermarking
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20172Image enhancement details
    • G06T2207/20192Edge enhancement; Edge preservation

Landscapes

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

Abstract

The disclosure provides a method and a device for adding an image watermark, electronic equipment and a storage medium, and relates to the field of image processing, in particular to the technical field of image watermarking. The specific implementation scheme is as follows: firstly, an image mask of a target image to be added with a watermark is obtained, the image mask comprises a content image outline of the target image, and then based on the image mask, the watermark image is covered in a region of a non-content outline pixel of the target image at a preset watermark image adding position. According to the method provided by the disclosure, the watermark image is added in the non-image outline area through the image mask based on the target image, so that the user can clearly perceive the copyright and is protected while the watermark is visible, the watching, reading and the like of the content in the target image are not influenced, and the purpose of properly adding the watermark is achieved.

Description

Method and device for adding image watermark, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of image processing technologies, and in particular, to a method and an apparatus for adding an image watermark in an image watermarking technology, an electronic device, and a storage medium.
Background
At present, images on a network usually protect copyright or trace back image sources and the like by adding watermarks.
How to properly watermark an image is an urgent problem to be solved in the field of image processing.
Disclosure of Invention
The present disclosure provides a method, apparatus, electronic device, and storage medium for appropriately adding an image watermark.
According to an aspect of the present disclosure, there is provided a method of adding an image watermark, including:
acquiring a watermark image to be added and a target image to be added with a watermark;
acquiring an image mask of the target image; the image mask includes a content image profile of content in the target image;
and covering a region of the target image, which is not the outline of the content image, with the watermark image at a preset watermark image adding position based on the image mask.
According to another aspect of the present disclosure, there is provided an apparatus for adding an image watermark, including:
the target image acquisition module is used for acquiring a watermark image to be added and a target image to be added with a watermark;
the image mask acquisition module is used for acquiring an image mask of the target image; the image mask includes a content image profile of content in the target image;
and the watermark image adding module is used for covering the area of the non-content image outline in the target image by using the watermark image at a preset watermark image adding position based on the image mask.
According to another aspect of the present disclosure, there is provided an electronic device including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform any of the above-described image watermarking methods.
According to another aspect of the present disclosure, there is also provided a non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform any one of the above-described image watermarking methods.
According to another aspect of the present disclosure, there is also provided a computer program product comprising a computer program which, when executed by a processor, implements any of the above-described image watermarking methods.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present disclosure, nor do they limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description.
Drawings
The drawings are included to provide a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
fig. 1 is a flow chart of a first embodiment of a method of adding an image watermark provided in accordance with the present disclosure;
FIG. 2 is a flow chart of a second embodiment of a method of adding an image watermark provided in accordance with the present disclosure;
FIG. 3 is a flowchart of a third embodiment of a method of adding an image watermark provided in accordance with the present disclosure
FIG. 4 is a flow chart of a fourth embodiment of a method of adding an image watermark provided in accordance with the present disclosure;
FIG. 5 is a flow chart of a fifth embodiment of a method of adding an image watermark provided in accordance with the present disclosure;
fig. 6a is a first schematic diagram of a specific application of the method of adding an image watermark provided by the present disclosure;
fig. 6b is a second schematic diagram of a specific application of the method of adding an image watermark provided by the present disclosure;
fig. 6c is a third schematic diagram of a specific application of the method of adding an image watermark provided by the present disclosure;
fig. 6d is a fourth schematic diagram of a specific application of the method of adding an image watermark provided by the present disclosure;
fig. 7 is a schematic structural diagram of an apparatus for adding an image watermark provided by the present disclosure;
fig. 8 is a block diagram of an electronic device for implementing a method of adding an image watermark according to an embodiment of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below with reference to the accompanying drawings, in which various details of the embodiments of the disclosure are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
At present, when a relevant person adds a watermark to an image, the following three watermark images, namely a semi-transparent watermark, an opaque watermark and a dark watermark, are mostly used.
For a semi-transparent watermark, if it is added to an image with a single content color, the watermark can be identified and filtered by setting a certain color threshold.
For an opaque watermark, since it directly covers the original image, it greatly affects the user's view and reading of the image.
The dark watermark is invisible to the user, the user cannot perform explicit copyright protection through the watermark, and the dark watermark cannot resist conversion scenes such as camera shooting, printing and scanning.
Therefore, there is a need for a method of watermarking an image that solves the above problems.
In order to properly watermark an image, the present disclosure provides a method, an apparatus, an electronic device, and a storage medium for watermarking an image.
Referring to fig. 1, fig. 1 is a flow chart of a first embodiment of a method of adding an image watermark provided in accordance with the present disclosure; the method may specifically comprise the steps of:
step S110, acquiring a watermark image to be added and a target image to be added with a watermark;
step S120, obtaining an image mask of the target image; the image mask includes a content image profile of content in the target image;
step S130, based on the image mask, at a preset watermark image adding position, covering a region of a non-content image contour in the target image with the watermark image.
The method for adding the image watermark comprises the steps of firstly obtaining an image mask of a target image to be added with the watermark, wherein the image mask comprises a content image outline of the target image, and then covering the watermark image in a non-content outline pixel area of the target image at a preset watermark image adding position based on the image mask. According to the method provided by the disclosure, the watermark image is added in the non-image outline area through the image mask based on the target image, so that the user can clearly perceive the copyright and is protected while the watermark is visible, the watching, reading and the like of the content in the target image are not influenced, and the purpose of properly adding the watermark is achieved.
In the embodiment of the present disclosure, the target image to be watermarked may be an image uploaded to a network by a user, and the image may be an image of a document, a test paper, or a book, or an image of a person, an animal, or the like, which is not specifically limited herein.
As described above, since the embodiment of the present disclosure adds a watermark to the target image based on the image mask of the target image, and the image mask includes the content image contour, in the embodiment of the present disclosure, when adding a watermark to the target image, the effective content in the target image can be avoided. Therefore, as a specific implementation manner of the embodiment of the present disclosure, when adding watermarks to images of documents, test papers, and books, a watermark image with the same color as or close to the color of the content of the image may be selected for adding, so that the watermark image is visible, and at the same time, the purposes of not covering effective content, not affecting reading of a user, and being difficult to remove the watermark may also be achieved, and the copyright of a target image is better protected while the user experience is improved.
Referring to fig. 2, fig. 2 is a flow chart of a second embodiment of a method of adding an image watermark provided according to the present disclosure; based on fig. 1, the step S120 is detailed in fig. 2, and the step S120 may specifically include the following steps:
and step S121, acquiring a content image outline of the content in the target image.
In the embodiment of the present disclosure, for documents such as documents, test papers, and books, the obtained content image contour may be an edge contour of characters and pictures contained therein, and for images such as people and animals, the obtained content image contour may be an edge contour of the corresponding people and animals.
And S122, drawing the content image outline in a blank image to obtain an image mask of the target image.
In the embodiment of the present disclosure, a blank image may be created in advance, and after the content image contour of the target image is obtained, the content image contour is drawn into the blank image.
According to the method and the device, the image mask is obtained by drawing the obtained content image outline of the target image in the blank image, and the subsequent watermark adding is carried out based on the image mask, so that the watermark image is further ensured not to shield the content of the target image, that is, the watermark adding is more appropriate, that is, the added watermark does not influence the watching, reading and the like of the target image by a user, and the user experience is further improved.
Referring to fig. 3, fig. 3 is a flow chart of a third embodiment of a method of adding an image watermark provided in accordance with the present disclosure; the method specifically comprises the following steps:
and step S310, acquiring a watermark image to be added and a target image to be added with a watermark.
This step may be identical to step S110 described above.
And step S320, performing edge identification on the content in the target image to obtain the edge of the content image.
In the embodiment of the present disclosure, an algorithm such as a Canny edge detection algorithm provided in an open source software platform (e.g., opencv) may be used to perform edge identification on content in a target image, so as to obtain an edge of the content image.
And step S330, obtaining the content image contour of the content in the target image based on the identified edge of the content image.
Because there may be a certain noise at the edge of the content image extracted by using the edge detection algorithm, that is, the edge of the extracted content image may be wider, and if an image mask is directly obtained based on the edge, the occlusion of the content image by the image mask may be not accurate enough, in this embodiment of the disclosure, after the edge of the content image is obtained, the edge may be further processed to obtain a more accurate profile of the content image. Specifically, the method can be implemented by using an edge tracking algorithm provided in an open-source software platform.
Step S340, drawing the content image contour in the blank image, and filling the content image contour with a preset contour pixel value to obtain an image mask of the target image.
The preset contour pixel value can be set according to requirements, such as RGB color values (255 ) corresponding to white, and is not limited herein. The area outside the outline of the content image may be filled with pixel values having a large difference from the pixel values, for example, if the color selected in the area surrounded by the filled content outline is white, the area outside the content outline may be filled with black, and the corresponding pixel value may be RGB value (0,0,0) corresponding to black. After the content image outline is filled, the area in the outline can be covered to obtain a corresponding image mask.
And step S350, covering a region of the non-content image outline in the target image by using the watermark image at a preset watermark image adding position based on the image mask.
In the embodiment of the disclosure, the content in the target image is subjected to edge recognition, the recognized edge is extracted and is drawn in the blank image, and the content image outline is filled in the blank image to obtain the image mask, so that the obtained image mask can more accurately and completely cover the content in the target image, and the content in the target image is further ensured not to be shielded when the watermark is added to the target image.
Referring to fig. 4, fig. 4 is a flowchart of a fourth embodiment of a method of adding an image watermark provided according to an embodiment of the present disclosure; based on fig. 3, the step S320 is detailed in fig. 4, and the step S320 may specifically include the following steps:
step S321, converting the target image into a grayscale image.
At present, most images on a network are RGB images, which are images using an RGB color mode. The RGB color scheme is a variety of colors obtained by changing three color channels of red (R), green (G) and blue (B) and superimposing them on each other. Each pixel point in the RGB image has its color value, and the color value is the RGB value of the pixel point. Therefore, as a specific implementation of the embodiment of the present disclosure, converting the target image into the grayscale map may be implemented by the following processes:
step one, obtaining color values of all pixel points in a target image;
and secondly, converting the target image into a gray image based on the color values of the pixel points and preset color weights.
As a specific implementation manner of the embodiment of the present disclosure, the gray scale image pixel point corresponding to each pixel point may be calculated by using the following formula:
Grey=0.299*R+0.587*G+0.114*B
in the formula, R refers to the color value of the R (red) channel of the pixel, and the preset weight of the color channel is 0.299; g is the G (green) channel color value of the pixel point, and the preset weight of the color channel is 0.587; and B indicates the color value of the B (blue) channel of the pixel, and the preset weight of the color is 0.114.
Since in an ALU (arithmetic and logic unit), bit operations are faster than integer additions, integer additions are faster than integer multiplications, and integer operations are superior in speed to floating point operations. Therefore, the formula can be optimized by converting floating-point number operation into integer operation and converting the integer operation into bit operation, and the following formula can be obtained after optimization:
Grey=(R*299+G*587+B*114+500)/1000
since integer arithmetic truncates the fractional part, 500 can be added to the formula to reduce the loss of precision.
And traversing the pixel points in the target image, and obtaining the gray value corresponding to the pixel point based on the optimized formula for each pixel point, so that the target image can be converted into a gray map.
As shown in fig. 4, in step S322, edge recognition is performed on the content in the grayscale image to obtain the edge of the content image.
Based on the gray level map, the content in the map is subjected to edge recognition, a Canny edge detection algorithm can be adopted, and the Canny edge detection algorithm can be realized through the following steps:
and step 1, carrying out noise reduction treatment on the gray-scale image.
This step can eliminate the effect of false edges caused by noise.
And 2, calculating the image gradient of the gray level image subjected to the noise reduction treatment to obtain the edge of a possible content image.
And 3, inhibiting the non-maximum value.
In general, the gray scale change places are concentrated, so that a large number of pixels can be eliminated by reserving the pixels with large gray scale change in the gradient direction in the local range and not reserving the other pixels, and thus, the edge with a plurality of pixels width is changed into a single-pixel width edge.
And 4, double-threshold screening.
After the suppression by the non-maximum value, there are still many possible edge points, so a double threshold, i.e., a low threshold (low) and a high threshold (high), may be further set. If the gray level change is larger than high, the pixel is set as a strong edge pixel, and if the gray level change is lower than low, the pixel is rejected. The pixels between low and high may be set to weak edges. If there are strong edge pixels in the region between low and high, then it is retained, if not, then it is discarded. This makes the captured edge as closed as possible.
The edge of the content image of the content in the target image can be obtained through the steps.
Of course, in the embodiment of the present disclosure, other edge detection algorithms may also be used to implement edge identification on the content in the gray scale image, and this is not limited in detail here.
Accordingly, as shown in fig. 4, the step S330 may be subdivided into:
and step S331, performing edge expansion processing on the identified edge of the content image to obtain an edge contour of the content image.
In this step, binarization processing may be performed on the edge generated in the previous step. Specifically, the edge pixel value may be set to 1, the remaining pixels may be set to 0, and the pixel value of the pixel whose distance from the pixel whose pixel value is 1 is smaller than N may be set to 1. The value of N can be set according to actual conditions.
In this way, the edge contour of the acquired content image can be further closed as much as possible.
The edge of the content image in the target image is obtained by converting the target image into the gray image, performing edge identification based on the gray image and performing edge expansion processing on the identified edge, so that the edge of the obtained content image is more accurate, clear and complete.
Referring to fig. 5, fig. 5 is a flowchart of a fifth embodiment of a method for adding an image watermark provided according to an embodiment of the present disclosure; based on fig. 1 and fig. 5, the step S130 is detailed, and the step S130 may specifically include the following steps:
step S131, determining whether each pixel point in a preset watermark image adding position in the target image is a contour pixel in the contour of the content image based on the image mask, and if the pixel point is the contour pixel in the contour of the content image, executing step S132; if the pixel point is not a contour pixel in the contour of the content image, executing step S133;
that is, before replacing the pixel at the watermark image adding position preset in the target image with the watermark image pixel, it is necessary to query whether the pixel to be replaced belongs to the pixel in the content contour in the image mask. Specifically, the pixel point at the position added to the watermark image preset in the target image may be found in the image mask, and whether the pixel point belongs to the content image or not may be queried.
Step S132, reserving the pixel point;
and step S133, replacing the pixel with the watermark image pixel.
In general, images of documents, examination papers, and books on a network are presented to a network user in the same size, and therefore, as an embodiment of the present disclosure, a watermark template having the same size as a target image may be preset, and a pattern, a size, and a position of the watermark image are fixed on the watermark template in advance. Thus, when a watermark image is added to a target image, the addition can be performed in accordance with the watermark template. Specifically, the watermark image may be added at a preset watermark adding position in the target image based on an image mask of the target image, so that the watermark image is shielded by a content image contour of the target image. That is, as a specific implementation manner of the embodiment of the present disclosure, the process of adding the watermark to the target image may be implemented by using an image mask of the target image to block the watermark image. The watermark image may be a plurality of identical images arranged at a predetermined tilt angle, pitch, or the like. Of course, the watermark image may be smaller than the target image, and accordingly, when the watermark image is added, the watermark image may be arranged according to a preset inclination angle, a preset pitch, and the like.
In the embodiment of the present disclosure, there may be a plurality of patterns of the watermark image, and accordingly, one or more patterns of the watermark image added to the target image may be used, and are not specifically limited herein.
In the embodiment of the disclosure, whether the target image is the content image contour pixel or not is inquired before the pixel in the target image is replaced by the watermark image pixel, so that the watermark image can be more accurately added in the region of the target image which is not the content image contour pixel, and the watermark addition is more appropriate.
Fig. 6a to 6d show an example of watermark addition using the image watermarking method provided by the embodiment of the present disclosure.
As shown in fig. 6a to 6d, the target image to be watermarked is a test paper image, and the content in the test paper image includes characters and pictures.
A grayscale image of the target image is shown in fig. 6 a; the edge contour of the content image shown in fig. 6b can be obtained by performing edge recognition and edge dilation on the content in the grayscale image. The outline is drawn to a blank image and filled in to obtain an image mask of the target image, as shown in fig. 6 c. After obtaining the image mask of the target image, the watermark can be added to the target image based on the image mask, as shown in fig. 6d, the added watermark image in this example can be a small watermark image composed of a figure and a character, of course, the small watermark image can be arranged into a blank image with the same size as the target image according to a preset inclination angle, a preset watermark interval, and the like to obtain a large watermark image template, and the area with a non-content contour is covered according to the watermark adding position preset in the target image by the watermark image template.
The present disclosure also provides an apparatus for adding an image watermark, as shown in fig. 7, the apparatus may include:
a target image obtaining module 710, configured to obtain a watermark image to be added and a target image to be added with a watermark;
an image mask obtaining module 720, configured to obtain an image mask of the target image; the image mask includes a content image profile of content in the target image;
the watermark image adding module 730 may be configured to cover, at a preset watermark image adding position, an area of the target image, which is not a content image outline, with the watermark image based on the image mask.
As a specific implementation manner of the embodiment of the present disclosure, the image mask obtaining module may include:
the image contour acquisition submodule can be used for acquiring the content image contour of the content in the target image;
and the image mask obtaining submodule can be used for drawing the content image outline in the blank image to obtain the image mask of the target image.
As a specific implementation of the disclosed embodiment, the image contour acquisition sub-module may be specifically configured to,
performing edge identification on the content in the target image to obtain the edge of the content image;
obtaining a content image outline of the content in the target image based on the identified edge of the content image;
the image mask obtaining sub-module may be specifically configured to draw the content image contour in a blank image, and fill the content image contour with a preset contour pixel value to obtain an image mask of the target image.
As a specific implementation of the disclosed embodiment, the image contour acquisition sub-module may be specifically configured to,
converting the target image into a grey-scale map;
performing edge identification on the content in the gray-scale image to obtain the edge of the content image;
and performing edge expansion processing on the identified edge of the content image to obtain an edge contour of the content image.
As a specific implementation manner of the embodiment of the present disclosure, the watermark image adding module may be specifically configured to,
determining whether each pixel point in a preset watermark image adding position in a target image is a contour pixel in the contour of a content image based on the image mask;
if the pixel point is a contour pixel in the contour of the content image, the pixel point is reserved;
and if the pixel point is not the contour pixel in the contour of the content image, replacing the pixel with the pixel of the watermark image.
In the technical scheme of the disclosure, the acquisition, storage, application and the like of the personal information of the related user all accord with the regulations of related laws and regulations, and do not violate the good customs of the public order.
The present disclosure also provides an electronic device, a readable storage medium, and a computer program product according to embodiments of the present disclosure.
FIG. 8 illustrates a schematic block diagram of an example electronic device 800 that can be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 8, the apparatus 800 includes a computing unit 801 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM)802 or a computer program loaded from a storage unit 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the device 800 can also be stored. The calculation unit 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
A number of components in the device 800 are connected to the I/O interface 805, including: an input unit 806, such as a keyboard, a mouse, or the like; an output unit 807 such as various types of displays, speakers, and the like; a storage unit 808, such as a magnetic disk, optical disk, or the like; and a communication unit 809 such as a network card, modem, wireless communication transceiver, etc. The communication unit 809 allows the device 800 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
Computing unit 801 may be a variety of general and/or special purpose processing components with processing and computing capabilities. Some examples of the computing unit 801 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various dedicated Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, and the like. The calculation unit 801 executes the respective methods and processes described above, such as the method of adding an image watermark. For example, in some embodiments, the method of adding an image watermark may be implemented as a computer software program tangibly embodied in a machine-readable medium, such as storage unit 808. In some embodiments, part or all of the computer program can be loaded and/or installed onto device 800 via ROM 802 and/or communications unit 809. When the computer program is loaded into the RAM 803 and executed by the computing unit 801, one or more steps of the method of adding an image watermark described above may be performed. Alternatively, in other embodiments, the computing unit 801 may be configured to perform the method of adding image watermarks by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for implementing the methods of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the program codes, when executed by the processor or controller, cause the functions/operations specified in the flowchart and/or block diagram to be performed. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, 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 disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), and the Internet.
The computer system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server with a combined blockchain.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present disclosure may be executed in parallel, sequentially, or in different orders, as long as the desired results of the technical solutions disclosed in the present disclosure can be achieved, and the present disclosure is not limited herein.
The above detailed description should not be construed as limiting the scope of the disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present disclosure should be included in the scope of protection of the present disclosure.

Claims (13)

1. A method of watermarking an image, comprising:
acquiring a watermark image to be added and a target image to be added with a watermark;
acquiring an image mask of the target image; the image mask includes a content image profile of content in the target image;
and covering a region of the target image, which is not the outline of the content image, with the watermark image at a preset watermark image adding position based on the image mask.
2. The method of claim 1, wherein,
the step of obtaining an image mask of the target image comprises:
acquiring a content image outline of content in the target image;
and drawing the outline of the content image in the blank image to obtain an image mask of the target image.
3. The method of claim 2, wherein,
the step of obtaining the content image contour of the content in the target image includes:
performing edge identification on the content in the target image to obtain the edge of the content image;
obtaining a content image outline of the content in the target image based on the identified edge of the content image;
the step of drawing the content image contour in the blank image to obtain the image mask of the target image comprises the following steps:
and drawing the content image contour in the blank image, and filling the content image contour with preset contour pixel values to obtain an image mask of the target image.
4. The method of claim 3, wherein,
the step of performing edge recognition on the content in the target image to obtain the edge of the content image includes:
converting the target image into a grey-scale map;
performing edge identification on the content in the gray-scale image to obtain the edge of the content image;
the step of obtaining the content image contour of the content in the target image based on the identified edge of the content image includes:
and performing edge expansion processing on the identified edge of the content image to obtain an edge contour of the content image.
5. The method of claim 1, wherein,
the step of covering a region of the target image, which is not the outline of the content image, with the watermark image at a preset watermark image adding position based on the image mask includes:
determining whether each pixel point in a preset watermark image adding position in a target image is a contour pixel in the contour of a content image based on the image mask;
if the pixel point is a contour pixel in the contour of the content image, the pixel point is reserved;
and if the pixel point is not the contour pixel in the contour of the content image, replacing the pixel with the pixel of the watermark image.
6. An apparatus for watermarking an image, comprising:
the target image acquisition module is used for acquiring a watermark image to be added and a target image to be added with a watermark;
the image mask acquisition module is used for acquiring an image mask of the target image; the image mask includes a content image profile of content in the target image;
and the watermark image adding module is used for covering the area of the non-content image outline in the target image by using the watermark image at a preset watermark image adding position based on the image mask.
7. The apparatus of claim 6, wherein the image mask acquisition module comprises:
the image contour acquisition submodule is used for acquiring the content image contour of the content in the target image;
and the image mask obtaining submodule is used for drawing the content image outline in a blank image to obtain an image mask of the target image.
8. The apparatus of claim 7, wherein,
the image contour acquisition sub-module is specifically configured to,
performing edge identification on the content in the target image to obtain the edge of the content image;
obtaining a content image outline of the content in the target image based on the identified edge of the content image;
the image mask obtaining submodule is specifically used for drawing the content image outline in a blank image and filling the content image outline with a preset outline pixel value to obtain the image mask of the target image.
9. The apparatus of claim 8, wherein the image contour acquisition sub-module is specific to,
converting the target image into a grey-scale map;
performing edge identification on the content in the gray-scale image to obtain the edge of the content image;
and performing edge expansion processing on the identified edge of the content image to obtain an edge contour of the content image.
10. The apparatus of claim 6, wherein the watermark image adding module is specifically configured to,
determining whether each pixel point in a preset watermark image adding position in a target image is a contour pixel in the contour of a content image based on the image mask;
if the pixel point is a contour pixel in the contour of the content image, the pixel point is reserved;
and if the pixel point is not the contour pixel in the contour of the content image, replacing the pixel with the pixel of the watermark image.
11. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-5.
12. A non-transitory computer readable storage medium having stored thereon computer instructions for causing the computer to perform the method of any one of claims 1-5.
13. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-5.
CN202110887835.3A 2021-08-03 2021-08-03 Method and device for adding image watermark, electronic equipment and storage medium Active CN113487473B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110887835.3A CN113487473B (en) 2021-08-03 2021-08-03 Method and device for adding image watermark, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110887835.3A CN113487473B (en) 2021-08-03 2021-08-03 Method and device for adding image watermark, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113487473A true CN113487473A (en) 2021-10-08
CN113487473B CN113487473B (en) 2024-03-26

Family

ID=77945371

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110887835.3A Active CN113487473B (en) 2021-08-03 2021-08-03 Method and device for adding image watermark, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113487473B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114004726A (en) * 2021-10-18 2022-02-01 云南腾云信息产业有限公司 Watermark display method, watermark display device, computer equipment and storage medium
CN116756708A (en) * 2023-05-30 2023-09-15 佛山众陶联供应链服务有限公司 Protection method for variable granularity of digital product page copyright
WO2023226817A1 (en) * 2022-05-27 2023-11-30 京东方科技集团股份有限公司 Method and apparatus for processing display information, storage medium, and electronic device

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090080688A1 (en) * 2007-09-25 2009-03-26 The Hong Kong University Of Science And Technology Digital watermarking for few-color images
US20160335733A1 (en) * 2015-05-12 2016-11-17 Digify Pte Ltd Method and system for adaptive content protection
CN107885565A (en) * 2017-10-31 2018-04-06 平安科技(深圳)有限公司 Watermark embedding method, device, equipment and the storage medium at financial APP interfaces
CN108550101A (en) * 2018-04-19 2018-09-18 腾讯科技(深圳)有限公司 Image processing method, device and storage medium
CN112183294A (en) * 2020-09-23 2021-01-05 广州虎牙科技有限公司 Text elimination method and device, electronic equipment and storage medium
CN112581344A (en) * 2020-11-20 2021-03-30 平安普惠企业管理有限公司 Image processing method and device, computer equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090080688A1 (en) * 2007-09-25 2009-03-26 The Hong Kong University Of Science And Technology Digital watermarking for few-color images
US20160335733A1 (en) * 2015-05-12 2016-11-17 Digify Pte Ltd Method and system for adaptive content protection
CN107885565A (en) * 2017-10-31 2018-04-06 平安科技(深圳)有限公司 Watermark embedding method, device, equipment and the storage medium at financial APP interfaces
CN108550101A (en) * 2018-04-19 2018-09-18 腾讯科技(深圳)有限公司 Image processing method, device and storage medium
CN112183294A (en) * 2020-09-23 2021-01-05 广州虎牙科技有限公司 Text elimination method and device, electronic equipment and storage medium
CN112581344A (en) * 2020-11-20 2021-03-30 平安普惠企业管理有限公司 Image processing method and device, computer equipment and storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
ZOU, XG等: "Blind Watermarking Algorithm for Color Images Based on Nearest Neighbor Interpolation", 《 MEASUREMENT TECHNOLOGY AND ENGINEERING RESEARCHES IN INDUSTRY》, 28 February 2014 (2014-02-28) *
王树梅;: "图像特征里的小波域水印算法", 《计算机工程与应用》, no. 08, 11 March 2011 (2011-03-11) *
王楠等: "基于回归型支持向量机的医学图像可视可逆水印算法", 《计算机科学》, no. 09, 15 September 2018 (2018-09-15) *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114004726A (en) * 2021-10-18 2022-02-01 云南腾云信息产业有限公司 Watermark display method, watermark display device, computer equipment and storage medium
WO2023226817A1 (en) * 2022-05-27 2023-11-30 京东方科技集团股份有限公司 Method and apparatus for processing display information, storage medium, and electronic device
CN116756708A (en) * 2023-05-30 2023-09-15 佛山众陶联供应链服务有限公司 Protection method for variable granularity of digital product page copyright
CN116756708B (en) * 2023-05-30 2023-12-05 佛山众陶联供应链服务有限公司 Protection method for variable granularity of digital product page copyright

Also Published As

Publication number Publication date
CN113487473B (en) 2024-03-26

Similar Documents

Publication Publication Date Title
CN113487473B (en) Method and device for adding image watermark, electronic equipment and storage medium
CN107403421B (en) Image defogging method, storage medium and terminal equipment
CN110008969B (en) Method and device for detecting image saliency region
CN113160257B (en) Image data labeling method, device, electronic equipment and storage medium
AU2011250829B2 (en) Image processing apparatus, image processing method, and program
CN107622504B (en) Method and device for processing pictures
RU2008143205A (en) EFFICIENT CODING OF MANY SPECIES
CN111259878A (en) Method and equipment for detecting text
AU2011250827B2 (en) Image processing apparatus, image processing method, and program
CN112651953B (en) Picture similarity calculation method and device, computer equipment and storage medium
US11810293B2 (en) Information processing device, information processing method, and computer program
CN109214996B (en) Image processing method and device
CN112749696B (en) Text detection method and device
CN108805838B (en) Image processing method, mobile terminal and computer readable storage medium
CN113592776A (en) Image processing method and device, electronic device and storage medium
CN112396050B (en) Image processing method, device and storage medium
CN110969046A (en) Face recognition method, face recognition device and computer-readable storage medium
CN111724396A (en) Image segmentation method and device, computer-readable storage medium and electronic device
CN112102207A (en) Method and device for determining temperature, electronic equipment and readable storage medium
CN108877030B (en) Image processing method, device, terminal and computer readable storage medium
CN113076952B (en) Text automatic recognition and enhancement method and device
CN117765393A (en) Insect pest monitoring method, system, device and medium based on image recognition
CN110942488B (en) Image processing device, image processing system, image processing method, and recording medium
CN115345895B (en) Image segmentation method and device for visual detection, computer equipment and medium
CN111311610A (en) Image segmentation method and terminal equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant