What is digital blind watermarking

See this post for details.

The basic process is: Fourier transform the original image, and then add watermark in the converted frequency domain, and then invert Fourier transform to generate the image with blind watermark.

Such images do not see watermarks and can withstand torture.

The original watermark can be seen in the frequency domain as long as the image with watermark is Fourier transform.

implementation

So the key is the Fourier transform and the inverse transform. There are many methods, such as NUMpy with FFT (fast Fourier transform) implementation.

Here is a command line image processing tool: ImageMagick. This is a very powerful tool that provides almost everything you need for image processing, but Fourier transform is a relatively uncommon feature, so it is implemented by integrating another tool, FFTW.

So you need to install both ImageMagick and FFTW on your system before using it. Note that if you have install or compile options, make sure to add –with-fft to ImageMagick to integrate FFTW.

That leaves these commands:

convert test.jpg -fft fft.png
convert mark.png -rotate 180 mark1.png
convert fft-1.png mark.png -gravity northwest -geometry +330+360 -composite fft-2.png
convert fft-2.png mark1.png -gravity southeast -geometry +330+360 -composite fft-1.png
convert fft-0.png fft-1.png -ift -crop 1200x800+0+0 test1.jpg
convert test1.jpg -fft fft1.png
Copy the code

In the above command, convert is the main command for ImageMagick. Test.jpg is a test image with a size of 1200×800, and mark. PNG is a transparent PNG image watermark with a size of 160×120.

In this example, we use a plaintext watermark, which will leave some texture in the target image. It will be better if we encode it and scatter it.

PNG, ffT-0.png, and fft-1.png. Fft-0 is the amplitude spectrum of the image, and FFT-1 is the associated spectrum (i.e. frequency domain).

The second sentence generates a watermarking image rotated 180 degrees, which is used to generate symmetric watermarks.

The third sentence is to put a watermark in the upper left third position of the phase spectrum, the specific position can be adjusted, the higher the left, the lower the watermark energy, and the easier it is to lose, the more to the middle of the target image.

The fourth sentence is the same as the third, but a rotated watermark is placed symmetrically in the lower right.

The fifth sentence takes the inverse Fourier transform and clipping (because the image becomes a square) to generate the target image.

The sixth sentence is the target image for the Fourier transform, then you can see the watermark in ffT1-1.png.