Introduction to digital watermark technology

1 digital watermark

1.1 Definition

  Digital watermarking is a technology that embeds identification information into multimedia files through a certain algorithm without affecting the value and use of the original multimedia. Digital watermarking takes advantage of the insensitivity of the human body's senses and the redundancy of the information itself, using hardware or software methods to integrate images, texts and other digital signals that can be used as identification information with the original carrier and deeply hide them. And can detect or extract secret information when necessary.
  Digital watermark technology is a passive protection tool that can only mark data and cannot prevent the illegal use of the original data. Its basic characteristics are as follows:

  • Imperceptibility: From a sensory perspective, embedding hidden information in multimedia works will cause changes in the original data, but this change will not be detected by hearing or vision alone.
  • Security: Digital watermark information cannot be forged.
  • Robustness: refers to the ability of the watermark information to be extracted completely and accurately after the digital carrier is interfered or destroyed by illegal intruders.
  • Embedding capacity: As the embedding capacity increases, the imperceptibility of the watermark will decrease.
  • Unambiguity: Digital watermarks must be able to and uniquely identified to determine the true ownership of multimedia works.
1.2 Classification

According to the embedding position of digital watermark, it can be divided into:

  • Spatial domain watermarking algorithm: operates directly on the gray value of the image without transforming the original carrier. It has the advantages of simple calculation, high efficiency, and large embedding capacity.
  • Transform domain watermarking algorithm: By performing specified tasks in the transform domain, and then using inverse transformation to return to the spatial domain, the information hiding effect is achieved. Currently commonly used transformation domains include DWT domain or DCT domain.
1.3 Example

  Use LSB algorithm to add text type watermark to image files.

from PIL import Image
#图片文件
img=Image.open(r'/Users/sherry/Downloads/杀生丸.jpeg')
rgb_img=img.convert('RGB')

#水印信息
text='作者:sherry_sun,2023-09-11'
bin_text=''.join(format(ord(i),'08b') for i in text)

k=0
while True:
    if k==len(bin_text):
        break
    i=(k//3)//img.size[1]
    j=(k//3)%img.size[1]
    data=list(img.getpixel((i,j)))
    data[k%3]=(data[k%3]-data[k%3]%2)+int(bin_text[k])
    img.putpixel((i,j),tuple(data))
    k=k+1

img.save('/Users/sherry/documents/杀生丸1.jpeg')

Guess you like

Origin blog.csdn.net/yeshang_lady/article/details/132801141