Blind Watermark
A Rust library for blind image watermarking using DWT (Discrete Wavelet Transform), DCT (Discrete Cosine Transform), and SVD (Singular Value Decomposition). The algorithm is originally implemented in python by Guo Fei at this repository. This is the rust rewritten version.
Features
- Blind Watermarking: Extract the watermark without needing the original image.
- Robust Algorithm: Combines DWT, DCT, and SVD for embedding watermarks in the frequency domain.
- High Performance: Developed in Rust, leveraging the
faercrate for efficient matrix computations andrayonfor multi-threading support. - Flexible: Supports embedding arbitrary binary data.
- Random Strategy: Supports randomized block selection for embedding watermarks, enhancing security.
- High-Level API: Provides a fluent builder-like API for easy integration.
Original Image

Processed Image

Installation
Add this to your Cargo.toml:
[]
= "0.1.0"
Usage
Embedding a Watermark
use *;
use *;
OR
use *;
use *;
use ;
Extracting a Watermark
To extract the watermark, you only need the watermarked image and the length of the watermark.
use *;
use ImageReader;
OR
use *;
use *;
use ImageReader;
Algorithm Details
The library implements a hybrid DWT-DCT-SVD watermarking scheme:
- Preprocessing: The image is converted to YCbCr color space.
- DWT: A Discrete Wavelet Transform is applied to decompose the image into frequency subbands (LL, HL, LH, HH).
- Block Selection: The LL (Low-Low) subband is divided into 4x4 blocks.
- DCT & SVD: Each block undergoes Discrete Cosine Transform (DCT) followed by Singular Value Decomposition (SVD).
- Embedding: The watermark bits are embedded by quantizing the singular values of the blocks.
- Reconstruction: The inverse transformations (ISVD, IDCT, IDWT) are applied to generate the watermarked image.
This approach ensures that the watermark is embedded in the significant features of the image, providing robustness while maintaining visual quality.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.